From 12ec3fbceb561ff28b0520142a7c5f9be3da6852 Mon Sep 17 00:00:00 2001 From: Brisingr Aerowing Date: Sat, 27 Oct 2018 23:33:18 -0400 Subject: [PATCH] Updated to 1.12.2 --- build.gradle | 38 +++++++++---------- gradle.properties | 6 +-- .../mystcraft_jei/ItemDescriptions.java | 3 +- .../heldplayer/mystcraft_jei/JEIPlugin.java | 2 +- .../mystcraft_jei/client/ClientProxy.java | 2 +- .../client/event/GuiEventHandler.java | 2 +- .../client/gui/DrawableTextField.java | 4 +- .../client/gui/PageRenderer.java | 9 +++-- .../crafting/BookBinderRecipeCategory.java | 4 +- .../crafting/BookBinderRecipes.java | 8 ++-- .../crafting/InkMixerRecipeCategory.java | 11 +++--- .../crafting/InkMixerRecipeWrapper.java | 7 ++-- .../crafting/InkMixerRecipes.java | 11 +++--- .../crafting/LinkingBookRecipeWrapper.java | 5 ++- .../crafting/WritingDeskRecipeCategory.java | 5 ++- .../crafting/WritingDeskRecipes.java | 24 +++++++----- .../mystcraft/MystItemFactory.java | 3 +- .../integration/mystcraft/MystPage.java | 3 +- .../integration/mystcraft/MystRender.java | 3 +- .../integration/mystcraft/MystSymbol.java | 3 +- .../subtypes/PageSubtypeInterpreter.java | 2 +- .../subtypes/UnlinkedLinkbookInterpreter.java | 2 +- .../mystcraft_jei/util/Integration.java | 2 +- 23 files changed, 88 insertions(+), 71 deletions(-) diff --git a/build.gradle b/build.gradle index 5ba8756..10a073c 100644 --- a/build.gradle +++ b/build.gradle @@ -4,7 +4,7 @@ buildscript { maven { url = "http://files.minecraftforge.net/maven" } } dependencies { - classpath 'net.minecraftforge.gradle:ForgeGradle:2.2-SNAPSHOT' + classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT' } } apply plugin: 'net.minecraftforge.gradle.forge' @@ -40,7 +40,7 @@ minecraft { // stable_# stables are built at the discretion of the MCP team. // Use non-default mappings at your own risk. they may not always work. // simply re-run your setup task after changing the mappings to update your workspace. - mappings = "snapshot_20161220" + mappings = "snapshot_20171003" // makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable. if (project.hasProperty("signature")) @@ -50,7 +50,7 @@ minecraft { dependencies { deobfProvided "mezz.jei:jei_${minecraft_version}:${jei_version}:api" runtime "mezz.jei:jei_${minecraft_version}:${jei_version}" - + compile files('libs/mystcraft.jar') // you may put jars on which you depend on in ./libs // or you may define them like so.. //compile "some.group:artifact:version:classifier" @@ -96,19 +96,19 @@ processResources { } // https://gist.github.com/matthewprenger/9b2da059b89433a01c1c -task signJar(type: SignJar, dependsOn: reobfJar) { - onlyIf { project.hasProperty('keyStore') } - - if (!project.hasProperty('keyStore')) { // This shouldn't be possible, but onlyIf isn't working properly :/ - throw new StopExecutionException() - } - - keyStore = project.keyStore // This needs to be a path to the keystore file - alias = project.keyStoreAlias - storePass = project.keyStorePass - keyPass = project.keyStoreKeyPass - inputFile = jar.archivePath - outputFile = jar.archivePath -} - -build.dependsOn signJar +//task signJar(type: SignJar, dependsOn: reobfJar) { +// onlyIf { project.hasProperty('keyStore') } + + //if (!project.hasProperty('keyStore')) { // This shouldn't be possible, but onlyIf isn't working properly :/ + //throw new StopExecutionException() + //} + + //keyStore = project.keyStore // This needs to be a path to the keystore file + // alias = project.keyStoreAlias + // storePass = project.keyStorePass + // keyPass = project.keyStoreKeyPass + // inputFile = jar.archivePath + // outputFile = jar.archivePath +//} + +//build.dependsOn signJar diff --git a/gradle.properties b/gradle.properties index a6ad02c..e897c4e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,6 @@ -minecraft_version=1.11.2 -forge_version=13.20.1.2386 -jei_version=4.5.0.294 +minecraft_version=1.12.2 +forge_version=14.23.5.2772 +jei_version=4.12.1.217 super_number=1 major_number=0 diff --git a/src/main/java/me/heldplayer/mystcraft_jei/ItemDescriptions.java b/src/main/java/me/heldplayer/mystcraft_jei/ItemDescriptions.java index 5683d31..f442dc8 100644 --- a/src/main/java/me/heldplayer/mystcraft_jei/ItemDescriptions.java +++ b/src/main/java/me/heldplayer/mystcraft_jei/ItemDescriptions.java @@ -3,6 +3,7 @@ import com.xcompwiz.mystcraft.api.MystObjects; import me.heldplayer.mystcraft_jei.util.Integration; import mezz.jei.api.IModRegistry; +import mezz.jei.api.ingredients.VanillaTypes; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import org.apache.commons.lang3.tuple.Pair; @@ -125,7 +126,7 @@ public static void setDescriptions(@Nonnull IModRegistry registry) { .map((stack) -> Pair.of(Integration.getMystItem(stack.getLeft()), stack.getRight())) .filter((stack) -> stack.getLeft() != null && stack.getLeft() != Items.AIR) .map((stack) -> new ItemStack(stack.getLeft(), 1, stack.getRight())) - .collect(Collectors.toList()), ItemStack.class, descriptions); + .collect(Collectors.toList()), VanillaTypes.ITEM, descriptions); // Link panels // Symbol pages diff --git a/src/main/java/me/heldplayer/mystcraft_jei/JEIPlugin.java b/src/main/java/me/heldplayer/mystcraft_jei/JEIPlugin.java index ae18c35..bee8ac8 100644 --- a/src/main/java/me/heldplayer/mystcraft_jei/JEIPlugin.java +++ b/src/main/java/me/heldplayer/mystcraft_jei/JEIPlugin.java @@ -24,7 +24,7 @@ @mezz.jei.api.JEIPlugin public class JEIPlugin extends BlankModPlugin { - private IIngredientRegistry ingredientRegistry; + public IIngredientRegistry ingredientRegistry; @Override public void registerItemSubtypes(@Nonnull ISubtypeRegistry registry) { diff --git a/src/main/java/me/heldplayer/mystcraft_jei/client/ClientProxy.java b/src/main/java/me/heldplayer/mystcraft_jei/client/ClientProxy.java index c3c718e..5bf46ed 100644 --- a/src/main/java/me/heldplayer/mystcraft_jei/client/ClientProxy.java +++ b/src/main/java/me/heldplayer/mystcraft_jei/client/ClientProxy.java @@ -28,7 +28,7 @@ public void registerEventHandlers() { @Override @Nonnull public IDrawableTextfield createTextField(int width, int height) { - return new DrawableTextField(FMLClientHandler.instance().getClient().fontRendererObj, width, height); + return new DrawableTextField(FMLClientHandler.instance().getClient().fontRenderer, width, height); } @Override diff --git a/src/main/java/me/heldplayer/mystcraft_jei/client/event/GuiEventHandler.java b/src/main/java/me/heldplayer/mystcraft_jei/client/event/GuiEventHandler.java index edbd97a..238f6ff 100644 --- a/src/main/java/me/heldplayer/mystcraft_jei/client/event/GuiEventHandler.java +++ b/src/main/java/me/heldplayer/mystcraft_jei/client/event/GuiEventHandler.java @@ -65,7 +65,7 @@ public static void addRecipesButton(@Nonnull GuiContainer screen, int posX, int try { List labelList = (List) LABEL_LIST.get(screen); labelList.removeIf(label -> label instanceof DrawableRecipesButton); - labelList.add(new DrawableRecipesButton(screen.mc.fontRendererObj, MystcraftJEI.proxy.getRecipeIcon(), -99, screen.getGuiLeft() + posX, screen.getGuiTop() + posY)); + labelList.add(new DrawableRecipesButton(screen.mc.fontRenderer, MystcraftJEI.proxy.getRecipeIcon(), -99, screen.getGuiLeft() + posX, screen.getGuiTop() + posY)); } catch (IllegalAccessException e) { e.printStackTrace(); } diff --git a/src/main/java/me/heldplayer/mystcraft_jei/client/gui/DrawableTextField.java b/src/main/java/me/heldplayer/mystcraft_jei/client/gui/DrawableTextField.java index ef071c5..c514b79 100644 --- a/src/main/java/me/heldplayer/mystcraft_jei/client/gui/DrawableTextField.java +++ b/src/main/java/me/heldplayer/mystcraft_jei/client/gui/DrawableTextField.java @@ -46,8 +46,8 @@ public void draw(@Nonnull Minecraft minecraft) { @Override public void draw(@Nonnull Minecraft minecraft, int xOffset, int yOffset) { - this.textField.xPosition = xOffset; - this.textField.yPosition = yOffset; + this.textField.x = xOffset; + this.textField.y = yOffset; this.textField.drawTextBox(); } } diff --git a/src/main/java/me/heldplayer/mystcraft_jei/client/gui/PageRenderer.java b/src/main/java/me/heldplayer/mystcraft_jei/client/gui/PageRenderer.java index 948b633..0151d8d 100644 --- a/src/main/java/me/heldplayer/mystcraft_jei/client/gui/PageRenderer.java +++ b/src/main/java/me/heldplayer/mystcraft_jei/client/gui/PageRenderer.java @@ -5,8 +5,9 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.Tessellator; -import net.minecraft.client.renderer.VertexBuffer; +import net.minecraft.client.renderer.BufferBuilder; import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import org.lwjgl.opengl.GL11; @@ -18,7 +19,7 @@ private PageRenderer() { } @SideOnly(Side.CLIENT) - public static void renderPage(@Nonnull Minecraft minecraft, @Nonnull String symbol, float posX, float posY, float zLevel, float width, float height) { + public static void renderPage(@Nonnull Minecraft minecraft, @Nonnull ResourceLocation symbol, float posX, float posY, float zLevel, float width, float height) { minecraft.getTextureManager().bindTexture(Assets.BOOK_PAGE_LEFT); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); drawTexturedModalRect(posX, posY, width, height, zLevel, 0.609375F, 0.0F, 0.7265625F, 0.15625F); @@ -51,7 +52,7 @@ private static void drawGradientRect(float left, float top, float right, float b GlStateManager.shadeModel(GL11.GL_SMOOTH); GL11.glShadeModel(GL11.GL_SMOOTH); Tessellator tessellator = Tessellator.getInstance(); - VertexBuffer vertexbuffer = tessellator.getBuffer(); + BufferBuilder vertexbuffer = tessellator.getBuffer(); vertexbuffer.begin(7, DefaultVertexFormats.POSITION_COLOR); vertexbuffer.pos(right, top, zLevel).color(startRed, startGreen, startBlue, startAlpha).endVertex(); vertexbuffer.pos(left, top, zLevel).color(startRed, startGreen, startBlue, startAlpha).endVertex(); @@ -67,7 +68,7 @@ private static void drawGradientRect(float left, float top, float right, float b @SideOnly(Side.CLIENT) private static void drawTexturedModalRect(float posX, float posY, float width, float height, float zLevel, float uStart, float vStart, float uEnd, float vEnd) { Tessellator tessellator = Tessellator.getInstance(); - VertexBuffer vertexbuffer = tessellator.getBuffer(); + BufferBuilder vertexbuffer = tessellator.getBuffer(); vertexbuffer.begin(7, DefaultVertexFormats.POSITION_TEX); vertexbuffer.pos(posX, posY + height, zLevel).tex(uStart, vEnd).endVertex(); vertexbuffer.pos(posX + width, posY + height, zLevel).tex(uEnd, vEnd).endVertex(); diff --git a/src/main/java/me/heldplayer/mystcraft_jei/crafting/BookBinderRecipeCategory.java b/src/main/java/me/heldplayer/mystcraft_jei/crafting/BookBinderRecipeCategory.java index 7161054..eec3e3a 100644 --- a/src/main/java/me/heldplayer/mystcraft_jei/crafting/BookBinderRecipeCategory.java +++ b/src/main/java/me/heldplayer/mystcraft_jei/crafting/BookBinderRecipeCategory.java @@ -8,12 +8,12 @@ import mezz.jei.api.gui.IGuiItemStackGroup; import mezz.jei.api.gui.IRecipeLayout; import mezz.jei.api.ingredients.IIngredients; -import mezz.jei.api.recipe.BlankRecipeCategory; +import mezz.jei.api.recipe.IRecipeCategory; import net.minecraft.util.ResourceLocation; import javax.annotation.Nonnull; -public class BookBinderRecipeCategory extends BlankRecipeCategory { +public class BookBinderRecipeCategory implements IRecipeCategory { public static final int SLOT_LEATHER = 0; public static final int SLOT_RESULT = 1; diff --git a/src/main/java/me/heldplayer/mystcraft_jei/crafting/BookBinderRecipes.java b/src/main/java/me/heldplayer/mystcraft_jei/crafting/BookBinderRecipes.java index ac64c8d..7779223 100644 --- a/src/main/java/me/heldplayer/mystcraft_jei/crafting/BookBinderRecipes.java +++ b/src/main/java/me/heldplayer/mystcraft_jei/crafting/BookBinderRecipes.java @@ -6,7 +6,9 @@ import me.heldplayer.mystcraft_jei.util.Integration; import mezz.jei.api.gui.IDrawable; import mezz.jei.api.ingredients.IIngredients; +import mezz.jei.api.ingredients.VanillaTypes; import mezz.jei.api.recipe.BlankRecipeWrapper; +import mezz.jei.api.recipe.IRecipeWrapper; import net.minecraft.client.Minecraft; import net.minecraft.init.Items; import net.minecraft.item.Item; @@ -27,7 +29,7 @@ public static Collection getRecipes() { return Collections.singletonList(new AgeWrite()); } - public abstract static class AwareRecipeWrapper extends BlankRecipeWrapper { + public abstract static class AwareRecipeWrapper implements IRecipeWrapper { protected IDrawableTextfield textField; public void setTextField(IDrawableTextfield textField) { @@ -55,8 +57,8 @@ public void getIngredients(@Nonnull IIngredients ingredients) { Item descriptiveBook = Integration.getMystItem(MystObjects.Items.descriptive_book); outputStacks.add(descriptiveBook == null ? Collections.emptyList() : Collections.singletonList(new ItemStack(descriptiveBook))); - ingredients.setInputLists(ItemStack.class, inputStacks); - ingredients.setOutputLists(ItemStack.class, outputStacks); + ingredients.setInputLists(VanillaTypes.ITEM, inputStacks); + ingredients.setOutputLists(VanillaTypes.ITEM, outputStacks); } @Override diff --git a/src/main/java/me/heldplayer/mystcraft_jei/crafting/InkMixerRecipeCategory.java b/src/main/java/me/heldplayer/mystcraft_jei/crafting/InkMixerRecipeCategory.java index 9d27b93..2b66811 100644 --- a/src/main/java/me/heldplayer/mystcraft_jei/crafting/InkMixerRecipeCategory.java +++ b/src/main/java/me/heldplayer/mystcraft_jei/crafting/InkMixerRecipeCategory.java @@ -9,14 +9,15 @@ import mezz.jei.api.gui.IGuiItemStackGroup; import mezz.jei.api.gui.IRecipeLayout; import mezz.jei.api.ingredients.IIngredients; -import mezz.jei.api.recipe.BlankRecipeCategory; +import mezz.jei.api.ingredients.VanillaTypes; +import mezz.jei.api.recipe.IRecipeCategory; import mezz.jei.api.recipe.IRecipeWrapper; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fluids.FluidStack; import javax.annotation.Nonnull; -public class InkMixerRecipeCategory extends BlankRecipeCategory { +public class InkMixerRecipeCategory implements IRecipeCategory { public static final int SLOT_TANK_INPUT = 0; public static final int SLOT_TANK_OUTPUT = 1; public static final int SLOT_PAPER = 2; @@ -36,7 +37,7 @@ public InkMixerRecipeCategory(@Nonnull IGuiHelper guiHelper) { ResourceLocation location = new ResourceLocation("mystcraft", "gui/inkmixer.png"); this.background = guiHelper.createDrawable(location, 5, 11, width, height); this.tankOverlay = guiHelper.createDrawable(location, 54, 16, 67, 66); - this.iconDrop = guiHelper.createDrawable(Assets.ICONS_EXTRA, 0, 0, 18, 10, Assets.ICONS_EXTRA_WIDTH, Assets.ICONS_EXTRA_HEIGHT); + this.iconDrop = guiHelper.drawableBuilder(Assets.ICONS_EXTRA, 0, 0, 18, 10).setTextureSize(Assets.ICONS_EXTRA_WIDTH, Assets.ICONS_EXTRA_HEIGHT).build(); this.title = Util.translate("mystcraft-jei.category.ink_mixer"); } @@ -83,10 +84,10 @@ public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapp recipe.setDropIcon(this.iconDrop); } - if (ingredients.getInputs(FluidStack.class).size() > 0) { + if (ingredients.getInputs(VanillaTypes.FLUID).size() > 0) { guiFluidStacks.init(TANK_INK, true, 49, 5, 67, 66, 1000, false, tankOverlay); } - if (ingredients.getOutputs(FluidStack.class).size() > 0) { + if (ingredients.getOutputs(VanillaTypes.FLUID).size() > 0) { guiFluidStacks.init(TANK_INK, false, 49, 5, 67, 66, 1000, false, tankOverlay); } diff --git a/src/main/java/me/heldplayer/mystcraft_jei/crafting/InkMixerRecipeWrapper.java b/src/main/java/me/heldplayer/mystcraft_jei/crafting/InkMixerRecipeWrapper.java index bef047f..1f7de91 100644 --- a/src/main/java/me/heldplayer/mystcraft_jei/crafting/InkMixerRecipeWrapper.java +++ b/src/main/java/me/heldplayer/mystcraft_jei/crafting/InkMixerRecipeWrapper.java @@ -8,6 +8,7 @@ import me.heldplayer.mystcraft_jei.integration.mystcraft.MystItemFactory; import mezz.jei.api.gui.IDrawable; import mezz.jei.api.ingredients.IIngredients; +import mezz.jei.api.ingredients.VanillaTypes; import mezz.jei.api.recipe.BlankRecipeWrapper; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiScreen; @@ -120,9 +121,9 @@ public void getIngredients(@Nonnull IIngredients ingredients) { List> inputFluids = new ArrayList<>(); inputFluids.add(Collections.singletonList(FluidRegistry.getFluidStack(MystObjects.Fluids.black_ink, 1000))); - ingredients.setInputLists(ItemStack.class, inputStacks); - ingredients.setInputLists(FluidStack.class, inputFluids); - ingredients.setOutputLists(ItemStack.class, outputStacks); + ingredients.setInputLists(VanillaTypes.ITEM, inputStacks); + ingredients.setInputLists(VanillaTypes.FLUID, inputFluids); + ingredients.setOutputLists(VanillaTypes.ITEM, outputStacks); } @Override diff --git a/src/main/java/me/heldplayer/mystcraft_jei/crafting/InkMixerRecipes.java b/src/main/java/me/heldplayer/mystcraft_jei/crafting/InkMixerRecipes.java index 4fe5a66..dbf8717 100644 --- a/src/main/java/me/heldplayer/mystcraft_jei/crafting/InkMixerRecipes.java +++ b/src/main/java/me/heldplayer/mystcraft_jei/crafting/InkMixerRecipes.java @@ -3,6 +3,7 @@ import me.heldplayer.mystcraft_jei.util.Integration; import mezz.jei.api.IModRegistry; import mezz.jei.api.ingredients.IIngredients; +import mezz.jei.api.ingredients.VanillaTypes; import mezz.jei.api.recipe.BlankRecipeWrapper; import mezz.jei.api.recipe.IRecipeWrapper; import net.minecraft.item.Item; @@ -25,7 +26,7 @@ public static Collection getRecipes(@Nonnull IModRegistry modReg Set validInks = Integration.getValidInks(); return Stream.concat( - modRegistry.getIngredientRegistry().getIngredients(ItemStack.class).stream() + modRegistry.getIngredientRegistry().getAllIngredients(VanillaTypes.ITEM).stream() .map((stack) -> Pair.of(stack, FluidUtil.getFluidContained(stack))) .filter((stacks) -> stacks.getRight() != null) .filter((stacks) -> stacks.getRight().amount == 1000) @@ -48,7 +49,7 @@ public static Collection getRecipes(@Nonnull IModRegistry modReg ).collect(Collectors.toList()); } - private static class InkFill extends BlankRecipeWrapper { + private static class InkFill implements IRecipeWrapper { private final ItemStack inputItem; private final ItemStack outputItem; @@ -72,9 +73,9 @@ public void getIngredients(@Nonnull IIngredients ingredients) { List> outputFluids = new ArrayList<>(); outputFluids.add(Collections.singletonList(this.fluid)); - ingredients.setInputLists(ItemStack.class, inputStacks); - ingredients.setOutputLists(FluidStack.class, outputFluids); - ingredients.setOutputLists(ItemStack.class, outputStacks); + ingredients.setInputLists(VanillaTypes.ITEM, inputStacks); + ingredients.setOutputLists(VanillaTypes.FLUID, outputFluids); + ingredients.setOutputLists(VanillaTypes.ITEM, outputStacks); } } } diff --git a/src/main/java/me/heldplayer/mystcraft_jei/crafting/LinkingBookRecipeWrapper.java b/src/main/java/me/heldplayer/mystcraft_jei/crafting/LinkingBookRecipeWrapper.java index 06a9237..a9e3ac3 100644 --- a/src/main/java/me/heldplayer/mystcraft_jei/crafting/LinkingBookRecipeWrapper.java +++ b/src/main/java/me/heldplayer/mystcraft_jei/crafting/LinkingBookRecipeWrapper.java @@ -5,6 +5,7 @@ import me.heldplayer.mystcraft_jei.integration.mystcraft.MystItemFactory; import me.heldplayer.mystcraft_jei.util.Integration; import mezz.jei.api.ingredients.IIngredients; +import mezz.jei.api.ingredients.VanillaTypes; import mezz.jei.api.recipe.BlankRecipeWrapper; import net.minecraft.init.Items; import net.minecraft.item.Item; @@ -26,7 +27,7 @@ public void getIngredients(@Nonnull IIngredients ingredients) { NBTTagCompound tag = pageStack.getTagCompound(); resultStack.setTagCompound(tag == null ? null : tag.copy()); - ingredients.setInputs(ItemStack.class, Lists.newArrayList(new ItemStack(Items.LEATHER), pageStack)); - ingredients.setOutput(ItemStack.class, resultStack); + ingredients.setInputs(VanillaTypes.ITEM, Lists.newArrayList(new ItemStack(Items.LEATHER), pageStack)); + ingredients.setOutput(VanillaTypes.ITEM, resultStack); } } diff --git a/src/main/java/me/heldplayer/mystcraft_jei/crafting/WritingDeskRecipeCategory.java b/src/main/java/me/heldplayer/mystcraft_jei/crafting/WritingDeskRecipeCategory.java index c79e7a6..f8febc3 100644 --- a/src/main/java/me/heldplayer/mystcraft_jei/crafting/WritingDeskRecipeCategory.java +++ b/src/main/java/me/heldplayer/mystcraft_jei/crafting/WritingDeskRecipeCategory.java @@ -9,6 +9,7 @@ import mezz.jei.api.gui.IGuiItemStackGroup; import mezz.jei.api.gui.IRecipeLayout; import mezz.jei.api.ingredients.IIngredients; +import mezz.jei.api.ingredients.VanillaTypes; import mezz.jei.api.recipe.BlankRecipeCategory; import net.minecraft.client.Minecraft; import net.minecraft.util.ResourceLocation; @@ -75,10 +76,10 @@ public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull WritingDeskR guiItemStacks.init(SLOT_TANK_OUTPUT, false, 144, 52); guiItemStacks.set(ingredients); - if (ingredients.getInputs(FluidStack.class).size() > 0) { + if (ingredients.getInputs(VanillaTypes.FLUID).size() > 0) { guiFluidStacks.init(TANK_INK, true, 126, 1, 14, 68, 1000, false, null); } - if (ingredients.getOutputs(FluidStack.class).size() > 0) { + if (ingredients.getOutputs(VanillaTypes.FLUID).size() > 0) { guiFluidStacks.init(TANK_INK, false, 126, 1, 14, 68, 1000, false, null); } diff --git a/src/main/java/me/heldplayer/mystcraft_jei/crafting/WritingDeskRecipes.java b/src/main/java/me/heldplayer/mystcraft_jei/crafting/WritingDeskRecipes.java index b4ab714..f239b1d 100644 --- a/src/main/java/me/heldplayer/mystcraft_jei/crafting/WritingDeskRecipes.java +++ b/src/main/java/me/heldplayer/mystcraft_jei/crafting/WritingDeskRecipes.java @@ -9,13 +9,17 @@ import mezz.jei.api.IModRegistry; import mezz.jei.api.gui.IGuiIngredient; import mezz.jei.api.ingredients.IIngredients; +import mezz.jei.api.ingredients.VanillaTypes; import mezz.jei.api.recipe.BlankRecipeWrapper; +import mezz.jei.api.recipe.IRecipeWrapper; import net.minecraft.client.Minecraft; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidUtil; +import org.apache.commons.lang3.Validate; import org.apache.commons.lang3.tuple.Pair; import javax.annotation.Nonnull; @@ -33,7 +37,7 @@ public static Collection getRecipes(@Nonnull IModRegistry mo int inkcost = Integration.getInkcost(); return Stream.concat( - modRegistry.getIngredientRegistry().getIngredients(ItemStack.class).stream() + modRegistry.getIngredientRegistry().getAllIngredients(VanillaTypes.ITEM).stream() .map((stack) -> Pair.of(stack, FluidUtil.getFluidContained(stack))) .filter((stacks) -> stacks.getRight() != null) .filter((stacks) -> stacks.getRight().amount <= 1000) @@ -48,7 +52,7 @@ public static Collection getRecipes(@Nonnull IModRegistry mo ).collect(Collectors.toList()); } - public abstract static class AwareRecipeWrapper extends BlankRecipeWrapper { + public abstract static class AwareRecipeWrapper implements IRecipeWrapper { protected IGuiIngredient inputSlot; protected IDrawableTextfield textField; @@ -91,9 +95,9 @@ public void getIngredients(@Nonnull IIngredients ingredients) { List> outputFluids = new ArrayList<>(); outputFluids.add(Collections.singletonList(this.fluid)); - ingredients.setInputLists(ItemStack.class, inputStacks); - ingredients.setOutputLists(FluidStack.class, outputFluids); - ingredients.setOutputLists(ItemStack.class, outputStacks); + ingredients.setInputLists(VanillaTypes.ITEM, inputStacks); + ingredients.setOutputLists(VanillaTypes.FLUID, outputFluids); + ingredients.setOutputLists(VanillaTypes.ITEM, outputStacks); } @Override @@ -122,9 +126,9 @@ public void getIngredients(@Nonnull IIngredients ingredients) { List> inputFluids = new ArrayList<>(); inputFluids.add(this.validFluids); - ingredients.setInputLists(ItemStack.class, inputStacks); - ingredients.setInputLists(FluidStack.class, inputFluids); - ingredients.setOutputLists(ItemStack.class, outputStacks); + ingredients.setInputLists(VanillaTypes.ITEM, inputStacks); + ingredients.setInputLists(VanillaTypes.FLUID, inputFluids); + ingredients.setOutputLists(VanillaTypes.ITEM, outputStacks); } @Override @@ -133,7 +137,7 @@ public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHe ItemStack ingredient = this.inputSlot.getDisplayedIngredient(); if (ingredient != null) { - String symbol = MystPage.getPageSymbol(ingredient); + ResourceLocation symbol = MystPage.getPageSymbol(ingredient); if (symbol != null) { IAgeSymbol ageSymbol = MystSymbol.getSymbol(symbol); if (ageSymbol != null) { @@ -153,7 +157,7 @@ public List getTooltipStrings(int mouseX, int mouseY) { if (mouseX >= 26 && mouseX < 63 && mouseY >= 0 && mouseY < 50) { ItemStack ingredient = this.inputSlot.getDisplayedIngredient(); if (ingredient != null) { - String symbol = MystPage.getPageSymbol(ingredient); + ResourceLocation symbol = MystPage.getPageSymbol(ingredient); if (symbol != null) { IAgeSymbol ageSymbol = MystSymbol.getSymbol(symbol); if (ageSymbol != null) { diff --git a/src/main/java/me/heldplayer/mystcraft_jei/integration/mystcraft/MystItemFactory.java b/src/main/java/me/heldplayer/mystcraft_jei/integration/mystcraft/MystItemFactory.java index b08ce7b..b7228f4 100644 --- a/src/main/java/me/heldplayer/mystcraft_jei/integration/mystcraft/MystItemFactory.java +++ b/src/main/java/me/heldplayer/mystcraft_jei/integration/mystcraft/MystItemFactory.java @@ -2,6 +2,7 @@ import com.xcompwiz.mystcraft.api.hook.ItemFactory; import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; import javax.annotation.Nonnull; @@ -17,7 +18,7 @@ public static boolean isReady() { } @Nonnull - public static ItemStack buildSymbolPage(@Nonnull String s) { + public static ItemStack buildSymbolPage(@Nonnull ResourceLocation s) { return api.buildSymbolPage(s); } diff --git a/src/main/java/me/heldplayer/mystcraft_jei/integration/mystcraft/MystPage.java b/src/main/java/me/heldplayer/mystcraft_jei/integration/mystcraft/MystPage.java index a1ab09a..d483e56 100644 --- a/src/main/java/me/heldplayer/mystcraft_jei/integration/mystcraft/MystPage.java +++ b/src/main/java/me/heldplayer/mystcraft_jei/integration/mystcraft/MystPage.java @@ -2,6 +2,7 @@ import com.xcompwiz.mystcraft.api.hook.PageAPI; import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; import javax.annotation.Nonnull; import javax.annotation.Nullable; @@ -18,7 +19,7 @@ public static boolean isReady() { } @Nullable - public static String getPageSymbol(@Nonnull ItemStack itemStack) { + public static ResourceLocation getPageSymbol(@Nonnull ItemStack itemStack) { return api.getPageSymbol(itemStack); } } diff --git a/src/main/java/me/heldplayer/mystcraft_jei/integration/mystcraft/MystRender.java b/src/main/java/me/heldplayer/mystcraft_jei/integration/mystcraft/MystRender.java index b4dff48..b2da377 100644 --- a/src/main/java/me/heldplayer/mystcraft_jei/integration/mystcraft/MystRender.java +++ b/src/main/java/me/heldplayer/mystcraft_jei/integration/mystcraft/MystRender.java @@ -2,6 +2,7 @@ import com.xcompwiz.mystcraft.api.hook.RenderAPI; import com.xcompwiz.mystcraft.api.util.Color; +import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -19,7 +20,7 @@ public static boolean isReady() { } @SideOnly(Side.CLIENT) - public static void drawSymbol(float posX, float posY, float zLevel, float radius, @Nonnull String identifier) { + public static void drawSymbol(float posX, float posY, float zLevel, float radius, @Nonnull ResourceLocation identifier) { api.drawSymbol(posX, posY, zLevel, radius, identifier); } diff --git a/src/main/java/me/heldplayer/mystcraft_jei/integration/mystcraft/MystSymbol.java b/src/main/java/me/heldplayer/mystcraft_jei/integration/mystcraft/MystSymbol.java index e765ede..d0031f0 100644 --- a/src/main/java/me/heldplayer/mystcraft_jei/integration/mystcraft/MystSymbol.java +++ b/src/main/java/me/heldplayer/mystcraft_jei/integration/mystcraft/MystSymbol.java @@ -2,6 +2,7 @@ import com.xcompwiz.mystcraft.api.hook.SymbolAPI; import com.xcompwiz.mystcraft.api.symbol.IAgeSymbol; +import net.minecraft.util.ResourceLocation; import javax.annotation.Nonnull; import javax.annotation.Nullable; @@ -24,7 +25,7 @@ public static List getAllRegisteredSymbols() { } @Nullable - public static IAgeSymbol getSymbol(@Nonnull String s) { + public static IAgeSymbol getSymbol(@Nonnull ResourceLocation s) { return api.getSymbol(s); } } diff --git a/src/main/java/me/heldplayer/mystcraft_jei/subtypes/PageSubtypeInterpreter.java b/src/main/java/me/heldplayer/mystcraft_jei/subtypes/PageSubtypeInterpreter.java index d4e5212..b203b29 100644 --- a/src/main/java/me/heldplayer/mystcraft_jei/subtypes/PageSubtypeInterpreter.java +++ b/src/main/java/me/heldplayer/mystcraft_jei/subtypes/PageSubtypeInterpreter.java @@ -18,7 +18,7 @@ private PageSubtypeInterpreter() { @Nullable @Override - public String getSubtypeInfo(@Nonnull ItemStack stack) { + public String apply(@Nonnull ItemStack stack) { NBTTagCompound tag = stack.getTagCompound(); if (tag == null) { return null; diff --git a/src/main/java/me/heldplayer/mystcraft_jei/subtypes/UnlinkedLinkbookInterpreter.java b/src/main/java/me/heldplayer/mystcraft_jei/subtypes/UnlinkedLinkbookInterpreter.java index 15bbae0..0ee0611 100644 --- a/src/main/java/me/heldplayer/mystcraft_jei/subtypes/UnlinkedLinkbookInterpreter.java +++ b/src/main/java/me/heldplayer/mystcraft_jei/subtypes/UnlinkedLinkbookInterpreter.java @@ -18,7 +18,7 @@ private UnlinkedLinkbookInterpreter() { @Nullable @Override - public String getSubtypeInfo(@Nonnull ItemStack stack) { + public String apply(@Nonnull ItemStack stack) { NBTTagCompound tag = stack.getTagCompound(); if (tag != null && tag.hasKey("linkpanel", 10)) { diff --git a/src/main/java/me/heldplayer/mystcraft_jei/util/Integration.java b/src/main/java/me/heldplayer/mystcraft_jei/util/Integration.java index 61e6649..374ccd5 100644 --- a/src/main/java/me/heldplayer/mystcraft_jei/util/Integration.java +++ b/src/main/java/me/heldplayer/mystcraft_jei/util/Integration.java @@ -181,7 +181,7 @@ public static List gatherAllSymbolStacks() { return MystSymbol.getAllRegisteredSymbols() .stream() .sorted(Comparator.comparing(IAgeSymbol::getLocalizedName)) - .map(IAgeSymbol::identifier) + .map(IAgeSymbol::getRegistryName) .map(MystItemFactory::buildSymbolPage) .collect(Collectors.toList()); }