mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-28 16:06:48 +01:00
Allow copper block set to use different root directories
CopperBlockSet has many useful functionalities that addons could use for their own metals that also oxidize. It'd be nicer and more intuitive for anyone going through our github, however, if they could be in their own separate directory.
This commit is contained in:
parent
6fd1e2cc63
commit
91775aff41
1 changed files with 16 additions and 6 deletions
|
@ -55,18 +55,28 @@ public class CopperBlockSet {
|
|||
new Variant<?>[] { BlockVariant.INSTANCE, SlabVariant.INSTANCE, StairVariant.INSTANCE };
|
||||
|
||||
protected final String name;
|
||||
protected final String generalDirectory; // Leave empty for root folder
|
||||
protected final Variant<?>[] variants;
|
||||
protected final Map<Variant<?>, BlockEntry<?>[]> entries = new HashMap<>();
|
||||
protected final NonNullBiConsumer<DataGenContext<Block, ?>, RegistrateRecipeProvider> mainBlockRecipe;
|
||||
protected final String endTextureName;
|
||||
|
||||
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,
|
||||
NonNullBiConsumer<DataGenContext<Block, ?>, RegistrateRecipeProvider> mainBlockRecipe) {
|
||||
NonNullBiConsumer<DataGenContext<Block, ?>, RegistrateRecipeProvider> mainBlockRecipe, String generalDirectory) {
|
||||
this.name = name;
|
||||
this.generalDirectory = generalDirectory;
|
||||
this.endTextureName = endTextureName;
|
||||
this.variants = variants;
|
||||
this.mainBlockRecipe = mainBlockRecipe;
|
||||
|
@ -129,7 +139,7 @@ public class CopperBlockSet {
|
|||
.requires(Items.HONEYCOMB)
|
||||
.unlockedBy("has_unwaxed", RegistrateRecipeProvider.has(unwaxed))
|
||||
.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();
|
||||
String path = block.getRegistryName()
|
||||
.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 endTexture = prov.modLoc(baseLoc + blocks.getEndTextureName());
|
||||
prov.simpleBlock(block, prov.models()
|
||||
|
@ -262,7 +272,7 @@ public class CopperBlockSet {
|
|||
ResourceLocation fullModel =
|
||||
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 endTexture = prov.modLoc(baseLoc + blocks.getEndTextureName());
|
||||
|
||||
|
@ -317,7 +327,7 @@ public class CopperBlockSet {
|
|||
@Override
|
||||
public void generateBlockState(DataGenContext<Block, StairBlock> ctx, RegistrateBlockstateProvider prov,
|
||||
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 endTexture = prov.modLoc(baseLoc + blocks.getEndTextureName());
|
||||
prov.stairsBlock(ctx.get(), texture, endTexture, endTexture);
|
||||
|
|
Loading…
Reference in a new issue