diff --git a/build.gradle b/build.gradle index 7c5d7a2..f987373 100644 --- a/build.gradle +++ b/build.gradle @@ -13,7 +13,7 @@ apply plugin: 'net.minecraftforge.gradle' apply plugin: 'eclipse' apply plugin: 'maven-publish' -version = "1.14.4-1.1.0" +version = "1.14.4-1.2.0" group = "network.pxl8.stonecatalysts" archivesBaseName = "stonecatalysts" @@ -72,12 +72,20 @@ repositories { name = "CurseForge" url = "https://minecraft.curseforge.com/api/maven/" } + maven { + name = "Progwml6 maven" + url = "https://dvs1.progwml6.com/files/maven/" + } } dependencies { minecraft 'net.minecraftforge:forge:1.14.4-28.2.0' - compileOnly "quark:Quark:r2.0:210" + compileOnly fg.deobf("quark:Quark:r2.0:210") + runtimeOnly fg.deobf("quark:Quark:r2.0:210") + runtimeOnly fg.deobf("autoreglib:AutoRegLib:1.4:35") + compileOnly fg.deobf("mezz.jei:jei-${minecraft_version}:${jei_version}") + runtimeOnly fg.deobf("mezz.jei:jei-${minecraft_version}:${jei_version}") } jar { diff --git a/gradle.properties b/gradle.properties index 878bf1f..459afd1 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,7 @@ # Sets default memory used for gradle commands. Can be overridden by user or command line properties. # This is required to provide enough memory for the Minecraft decompilation process. org.gradle.jvmargs=-Xmx3G -org.gradle.daemon=false \ No newline at end of file +org.gradle.daemon=false + +minecraft_version=1.14.4 +jei_version=6.0.0.27 \ No newline at end of file diff --git a/src/main/java/network/pxl8/stonecatalysts/StoneCatalysts.java b/src/main/java/network/pxl8/stonecatalysts/StoneCatalysts.java index a40974a..e4a5f2c 100644 --- a/src/main/java/network/pxl8/stonecatalysts/StoneCatalysts.java +++ b/src/main/java/network/pxl8/stonecatalysts/StoneCatalysts.java @@ -1,6 +1,7 @@ package network.pxl8.stonecatalysts; import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.fml.ModList; import net.minecraftforge.fml.ModLoadingContext; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.config.ModConfig; @@ -27,5 +28,6 @@ private void setup(FMLCommonSetupEvent event) { } private void serverStart(FMLServerStartingEvent event) { StoneGen.getCustomCatalysts(); + if(ModList.get().isLoaded("jei")) { StoneGen.registerJEIRecipes(); } } } diff --git a/src/main/java/network/pxl8/stonecatalysts/compat/jei/CobblestoneCatalystCategory.java b/src/main/java/network/pxl8/stonecatalysts/compat/jei/CobblestoneCatalystCategory.java new file mode 100644 index 0000000..67e3c87 --- /dev/null +++ b/src/main/java/network/pxl8/stonecatalysts/compat/jei/CobblestoneCatalystCategory.java @@ -0,0 +1,87 @@ +package network.pxl8.stonecatalysts.compat.jei; + +import com.google.common.collect.Lists; +import mezz.jei.api.constants.VanillaTypes; +import mezz.jei.api.gui.IRecipeLayout; +import mezz.jei.api.gui.drawable.IDrawable; +import mezz.jei.api.gui.ingredient.IGuiFluidStackGroup; +import mezz.jei.api.gui.ingredient.IGuiItemStackGroup; +import mezz.jei.api.helpers.IGuiHelper; +import mezz.jei.api.ingredients.IIngredients; +import mezz.jei.api.recipe.category.IRecipeCategory; +import net.minecraft.client.resources.I18n; +import net.minecraft.fluid.Fluids; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.fluids.FluidStack; +import network.pxl8.stonecatalysts.lib.LibMeta; + +import java.util.Collections; +import java.util.List; + +public class CobblestoneCatalystCategory implements IRecipeCategory { + private final IDrawable background; + + public CobblestoneCatalystCategory(IGuiHelper guiHelper) { + this.background = guiHelper.createDrawable(new ResourceLocation(LibMeta.MOD_ID, "textures/gui/jei/cobblestone_gen.png"), 0, 0, 117, 74); + } + + @Override + public ResourceLocation getUid() { + return StoneCatalystsJEIPlugin.COBBLESTONE_CATALYSTS; + } + + @Override + public Class getRecipeClass() { + return StoneCatalystRecipe.class; + } + + @Override + public String getTitle() { + return I18n.format("jei." + StoneCatalystsJEIPlugin.COBBLESTONE_CATALYSTS); + } + + @Override + public IDrawable getBackground() { + return this.background; + } + + @Override + public IDrawable getIcon() { + return null; + } + + @Override + public List getTooltipStrings(StoneCatalystRecipe recipe, double mouseX, double mouseY) { + String output_tooltip = I18n.format("jei.stonecatalysts:tooltip_cobblestone_catalyst"); + String arrow_tooltip = I18n.format("jei.stonecatalysts:tooltip_flowing_lava"); + if (mouseX > 58 && mouseX < 81 && mouseY > 36 && mouseY < 52) { + return Lists.newArrayList(output_tooltip.split(",")); + } + if (mouseX > 18 && mouseX < 35 && mouseY > 36 && mouseY < 53) { + return Lists.newArrayList(arrow_tooltip.split(",")); + } + return Collections.emptyList(); + } + + @Override + public void setIngredients(StoneCatalystRecipe catalystRecipe, IIngredients ingredients) { + ingredients.setInput(VanillaTypes.ITEM, catalystRecipe.catalyst_in); + ingredients.setOutput(VanillaTypes.ITEM, catalystRecipe.catalyst_out); + } + + @Override + public void setRecipe(IRecipeLayout layout, StoneCatalystRecipe recipe, IIngredients ingredients) { + IGuiItemStackGroup group = layout.getItemStacks(); + IGuiFluidStackGroup fluid_group = layout.getFluidStacks(); + //Catalyst input and output + group.init(0, false, 18, 55); + group.set(0, recipe.catalyst_in); + group.init(1, false, 94, 36); + group.set(1, recipe.catalyst_out); + //Lava and Water + fluid_group.init(0, false, 1, 37); + fluid_group.set(0, new FluidStack(Fluids.LAVA, 1000)); + fluid_group.init(1, false, 37,37); + fluid_group.set(1, new FluidStack(Fluids.WATER, 1000)); + } +} \ No newline at end of file diff --git a/src/main/java/network/pxl8/stonecatalysts/compat/jei/StoneCatalystCategory.java b/src/main/java/network/pxl8/stonecatalysts/compat/jei/StoneCatalystCategory.java new file mode 100644 index 0000000..689132e --- /dev/null +++ b/src/main/java/network/pxl8/stonecatalysts/compat/jei/StoneCatalystCategory.java @@ -0,0 +1,88 @@ +package network.pxl8.stonecatalysts.compat.jei; + +import com.google.common.collect.Lists; +import mezz.jei.api.constants.VanillaTypes; +import mezz.jei.api.gui.IRecipeLayout; +import mezz.jei.api.gui.drawable.IDrawable; +import mezz.jei.api.gui.ingredient.IGuiFluidStackGroup; +import mezz.jei.api.gui.ingredient.IGuiItemStackGroup; +import mezz.jei.api.helpers.IGuiHelper; +import mezz.jei.api.ingredients.IIngredients; +import mezz.jei.api.recipe.category.IRecipeCategory; +import net.minecraft.client.resources.I18n; +import net.minecraft.fluid.Fluids; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.fluids.FluidStack; +import network.pxl8.stonecatalysts.lib.LibMeta; + +import java.util.Collections; +import java.util.List; + + +public class StoneCatalystCategory implements IRecipeCategory { + private final IDrawable background; + + public StoneCatalystCategory(IGuiHelper guiHelper) { + this.background = guiHelper.createDrawable(new ResourceLocation(LibMeta.MOD_ID, "textures/gui/jei/stone_gen.png"), 0, 0, 117, 74); + } + + @Override + public ResourceLocation getUid() { + return StoneCatalystsJEIPlugin.STONE_CATALYSTS; + } + + @Override + public Class getRecipeClass() { + return StoneCatalystRecipe.class; + } + + @Override + public String getTitle() { + return I18n.format("jei." + StoneCatalystsJEIPlugin.STONE_CATALYSTS); + } + + @Override + public IDrawable getBackground() { + return this.background; + } + + @Override + public IDrawable getIcon() { + return null; + } + + @Override + public List getTooltipStrings(StoneCatalystRecipe recipe, double mouseX, double mouseY) { + String output_tooltip = I18n.format("jei.stonecatalysts:tooltip_stone_catalyst"); + String arrow_tooltip = I18n.format("jei.stonecatalysts:tooltip_flowing_lava"); + if (mouseX > 58 && mouseX < 81 && mouseY > 36 && mouseY < 52) { + return Lists.newArrayList(output_tooltip.split(",")); + } + if (mouseX > 18 && mouseX < 35 && mouseY > 18 && mouseY < 35) { + return Lists.newArrayList(arrow_tooltip.split(",")); + } + return Collections.emptyList(); + } + + @Override + public void setIngredients(StoneCatalystRecipe catalystRecipe, IIngredients ingredients) { + ingredients.setInput(VanillaTypes.ITEM, catalystRecipe.catalyst_in); + ingredients.setOutput(VanillaTypes.ITEM, catalystRecipe.catalyst_out); + } + + @Override + public void setRecipe(IRecipeLayout layout, StoneCatalystRecipe recipe, IIngredients ingredients) { + IGuiItemStackGroup group = layout.getItemStacks(); + IGuiFluidStackGroup fluid_group = layout.getFluidStacks(); + //Catalyst input and output + group.init(0, false, 18, 55); + group.set(0, recipe.catalyst_in); + group.init(1, false, 94, 36); + group.set(1, recipe.catalyst_out); + //Lava and Water + fluid_group.init(0, false, 19, 1); + fluid_group.set(0, new FluidStack(Fluids.LAVA, 1000)); + fluid_group.init(1, false, 19,37); + fluid_group.set(1, new FluidStack(Fluids.WATER, 1000)); + } +} diff --git a/src/main/java/network/pxl8/stonecatalysts/compat/jei/StoneCatalystRecipe.java b/src/main/java/network/pxl8/stonecatalysts/compat/jei/StoneCatalystRecipe.java new file mode 100644 index 0000000..71c4a30 --- /dev/null +++ b/src/main/java/network/pxl8/stonecatalysts/compat/jei/StoneCatalystRecipe.java @@ -0,0 +1,30 @@ +package network.pxl8.stonecatalysts.compat.jei; + +import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; + +public class StoneCatalystRecipe { + public final ResourceLocation name; + public final ItemStack catalyst_in; + public final ItemStack catalyst_out; + + public StoneCatalystRecipe(ResourceLocation name, ItemStack catalyst) { + this(name, catalyst, catalyst); + } + + public StoneCatalystRecipe(ResourceLocation name, ItemStack catalyst_in, ItemStack catalyst_out) { + this.name = name; + this.catalyst_in = catalyst_in; + this.catalyst_out = catalyst_out; + } + + public StoneCatalystRecipe registerStone() { + StoneCatalystsJEIPlugin.STONE_CATALYST_RECIPES.put(this.name, this); + return this; + } + + public StoneCatalystRecipe registerCobblestone() { + StoneCatalystsJEIPlugin.COBBLESTONE_CATALYST_RECIPES.put(this.name, this); + return this; + } +} diff --git a/src/main/java/network/pxl8/stonecatalysts/compat/jei/StoneCatalystsJEIPlugin.java b/src/main/java/network/pxl8/stonecatalysts/compat/jei/StoneCatalystsJEIPlugin.java new file mode 100644 index 0000000..dd7a5fc --- /dev/null +++ b/src/main/java/network/pxl8/stonecatalysts/compat/jei/StoneCatalystsJEIPlugin.java @@ -0,0 +1,55 @@ +package network.pxl8.stonecatalysts.compat.jei; + +import mezz.jei.api.IModPlugin; +import mezz.jei.api.JeiPlugin; +import mezz.jei.api.constants.VanillaTypes; +import mezz.jei.api.helpers.IGuiHelper; +import mezz.jei.api.registration.IRecipeCatalystRegistration; +import mezz.jei.api.registration.IRecipeCategoryRegistration; +import mezz.jei.api.registration.IRecipeRegistration; +import net.minecraft.client.resources.I18n; +import net.minecraft.item.ItemStack; +import net.minecraft.item.Items; +import net.minecraft.util.ResourceLocation; +import network.pxl8.stonecatalysts.lib.LibMeta; + +import java.util.HashMap; +import java.util.Map; + +@JeiPlugin +public class StoneCatalystsJEIPlugin implements IModPlugin { + public static final ResourceLocation STONE_CATALYSTS = new ResourceLocation(LibMeta.MOD_ID, "category_stone_gen"); + public static final ResourceLocation COBBLESTONE_CATALYSTS = new ResourceLocation(LibMeta.MOD_ID, "category_cobblestone_gen"); + public static final Map STONE_CATALYST_RECIPES = new HashMap<>(); + public static final Map COBBLESTONE_CATALYST_RECIPES = new HashMap<>(); + + @Override + public ResourceLocation getPluginUid() { + return new ResourceLocation(LibMeta.MOD_ID, "jei_plugin"); + } + + @Override + public void registerCategories(IRecipeCategoryRegistration registration) { + IGuiHelper guiHelper = registration.getJeiHelpers().getGuiHelper(); + registration.addRecipeCategories( + new StoneCatalystCategory(guiHelper), + new CobblestoneCatalystCategory(guiHelper) + ); + } + + @Override + public void registerRecipes(IRecipeRegistration registration) { + registration.addRecipes(STONE_CATALYST_RECIPES.values(), STONE_CATALYSTS); + registration.addRecipes(COBBLESTONE_CATALYST_RECIPES.values(), COBBLESTONE_CATALYSTS); + + registration.addIngredientInfo(new ItemStack(Items.LAVA_BUCKET), VanillaTypes.ITEM, I18n.format("jei.stonecatalysts:information_tab_desc")); + } + + @Override + public void registerRecipeCatalysts(IRecipeCatalystRegistration registration) { + registration.addRecipeCatalyst(new ItemStack(Items.LAVA_BUCKET), STONE_CATALYSTS); + registration.addRecipeCatalyst(new ItemStack(Items.WATER_BUCKET), STONE_CATALYSTS); + registration.addRecipeCatalyst(new ItemStack(Items.LAVA_BUCKET), COBBLESTONE_CATALYSTS); + registration.addRecipeCatalyst(new ItemStack(Items.WATER_BUCKET), COBBLESTONE_CATALYSTS); + } +} diff --git a/src/main/java/network/pxl8/stonecatalysts/config/Configuration.java b/src/main/java/network/pxl8/stonecatalysts/config/Configuration.java index 399356b..415c11c 100644 --- a/src/main/java/network/pxl8/stonecatalysts/config/Configuration.java +++ b/src/main/java/network/pxl8/stonecatalysts/config/Configuration.java @@ -15,12 +15,15 @@ public class Configuration { private static final ForgeConfigSpec.Builder COMMON_BUILDER = new ForgeConfigSpec.Builder(); public static ForgeConfigSpec COMMON_CONFIG; - public static ForgeConfigSpec.BooleanValue REPLACE_STONE; - public static ForgeConfigSpec.BooleanValue REPLACE_COBBLE; + public static ForgeConfigSpec.BooleanValue VANILLA_VARIANTS_AS_STONE; + public static ForgeConfigSpec.BooleanValue VANILLA_VARIANTS_AS_COBBLE; public static ForgeConfigSpec.BooleanValue ENABLE_QUARK_COMPAT; + public static ForgeConfigSpec.BooleanValue QUARK_VARIANTS_AS_STONE; + public static ForgeConfigSpec.BooleanValue QUARK_VARIANTS_AS_COBBLE; - public static ForgeConfigSpec.ConfigValue> CUSTOM_CATALYSTS; + public static ForgeConfigSpec.ConfigValue> CUSTOM_STONE_CATALYSTS; + public static ForgeConfigSpec.ConfigValue> CUSTOM_COBBLE_CATALYSTS; public static ForgeConfigSpec.BooleanValue DEBUG_MESSAGES; static { @@ -34,24 +37,30 @@ public class Configuration { } private static void setupBaseConfig() { - REPLACE_STONE = COMMON_BUILDER.comment("Replace stone generation (Lava over Water) with the corresponding catalyst") - .define("REPLACE_STONE", true); - REPLACE_COBBLE = COMMON_BUILDER.comment("Replace cobble generation (Water into Flowing Lava) with the corresponding catalyst") - .define("REPLACE_COBBLE", true); + VANILLA_VARIANTS_AS_STONE = COMMON_BUILDER.comment("Allow vanilla stone variants as stone generator catalysts (Flowing Lava into Water Source)") + .define("VANILLA_VARIANTS_AS_STONE", true); + VANILLA_VARIANTS_AS_COBBLE = COMMON_BUILDER.comment("Allow vanilla stone variants as cobble generator catalysts (Water into Flowing Lava)") + .define("VANILLA_VARIANTS_AS_COBBLE", true); COMMON_BUILDER.pop(); } private static void setupCompatConfig() { ENABLE_QUARK_COMPAT = COMMON_BUILDER.comment("Adds quark stones (Basalt, Marble, Limestone, Slate, Jasper) as catalysts") .define("ENABLE_QUARK_COMPAT", true); + QUARK_VARIANTS_AS_STONE = COMMON_BUILDER.comment("Allow quark stone variants as stone generator catalysts (Flowing Lava into Water Source)") + .define("QUARK_VARIANTS_AS_STONE", true); + QUARK_VARIANTS_AS_COBBLE = COMMON_BUILDER.comment("Allow quark stone variants as cobble generator catalysts (Water into Flowing Lava)") + .define("QUARK_VARIANTS_AS_COBBLE", true); COMMON_BUILDER.pop(); } private static void setupCustomConfig() { List catalysts = new ArrayList<>(); + CUSTOM_STONE_CATALYSTS = COMMON_BUILDER.comment("Add additional stone generator catalysts", "Usage: Add namespaced ids in \"\" seperated by commas", "Example: [\"minecraft:netherrack\", \"quark:brimstone\"]") + .define("CUSTOM_STONE_CATALYSTS", catalysts); + CUSTOM_COBBLE_CATALYSTS = COMMON_BUILDER.comment("Add additional cobble generator catalysts", "Usage: Add namespaced ids in \"\" seperated by commas", "Example: [\"minecraft:netherrack\", \"quark:brimstone\"]") + .define("CUSTOM_COBBLE_CATALYSTS", catalysts); - CUSTOM_CATALYSTS = COMMON_BUILDER.comment("Add additional catalysts", "Usage: Add namespaced ids in \"\" seperated by commas", "Example: [\"minecraft:netherrack\", \"quark:brimstone\"]") - .define("CUSTOM_CATALYSTS", catalysts); DEBUG_MESSAGES = COMMON_BUILDER.comment("Prints debug messages to the log for each custom catalyst added") .define("DEBUG_MESSAGES", true); COMMON_BUILDER.pop(); diff --git a/src/main/java/network/pxl8/stonecatalysts/event/StoneGen.java b/src/main/java/network/pxl8/stonecatalysts/event/StoneGen.java index 1ae4547..43b41be 100644 --- a/src/main/java/network/pxl8/stonecatalysts/event/StoneGen.java +++ b/src/main/java/network/pxl8/stonecatalysts/event/StoneGen.java @@ -4,13 +4,16 @@ import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; +import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.BlockPos; +import net.minecraft.util.text.StringTextComponent; import net.minecraftforge.event.world.BlockEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.ModList; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.registries.ForgeRegistries; +import network.pxl8.stonecatalysts.compat.jei.StoneCatalystRecipe; import network.pxl8.stonecatalysts.config.Configuration; import network.pxl8.stonecatalysts.lib.LibMeta; @@ -28,14 +31,14 @@ public static void genStone(BlockEvent.FluidPlaceBlockEvent event) { Block oldBlock = event.getOriginalState().getBlock(); Block newBlock = event.getNewState().getBlock(); - if (Configuration.REPLACE_STONE.get() && oldBlock.equals(Blocks.WATER) && newBlock.equals(Blocks.STONE)) { + if (oldBlock.equals(Blocks.WATER) && newBlock.equals(Blocks.STONE)) { BlockState catalyst = event.getWorld().getBlockState(new BlockPos(x, y - 1, z)); - doReplacements(event, catalyst); + doStoneReplacements(event, catalyst); } - if (Configuration.REPLACE_COBBLE.get() && oldBlock.equals(Blocks.LAVA) && newBlock.equals(Blocks.COBBLESTONE)) { + if (oldBlock.equals(Blocks.LAVA) && newBlock.equals(Blocks.COBBLESTONE)) { BlockState catalyst = event.getWorld().getBlockState(new BlockPos(x, y - 1, z)); - doReplacements(event, catalyst); + doCobblestoneReplacements(event, catalyst); } } @@ -43,39 +46,107 @@ private static void replaceBlock(BlockEvent.FluidPlaceBlockEvent event, BlockSta if (catalyst.equals(replace)) { event.setNewState(replace); } } - private static void doReplacements(BlockEvent.FluidPlaceBlockEvent event, BlockState catalyst) { - replaceBlock(event, catalyst, Blocks.GRANITE.getDefaultState()); - replaceBlock(event, catalyst, Blocks.DIORITE.getDefaultState()); - replaceBlock(event, catalyst, Blocks.ANDESITE.getDefaultState()); - - if(ModList.get().isLoaded("quark") && Configuration.ENABLE_QUARK_COMPAT.get()) { - replaceBlock(event, catalyst, NewStoneTypesModule.marbleBlock.getDefaultState()); - replaceBlock(event, catalyst, NewStoneTypesModule.limestoneBlock.getDefaultState()); - replaceBlock(event, catalyst, NewStoneTypesModule.jasperBlock.getDefaultState()); - replaceBlock(event, catalyst, NewStoneTypesModule.slateBlock.getDefaultState()); - replaceBlock(event, catalyst, NewStoneTypesModule.basaltBlock.getDefaultState()); + private static void doStoneReplacements(BlockEvent.FluidPlaceBlockEvent event, BlockState catalyst) { + if (Configuration.VANILLA_VARIANTS_AS_STONE.get()) { + replaceBlock(event, catalyst, Blocks.GRANITE.getDefaultState()); + replaceBlock(event, catalyst, Blocks.DIORITE.getDefaultState()); + replaceBlock(event, catalyst, Blocks.ANDESITE.getDefaultState()); } - if(!StoneGen.customCatalysts.isEmpty()) { - for(BlockState block : StoneGen.customCatalysts) { - replaceBlock(event, catalyst, block); + if(!StoneGen.customStoneCatalysts.isEmpty()) { + for(Block block : StoneGen.customStoneCatalysts) { + replaceBlock(event, catalyst, block.getDefaultState()); } } } - private static List customCatalysts = new ArrayList<>(); + private static void doCobblestoneReplacements(BlockEvent.FluidPlaceBlockEvent event, BlockState catalyst) { + if (Configuration.VANILLA_VARIANTS_AS_COBBLE.get()) { + replaceBlock(event, catalyst, Blocks.GRANITE.getDefaultState()); + replaceBlock(event, catalyst, Blocks.DIORITE.getDefaultState()); + replaceBlock(event, catalyst, Blocks.ANDESITE.getDefaultState()); + } + + if(!StoneGen.customCobbleCatalysts.isEmpty()) { + for(Block block : StoneGen.customCobbleCatalysts) { + replaceBlock(event, catalyst, block.getDefaultState()); + } + } + } + + private static List customStoneCatalysts = new ArrayList<>(); + private static List customCobbleCatalysts = new ArrayList<>(); public static void getCustomCatalysts() { - if(!Configuration.CUSTOM_CATALYSTS.get().isEmpty()) { - for(String catalyst : Configuration.CUSTOM_CATALYSTS.get()) { + if(!Configuration.CUSTOM_STONE_CATALYSTS.get().isEmpty()) { + for(String catalyst : Configuration.CUSTOM_STONE_CATALYSTS.get()) { Block block = ForgeRegistries.BLOCKS.getValue(new ResourceLocation(catalyst)); if(!block.equals(Blocks.AIR)) { - customCatalysts.add(block.getDefaultState()); - if(Configuration.DEBUG_MESSAGES.get()) { LibMeta.LOG.debug("Added custom catalyst: " + block); } + customStoneCatalysts.add(block); + if(Configuration.DEBUG_MESSAGES.get()) { LibMeta.LOG.debug("Added custom stone catalyst: " + block); } } else { LibMeta.LOG.warn("Could not find catalyst from namespaced id: " + catalyst); } } } + if(!Configuration.CUSTOM_COBBLE_CATALYSTS.get().isEmpty()) { + for(String catalyst : Configuration.CUSTOM_COBBLE_CATALYSTS.get()) { + Block block = ForgeRegistries.BLOCKS.getValue(new ResourceLocation(catalyst)); + if(!block.equals(Blocks.AIR)) { + customCobbleCatalysts.add(block); + if(Configuration.DEBUG_MESSAGES.get()) { LibMeta.LOG.debug("Added custom cobble catalyst: " + block); } + } else { + LibMeta.LOG.warn("Could not find catalyst from namespaced id: " + catalyst); + } + } + } + + if(ModList.get().isLoaded("quark") && Configuration.ENABLE_QUARK_COMPAT.get() && Configuration.QUARK_VARIANTS_AS_STONE.get()) { + customStoneCatalysts.add(NewStoneTypesModule.marbleBlock); + customStoneCatalysts.add(NewStoneTypesModule.limestoneBlock); + customStoneCatalysts.add(NewStoneTypesModule.jasperBlock); + customStoneCatalysts.add(NewStoneTypesModule.slateBlock); + customStoneCatalysts.add(NewStoneTypesModule.basaltBlock); + } + + if(ModList.get().isLoaded("quark") && Configuration.ENABLE_QUARK_COMPAT.get() && Configuration.QUARK_VARIANTS_AS_COBBLE.get()) { + customCobbleCatalysts.add(NewStoneTypesModule.marbleBlock); + customCobbleCatalysts.add(NewStoneTypesModule.limestoneBlock); + customCobbleCatalysts.add(NewStoneTypesModule.jasperBlock); + customCobbleCatalysts.add(NewStoneTypesModule.slateBlock); + customCobbleCatalysts.add(NewStoneTypesModule.basaltBlock); + } + } + + public static void registerJEIRecipes() { + ItemStack noCatalyst = new ItemStack(Blocks.BARRIER).setDisplayName(new StringTextComponent("No Catalyst")); + new StoneCatalystRecipe(new ResourceLocation(LibMeta.MOD_ID, "default_stonegen"), noCatalyst, new ItemStack(Blocks.STONE)).registerStone(); + new StoneCatalystRecipe(new ResourceLocation(LibMeta.MOD_ID, "default_cobblegen"), noCatalyst, new ItemStack(Blocks.COBBLESTONE)).registerCobblestone(); + + if (Configuration.VANILLA_VARIANTS_AS_STONE.get()) { + new StoneCatalystRecipe(new ResourceLocation(LibMeta.MOD_ID, "granite_stonegen"), new ItemStack(Blocks.GRANITE)).registerStone(); + new StoneCatalystRecipe(new ResourceLocation(LibMeta.MOD_ID, "diorite_stonegen"), new ItemStack(Blocks.DIORITE)).registerStone(); + new StoneCatalystRecipe(new ResourceLocation(LibMeta.MOD_ID, "andesite_stonegen"), new ItemStack(Blocks.ANDESITE)).registerStone(); + } + + if (Configuration.VANILLA_VARIANTS_AS_COBBLE.get()) { + new StoneCatalystRecipe(new ResourceLocation(LibMeta.MOD_ID, "granite_cobblegen"), new ItemStack(Blocks.GRANITE)).registerCobblestone(); + new StoneCatalystRecipe(new ResourceLocation(LibMeta.MOD_ID, "diorite_cobblegen"), new ItemStack(Blocks.DIORITE)).registerCobblestone(); + new StoneCatalystRecipe(new ResourceLocation(LibMeta.MOD_ID, "andesite_cobblegen"), new ItemStack(Blocks.ANDESITE)).registerCobblestone(); + } + + if(!StoneGen.customStoneCatalysts.isEmpty()) { + for(Block block : StoneGen.customStoneCatalysts) { + String resource_path = block.getRegistryName().getNamespace() + "_" + block.getRegistryName().getPath() + "_stonegen"; + new StoneCatalystRecipe(new ResourceLocation(LibMeta.MOD_ID, resource_path), new ItemStack(block)).registerStone(); + } + } + + if(!StoneGen.customCobbleCatalysts.isEmpty()) { + for(Block block : StoneGen.customCobbleCatalysts) { + String resource_path = block.getRegistryName().getNamespace() + "_" + block.getRegistryName().getPath() + "_cobblegen"; + new StoneCatalystRecipe(new ResourceLocation(LibMeta.MOD_ID, resource_path), new ItemStack(block)).registerCobblestone(); + } + } } } diff --git a/src/main/resources/assets/stonecatalysts/lang/en_us.json b/src/main/resources/assets/stonecatalysts/lang/en_us.json new file mode 100644 index 0000000..4f94eac --- /dev/null +++ b/src/main/resources/assets/stonecatalysts/lang/en_us.json @@ -0,0 +1,10 @@ +{ + "jei.stonecatalysts:category_stone_gen": "Stone Catalysts", + "jei.stonecatalysts:category_cobblestone_gen": "Cobblestone Catalysts", + + "jei.stonecatalysts:tooltip_flowing_lava": "Flowing Lava", + "jei.stonecatalysts:tooltip_stone_catalyst": "Stone Catalyst, ,Replaces water source when hit by flowing lava above, ,Place catalyst below water source", + "jei.stonecatalysts:tooltip_cobblestone_catalyst": "Cobblestone Catalyst, ,Replaces lava flow when it touches water, ,Place catalyst below lava flow", + + "jei.stonecatalysts:information_tab_desc": "StoneCatalysts allows you to generate different stone variants with a vanilla cobblegen\nSimply place the catalyst below where stone or cobblestone would normally generate and the block will instead generate at the catalyst" +} \ No newline at end of file diff --git a/src/main/resources/assets/stonecatalysts/textures/gui/jei/cobblestone_gen.png b/src/main/resources/assets/stonecatalysts/textures/gui/jei/cobblestone_gen.png new file mode 100644 index 0000000..9077fbb Binary files /dev/null and b/src/main/resources/assets/stonecatalysts/textures/gui/jei/cobblestone_gen.png differ diff --git a/src/main/resources/assets/stonecatalysts/textures/gui/jei/stone_gen.png b/src/main/resources/assets/stonecatalysts/textures/gui/jei/stone_gen.png new file mode 100644 index 0000000..6a267c1 Binary files /dev/null and b/src/main/resources/assets/stonecatalysts/textures/gui/jei/stone_gen.png differ