-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Backported custom catalysts and jei compat from the 1.14 and 1.15 versions
- Loading branch information
Showing
15 changed files
with
454 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,4 @@ | ||
org.gradle.jvmargs=-Xmx3G | ||
org.gradle.jvmargs=-Xmx3G | ||
|
||
mc_version=1.12.2 | ||
jei_version=4.15.0.293 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
80 changes: 80 additions & 0 deletions
80
src/main/java/network/pxl8/stonecatalysts/compat/jei/CobblestoneCatalystCategory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
package network.pxl8.stonecatalysts.compat.jei; | ||
|
||
import com.google.common.collect.Lists; | ||
import mezz.jei.api.IGuiHelper; | ||
import mezz.jei.api.gui.IDrawable; | ||
import mezz.jei.api.gui.IGuiFluidStackGroup; | ||
import mezz.jei.api.gui.IGuiItemStackGroup; | ||
import mezz.jei.api.gui.IRecipeLayout; | ||
import mezz.jei.api.ingredients.IIngredients; | ||
import mezz.jei.api.recipe.IRecipeCategory; | ||
import net.minecraft.client.resources.I18n; | ||
import net.minecraft.util.ResourceLocation; | ||
import net.minecraftforge.fluids.FluidRegistry; | ||
import net.minecraftforge.fluids.FluidStack; | ||
import network.pxl8.stonecatalysts.lib.LibMeta; | ||
|
||
import java.util.Collections; | ||
import java.util.List; | ||
|
||
public class CobblestoneCatalystCategory implements IRecipeCategory<StoneCatalystRecipe> { | ||
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 String getUid() { | ||
return StoneCatalystsJEIPlugin.COBBLESTONE_CATALYSTS.toString(); | ||
} | ||
|
||
@Override | ||
public String getModName() { | ||
return "StoneCatalysts"; | ||
} | ||
|
||
@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<String> getTooltipStrings(int mouseX, int 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 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(FluidRegistry.LAVA, 1000)); | ||
fluid_group.init(1, false, 37,37); | ||
fluid_group.set(1, new FluidStack(FluidRegistry.WATER, 1000)); | ||
} | ||
} |
80 changes: 80 additions & 0 deletions
80
src/main/java/network/pxl8/stonecatalysts/compat/jei/StoneCatalystCategory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
package network.pxl8.stonecatalysts.compat.jei; | ||
|
||
import com.google.common.collect.Lists; | ||
import mezz.jei.api.IGuiHelper; | ||
import mezz.jei.api.gui.IDrawable; | ||
import mezz.jei.api.gui.IGuiFluidStackGroup; | ||
import mezz.jei.api.gui.IGuiItemStackGroup; | ||
import mezz.jei.api.gui.IRecipeLayout; | ||
import mezz.jei.api.ingredients.IIngredients; | ||
import mezz.jei.api.recipe.IRecipeCategory; | ||
import net.minecraft.client.resources.I18n; | ||
import net.minecraft.util.ResourceLocation; | ||
import net.minecraftforge.fluids.FluidRegistry; | ||
import net.minecraftforge.fluids.FluidStack; | ||
import network.pxl8.stonecatalysts.lib.LibMeta; | ||
|
||
import java.util.Collections; | ||
import java.util.List; | ||
|
||
public class StoneCatalystCategory implements IRecipeCategory<StoneCatalystRecipe> { | ||
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 String getUid() { | ||
return StoneCatalystsJEIPlugin.STONE_CATALYSTS.toString(); | ||
} | ||
|
||
@Override | ||
public String getModName() { | ||
return "StoneCatalysts"; | ||
} | ||
|
||
@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<String> getTooltipStrings(int mouseX, int 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 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(FluidRegistry.LAVA, 1000)); | ||
fluid_group.init(1, false, 19,37); | ||
fluid_group.set(1, new FluidStack(FluidRegistry.WATER, 1000)); | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
src/main/java/network/pxl8/stonecatalysts/compat/jei/StoneCatalystRecipe.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package network.pxl8.stonecatalysts.compat.jei; | ||
|
||
import mezz.jei.api.ingredients.IIngredients; | ||
import mezz.jei.api.ingredients.VanillaTypes; | ||
import mezz.jei.api.recipe.IRecipeWrapper; | ||
import net.minecraft.item.ItemStack; | ||
import net.minecraft.util.ResourceLocation; | ||
|
||
public class StoneCatalystRecipe implements IRecipeWrapper { | ||
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; | ||
} | ||
|
||
@Override | ||
public void getIngredients(IIngredients ingredients) { | ||
ingredients.setInput(VanillaTypes.ITEM, this.catalyst_in); | ||
ingredients.setOutput(VanillaTypes.ITEM, this.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; | ||
} | ||
} |
46 changes: 46 additions & 0 deletions
46
src/main/java/network/pxl8/stonecatalysts/compat/jei/StoneCatalystsJEIPlugin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package network.pxl8.stonecatalysts.compat.jei; | ||
|
||
import mezz.jei.api.IGuiHelper; | ||
import mezz.jei.api.IModPlugin; | ||
import mezz.jei.api.IModRegistry; | ||
import mezz.jei.api.JEIPlugin; | ||
import mezz.jei.api.ingredients.VanillaTypes; | ||
import mezz.jei.api.recipe.IRecipeCategoryRegistration; | ||
import net.minecraft.client.resources.I18n; | ||
import net.minecraft.init.Items; | ||
import net.minecraft.item.ItemStack; | ||
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<ResourceLocation, StoneCatalystRecipe> STONE_CATALYST_RECIPES = new HashMap<>(); | ||
public static final Map<ResourceLocation, StoneCatalystRecipe> COBBLESTONE_CATALYST_RECIPES = new HashMap<>(); | ||
|
||
@Override | ||
public void register(IModRegistry registry) { | ||
registry.addRecipes(STONE_CATALYST_RECIPES.values(), STONE_CATALYSTS.toString()); | ||
registry.addRecipes(COBBLESTONE_CATALYST_RECIPES.values(), COBBLESTONE_CATALYSTS.toString()); | ||
|
||
registry.addIngredientInfo(new ItemStack(Items.LAVA_BUCKET), VanillaTypes.ITEM, I18n.format("jei.stonecatalysts:information_tab_desc")); | ||
|
||
registry.addRecipeCatalyst(new ItemStack(Items.LAVA_BUCKET), STONE_CATALYSTS.toString()); | ||
registry.addRecipeCatalyst(new ItemStack(Items.WATER_BUCKET), STONE_CATALYSTS.toString()); | ||
registry.addRecipeCatalyst(new ItemStack(Items.LAVA_BUCKET), COBBLESTONE_CATALYSTS.toString()); | ||
registry.addRecipeCatalyst(new ItemStack(Items.WATER_BUCKET), COBBLESTONE_CATALYSTS.toString()); | ||
} | ||
|
||
@Override | ||
public void registerCategories(IRecipeCategoryRegistration registry) { | ||
IGuiHelper guiHelper = registry.getJeiHelpers().getGuiHelper(); | ||
registry.addRecipeCategories( | ||
new StoneCatalystCategory(guiHelper), | ||
new CobblestoneCatalystCategory(guiHelper) | ||
); | ||
} | ||
} |
42 changes: 37 additions & 5 deletions
42
src/main/java/network/pxl8/stonecatalysts/config/Conf.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.