mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-11-09 03:23:09 +01:00
Merge pull request #2651 from FortressNebula/mc1.18/dev
Allow CopperBlockSet to use different root directories
This commit is contained in:
commit
b59092ec77
1 changed files with 16 additions and 6 deletions
|
@ -55,18 +55,28 @@ public class CopperBlockSet {
|
||||||
new Variant<?>[] { BlockVariant.INSTANCE, SlabVariant.INSTANCE, StairVariant.INSTANCE };
|
new Variant<?>[] { BlockVariant.INSTANCE, SlabVariant.INSTANCE, StairVariant.INSTANCE };
|
||||||
|
|
||||||
protected final String name;
|
protected final String name;
|
||||||
|
protected final String generalDirectory; // Leave empty for root folder
|
||||||
protected final Variant<?>[] variants;
|
protected final Variant<?>[] variants;
|
||||||
protected final Map<Variant<?>, BlockEntry<?>[]> entries = new HashMap<>();
|
protected final Map<Variant<?>, BlockEntry<?>[]> entries = new HashMap<>();
|
||||||
protected final NonNullBiConsumer<DataGenContext<Block, ?>, RegistrateRecipeProvider> mainBlockRecipe;
|
protected final NonNullBiConsumer<DataGenContext<Block, ?>, RegistrateRecipeProvider> mainBlockRecipe;
|
||||||
protected final String endTextureName;
|
protected final String endTextureName;
|
||||||
|
|
||||||
public CopperBlockSet(AbstractRegistrate<?> registrate, String name, String endTextureName, Variant<?>[] variants) {
|
public CopperBlockSet(AbstractRegistrate<?> registrate, String name, String endTextureName, Variant<?>[] variants) {
|
||||||
this(registrate, name, endTextureName, variants, NonNullBiConsumer.noop());
|
this(registrate, name, endTextureName, variants, NonNullBiConsumer.noop(), "copper/");
|
||||||
|
}
|
||||||
|
|
||||||
|
public CopperBlockSet(AbstractRegistrate<?> registrate, String name, String endTextureName, Variant<?>[] variants, String generalDirectory) {
|
||||||
|
this(registrate, name, endTextureName, variants, NonNullBiConsumer.noop(), generalDirectory);
|
||||||
|
}
|
||||||
|
|
||||||
|
public CopperBlockSet(AbstractRegistrate<?> registrate, String name, String endTextureName, Variant<?>[] variants, NonNullBiConsumer<DataGenContext<Block, ?>, RegistrateRecipeProvider> mainBlockRecipe) {
|
||||||
|
this(registrate, name, endTextureName, variants, mainBlockRecipe, "copper/");
|
||||||
}
|
}
|
||||||
|
|
||||||
public CopperBlockSet(AbstractRegistrate<?> registrate, String name, String endTextureName, Variant<?>[] variants,
|
public CopperBlockSet(AbstractRegistrate<?> registrate, String name, String endTextureName, Variant<?>[] variants,
|
||||||
NonNullBiConsumer<DataGenContext<Block, ?>, RegistrateRecipeProvider> mainBlockRecipe) {
|
NonNullBiConsumer<DataGenContext<Block, ?>, RegistrateRecipeProvider> mainBlockRecipe, String generalDirectory) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
this.generalDirectory = generalDirectory;
|
||||||
this.endTextureName = endTextureName;
|
this.endTextureName = endTextureName;
|
||||||
this.variants = variants;
|
this.variants = variants;
|
||||||
this.mainBlockRecipe = mainBlockRecipe;
|
this.mainBlockRecipe = mainBlockRecipe;
|
||||||
|
@ -129,7 +139,7 @@ public class CopperBlockSet {
|
||||||
.requires(Items.HONEYCOMB)
|
.requires(Items.HONEYCOMB)
|
||||||
.unlockedBy("has_unwaxed", RegistrateRecipeProvider.has(unwaxed))
|
.unlockedBy("has_unwaxed", RegistrateRecipeProvider.has(unwaxed))
|
||||||
.save(prov, new ResourceLocation(ctx.getId()
|
.save(prov, new ResourceLocation(ctx.getId()
|
||||||
.getNamespace(), "crafting/copper/" + ctx.getName() + "_from_honeycomb"));
|
.getNamespace(), "crafting/" + generalDirectory + ctx.getName() + "_from_honeycomb"));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -217,7 +227,7 @@ public class CopperBlockSet {
|
||||||
Block block = ctx.get();
|
Block block = ctx.get();
|
||||||
String path = block.getRegistryName()
|
String path = block.getRegistryName()
|
||||||
.getPath();
|
.getPath();
|
||||||
String baseLoc = ModelProvider.BLOCK_FOLDER + "/copper/" + getWeatherStatePrefix(state);
|
String baseLoc = ModelProvider.BLOCK_FOLDER + "/" + blocks.generalDirectory + getWeatherStatePrefix(state);
|
||||||
ResourceLocation texture = prov.modLoc(baseLoc + blocks.getName());
|
ResourceLocation texture = prov.modLoc(baseLoc + blocks.getName());
|
||||||
ResourceLocation endTexture = prov.modLoc(baseLoc + blocks.getEndTextureName());
|
ResourceLocation endTexture = prov.modLoc(baseLoc + blocks.getEndTextureName());
|
||||||
prov.simpleBlock(block, prov.models()
|
prov.simpleBlock(block, prov.models()
|
||||||
|
@ -262,7 +272,7 @@ public class CopperBlockSet {
|
||||||
ResourceLocation fullModel =
|
ResourceLocation fullModel =
|
||||||
prov.modLoc(ModelProvider.BLOCK_FOLDER + "/" + getWeatherStatePrefix(state) + blocks.getName());
|
prov.modLoc(ModelProvider.BLOCK_FOLDER + "/" + getWeatherStatePrefix(state) + blocks.getName());
|
||||||
|
|
||||||
String baseLoc = ModelProvider.BLOCK_FOLDER + "/copper/" + getWeatherStatePrefix(state);
|
String baseLoc = ModelProvider.BLOCK_FOLDER + "/" + blocks.generalDirectory + getWeatherStatePrefix(state);
|
||||||
ResourceLocation texture = prov.modLoc(baseLoc + blocks.getName());
|
ResourceLocation texture = prov.modLoc(baseLoc + blocks.getName());
|
||||||
ResourceLocation endTexture = prov.modLoc(baseLoc + blocks.getEndTextureName());
|
ResourceLocation endTexture = prov.modLoc(baseLoc + blocks.getEndTextureName());
|
||||||
|
|
||||||
|
@ -317,7 +327,7 @@ public class CopperBlockSet {
|
||||||
@Override
|
@Override
|
||||||
public void generateBlockState(DataGenContext<Block, StairBlock> ctx, RegistrateBlockstateProvider prov,
|
public void generateBlockState(DataGenContext<Block, StairBlock> ctx, RegistrateBlockstateProvider prov,
|
||||||
CopperBlockSet blocks, WeatherState state, boolean waxed) {
|
CopperBlockSet blocks, WeatherState state, boolean waxed) {
|
||||||
String baseLoc = ModelProvider.BLOCK_FOLDER + "/copper/" + getWeatherStatePrefix(state);
|
String baseLoc = ModelProvider.BLOCK_FOLDER + "/" + blocks.generalDirectory + getWeatherStatePrefix(state);
|
||||||
ResourceLocation texture = prov.modLoc(baseLoc + blocks.getName());
|
ResourceLocation texture = prov.modLoc(baseLoc + blocks.getName());
|
||||||
ResourceLocation endTexture = prov.modLoc(baseLoc + blocks.getEndTextureName());
|
ResourceLocation endTexture = prov.modLoc(baseLoc + blocks.getEndTextureName());
|
||||||
prov.stairsBlock(ctx.get(), texture, endTexture, endTexture);
|
prov.stairsBlock(ctx.get(), texture, endTexture, endTexture);
|
||||||
|
|
Loading…
Reference in a new issue