diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/jei/RecipeWrapperWithButton.java b/src/main/java/de/ellpeck/actuallyadditions/mod/jei/RecipeWrapperWithButton.java index 3cb451863..0be55cc03 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/jei/RecipeWrapperWithButton.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/jei/RecipeWrapperWithButton.java @@ -17,32 +17,29 @@ import de.ellpeck.actuallyadditions.mod.booklet.GuiBooklet; import de.ellpeck.actuallyadditions.mod.booklet.button.TexturedButton; import de.ellpeck.actuallyadditions.mod.util.ModUtil; import de.ellpeck.actuallyadditions.mod.util.StringUtil; +import mezz.jei.api.recipe.IRecipeWrapper; import net.minecraft.client.Minecraft; -public abstract class RecipeWrapperWithButton{ +import javax.annotation.Nullable; +import java.util.Collections; +import java.util.List; + +public abstract class RecipeWrapperWithButton implements IRecipeWrapper{ protected final TexturedButton theButton; public RecipeWrapperWithButton(){ - this.theButton = new TexturedButton(23782, this.getButtonX(), this.getButtonY(), 146, 154, 20, 20){ - @Override - public void drawButton(Minecraft minecraft, int x, int y){ - super.drawButton(minecraft, x, y); - if(this.visible && this.hovered){ - String text = StringUtil.localize("booklet."+ModUtil.MOD_ID+".clickToSeeRecipe"); - Minecraft.getMinecraft().fontRendererObj.drawString(text, this.xPosition-Minecraft.getMinecraft().fontRendererObj.getStringWidth(text)-1, this.yPosition+this.height/2-Minecraft.getMinecraft().fontRendererObj.FONT_HEIGHT/2, StringUtil.DECIMAL_COLOR_WHITE, true); - } - } - }; + this.theButton = new TexturedButton(23782, this.getButtonX(), this.getButtonY(), 146, 154, 20, 20); } public abstract int getButtonX(); public abstract int getButtonY(); - public boolean handleClick(Minecraft mc, int mouseX, int mouseY){ - if(this.theButton.mousePressed(mc, mouseX, mouseY)){ - this.theButton.playPressSound(mc.getSoundHandler()); + @Override + public boolean handleClick(Minecraft minecraft, int mouseX, int mouseY, int mouseButton){ + if(this.theButton.mousePressed(minecraft, mouseX, mouseY)){ + this.theButton.playPressSound(minecraft.getSoundHandler()); BookletPage page = this.getPage(); if(page != null){ @@ -58,7 +55,19 @@ public abstract class RecipeWrapperWithButton{ public abstract BookletPage getPage(); - public void updateButton(Minecraft mc, int mouseX, int mouseY){ - this.theButton.drawButton(mc, mouseX, mouseY); + @Override + public void drawInfo(Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY){ + this.theButton.drawButton(minecraft, mouseX, mouseY); + } + + @Nullable + @Override + public List getTooltipStrings(int mouseX, int mouseY){ + if(this.theButton.isMouseOver()){ + return Collections.singletonList(StringUtil.localize("booklet."+ModUtil.MOD_ID+".clickToSeeRecipe")); + } + else{ + return Collections.emptyList(); + } } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/jei/booklet/BookletRecipeCategory.java b/src/main/java/de/ellpeck/actuallyadditions/mod/jei/booklet/BookletRecipeCategory.java index ac1352e2a..ff9b7a3df 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/jei/booklet/BookletRecipeCategory.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/jei/booklet/BookletRecipeCategory.java @@ -28,7 +28,7 @@ public class BookletRecipeCategory implements IRecipeCategory{ private final IDrawable background; public BookletRecipeCategory(IGuiHelper helper){ - this.background = helper.createBlankDrawable(160, 100); + this.background = helper.createBlankDrawable(160, 105); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/jei/booklet/BookletRecipeWrapper.java b/src/main/java/de/ellpeck/actuallyadditions/mod/jei/booklet/BookletRecipeWrapper.java index edde082dc..90170b6ee 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/jei/booklet/BookletRecipeWrapper.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/jei/booklet/BookletRecipeWrapper.java @@ -25,7 +25,7 @@ import net.minecraftforge.fluids.FluidStack; import java.util.Arrays; import java.util.List; -public class BookletRecipeWrapper extends RecipeWrapperWithButton implements IRecipeWrapper{ +public class BookletRecipeWrapper extends RecipeWrapperWithButton{ public final BookletPage thePage; @@ -75,7 +75,7 @@ public class BookletRecipeWrapper extends RecipeWrapperWithButton implements IRe minecraft.fontRendererObj.drawString(TextFormatting.ITALIC+chapter.getLocalizedName(), 25, 85, 0, false); minecraft.fontRendererObj.drawString(TextFormatting.ITALIC+"Page "+this.thePage.getID(), 25, 95, 0, false); - this.updateButton(minecraft, mouseX, mouseY); + super.drawInfo(minecraft, recipeWidth, recipeHeight, mouseX, mouseY); } @Override @@ -83,16 +83,6 @@ public class BookletRecipeWrapper extends RecipeWrapperWithButton implements IRe } - @Override - public List getTooltipStrings(int mouseX, int mouseY){ - return null; - } - - @Override - public boolean handleClick(Minecraft minecraft, int mouseX, int mouseY, int mouseButton){ - return this.handleClick(minecraft, mouseX, mouseY); - } - @Override public int getButtonX(){ return 0; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/jei/coffee/CoffeeMachineRecipeCategory.java b/src/main/java/de/ellpeck/actuallyadditions/mod/jei/coffee/CoffeeMachineRecipeCategory.java index 7a3591fa5..a29337377 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/jei/coffee/CoffeeMachineRecipeCategory.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/jei/coffee/CoffeeMachineRecipeCategory.java @@ -27,7 +27,7 @@ public class CoffeeMachineRecipeCategory implements IRecipeCategory{ private final IDrawable background; public CoffeeMachineRecipeCategory(IGuiHelper helper){ - this.background = helper.createDrawable(AssetUtil.getGuiLocation("guiNEICoffeeMachine"), 0, 0, 126, 88); + this.background = helper.createDrawable(AssetUtil.getGuiLocation("guiNEICoffeeMachine"), 0, 0, 126, 92); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/jei/coffee/CoffeeMachineRecipeWrapper.java b/src/main/java/de/ellpeck/actuallyadditions/mod/jei/coffee/CoffeeMachineRecipeWrapper.java index 20eb35547..ddb767ec9 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/jei/coffee/CoffeeMachineRecipeWrapper.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/jei/coffee/CoffeeMachineRecipeWrapper.java @@ -30,7 +30,7 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; -public class CoffeeMachineRecipeWrapper extends RecipeWrapperWithButton implements IRecipeWrapper{ +public class CoffeeMachineRecipeWrapper extends RecipeWrapperWithButton{ public final CoffeeIngredient theIngredient; public final ItemStack theOutput; @@ -75,8 +75,6 @@ public class CoffeeMachineRecipeWrapper extends RecipeWrapperWithButton implemen @Override public void drawInfo(Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY){ - this.updateButton(minecraft, mouseX, mouseY); - if(this.theIngredient.getExtraText() != null){ minecraft.fontRendererObj.drawString(StringUtil.localize("container.nei."+ModUtil.MOD_ID+".coffee.special")+":", 2, 4, StringUtil.DECIMAL_COLOR_GRAY_TEXT, false); minecraft.fontRendererObj.drawString(this.theIngredient.getExtraText(), 2, 16, StringUtil.DECIMAL_COLOR_GRAY_TEXT, false); @@ -85,6 +83,8 @@ public class CoffeeMachineRecipeWrapper extends RecipeWrapperWithButton implemen if(this.theIngredient.maxAmplifier > 0){ minecraft.fontRendererObj.drawString(StringUtil.localize("container.nei."+ModUtil.MOD_ID+".coffee.maxAmount")+": "+this.theIngredient.maxAmplifier, 2, 28, StringUtil.DECIMAL_COLOR_GRAY_TEXT, false); } + + super.drawInfo(minecraft, recipeWidth, recipeHeight, mouseX, mouseY); } @Override @@ -92,16 +92,6 @@ public class CoffeeMachineRecipeWrapper extends RecipeWrapperWithButton implemen } - @Override - public List getTooltipStrings(int mouseX, int mouseY){ - return null; - } - - @Override - public boolean handleClick(Minecraft minecraft, int mouseX, int mouseY, int mouseButton){ - return this.handleClick(minecraft, mouseX, mouseY); - } - @Override public int getButtonX(){ return 0; @@ -109,7 +99,7 @@ public class CoffeeMachineRecipeWrapper extends RecipeWrapperWithButton implemen @Override public int getButtonY(){ - return 70; + return 68; } @Override diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/jei/crusher/CrusherRecipeWrapper.java b/src/main/java/de/ellpeck/actuallyadditions/mod/jei/crusher/CrusherRecipeWrapper.java index 353ab0d31..c34b396b3 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/jei/crusher/CrusherRecipeWrapper.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/jei/crusher/CrusherRecipeWrapper.java @@ -26,7 +26,7 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; -public class CrusherRecipeWrapper extends RecipeWrapperWithButton implements IRecipeWrapper{ +public class CrusherRecipeWrapper extends RecipeWrapperWithButton{ public final CrusherRecipe theRecipe; @@ -66,11 +66,11 @@ public class CrusherRecipeWrapper extends RecipeWrapperWithButton implements IRe @Override public void drawInfo(Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY){ - this.updateButton(minecraft, mouseX, mouseY); - if(this.theRecipe.outputTwoStack != null){ minecraft.fontRendererObj.drawString(this.theRecipe.outputTwoChance+"%", 60, 60, StringUtil.DECIMAL_COLOR_GRAY_TEXT, false); } + + super.drawInfo(minecraft, recipeWidth, recipeHeight, mouseX, mouseY); } @Override @@ -78,16 +78,6 @@ public class CrusherRecipeWrapper extends RecipeWrapperWithButton implements IRe } - @Override - public List getTooltipStrings(int mouseX, int mouseY){ - return null; - } - - @Override - public boolean handleClick(Minecraft minecraft, int mouseX, int mouseY, int mouseButton){ - return this.handleClick(minecraft, mouseX, mouseY); - } - @Override public int getButtonX(){ return -5; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/jei/empowerer/EmpowererRecipeWrapper.java b/src/main/java/de/ellpeck/actuallyadditions/mod/jei/empowerer/EmpowererRecipeWrapper.java index c381dda36..5c0c8b22a 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/jei/empowerer/EmpowererRecipeWrapper.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/jei/empowerer/EmpowererRecipeWrapper.java @@ -26,7 +26,7 @@ import java.util.Arrays; import java.util.Collections; import java.util.List; -public class EmpowererRecipeWrapper extends RecipeWrapperWithButton implements IRecipeWrapper{ +public class EmpowererRecipeWrapper extends RecipeWrapperWithButton{ public final EmpowererRecipe theRecipe; @@ -59,26 +59,11 @@ public class EmpowererRecipeWrapper extends RecipeWrapperWithButton implements I return new ArrayList(); } - @Override - public void drawInfo(Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY){ - this.updateButton(minecraft, mouseX, mouseY); - } - @Override public void drawAnimations(Minecraft minecraft, int recipeWidth, int recipeHeight){ } - @Override - public List getTooltipStrings(int mouseX, int mouseY){ - return null; - } - - @Override - public boolean handleClick(Minecraft minecraft, int mouseX, int mouseY, int mouseButton){ - return this.handleClick(minecraft, mouseX, mouseY); - } - @Override public int getButtonX(){ return 2; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/jei/reconstructor/ReconstructorRecipeWrapper.java b/src/main/java/de/ellpeck/actuallyadditions/mod/jei/reconstructor/ReconstructorRecipeWrapper.java index 0e6fc8339..601d5736b 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/jei/reconstructor/ReconstructorRecipeWrapper.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/jei/reconstructor/ReconstructorRecipeWrapper.java @@ -25,7 +25,7 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; -public class ReconstructorRecipeWrapper extends RecipeWrapperWithButton implements IRecipeWrapper{ +public class ReconstructorRecipeWrapper extends RecipeWrapperWithButton{ public final LensConversionRecipe theRecipe; @@ -58,26 +58,11 @@ public class ReconstructorRecipeWrapper extends RecipeWrapperWithButton implemen return new ArrayList(); } - @Override - public void drawInfo(Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY){ - this.updateButton(minecraft, mouseX, mouseY); - } - @Override public void drawAnimations(Minecraft minecraft, int recipeWidth, int recipeHeight){ } - @Override - public List getTooltipStrings(int mouseX, int mouseY){ - return null; - } - - @Override - public boolean handleClick(Minecraft minecraft, int mouseX, int mouseY, int mouseButton){ - return this.handleClick(minecraft, mouseX, mouseY); - } - @Override public int getButtonX(){ return 3; diff --git a/src/main/resources/assets/actuallyadditions/lang/en_US.lang b/src/main/resources/assets/actuallyadditions/lang/en_US.lang index aa932d98d..11af5e672 100644 --- a/src/main/resources/assets/actuallyadditions/lang/en_US.lang +++ b/src/main/resources/assets/actuallyadditions/lang/en_US.lang @@ -94,7 +94,7 @@ container.nei.actuallyadditions.reconstructor.name=Atomic Reconstructor container.nei.actuallyadditions.empowerer.name=Empowerer container.nei.actuallyadditions.booklet.name=ActAdd Manual -container.nei.actuallyadditions.booklet.header=The Actually Additions Manual reads: +container.nei.actuallyadditions.booklet.header=The Actually Additions Manual says: container.nei.actuallyadditions.booklet.noText=Nothing, apparently! But that doesn't matter. Just click the button on the bottom to see the item inside the booklet and look through its pages to find some fancy stuff! #Damage Sources