From 367d1b3385403b70cb09760b00c30770aba13e46 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Wed, 29 Jul 2015 11:03:17 +0200 Subject: [PATCH] Fixed Crusher Recipe NEI Handling Transfer Rects being off by adding a different Recipe Handler for that --- .../inventory/GuiHandler.java | 4 +- .../inventory/gui/GuiGrinder.java | 12 +++++- .../nei/CoffeeMachineRecipeHandler.java | 8 ++-- .../nei/CompostRecipeHandler.java | 2 +- .../nei/CrusherRecipeHandler.java | 36 +++++++++++++----- .../nei/HairyBallRecipeHandler.java | 2 +- .../nei/NEIActuallyAdditionsConfig.java | 4 ++ .../nei/TreasureChestRecipeHandler.java | 2 +- .../assets/actuallyadditions/lang/en_US.lang | 1 + .../textures/gui/guiNEICoffeeMachine.png | Bin 2387 -> 2386 bytes .../textures/gui/guiNEIHairyBall.png | Bin 1786 -> 0 bytes .../{guiNEICompost.png => guiNEISimple.png} | Bin .../textures/gui/guiNEITreasure.png | Bin 1786 -> 0 bytes 13 files changed, 51 insertions(+), 20 deletions(-) delete mode 100644 src/main/resources/assets/actuallyadditions/textures/gui/guiNEIHairyBall.png rename src/main/resources/assets/actuallyadditions/textures/gui/{guiNEICompost.png => guiNEISimple.png} (100%) delete mode 100644 src/main/resources/assets/actuallyadditions/textures/gui/guiNEITreasure.png diff --git a/src/main/java/ellpeck/actuallyadditions/inventory/GuiHandler.java b/src/main/java/ellpeck/actuallyadditions/inventory/GuiHandler.java index 9cc97eae1..ced525025 100644 --- a/src/main/java/ellpeck/actuallyadditions/inventory/GuiHandler.java +++ b/src/main/java/ellpeck/actuallyadditions/inventory/GuiHandler.java @@ -81,9 +81,9 @@ public class GuiHandler implements IGuiHandler{ case CRAFTER: return new GuiCrafter(entityPlayer); case GRINDER: - return new GuiGrinder(entityPlayer.inventory, tile, false); + return new GuiGrinder(entityPlayer.inventory, tile); case GRINDER_DOUBLE: - return new GuiGrinder(entityPlayer.inventory, tile, true); + return new GuiGrinder.GuiGrinderDouble(entityPlayer.inventory, tile); case FURNACE_DOUBLE: return new GuiFurnaceDouble(entityPlayer.inventory, tile); case INPUTTER: diff --git a/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiGrinder.java b/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiGrinder.java index 4ac9f9597..595196f5c 100644 --- a/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiGrinder.java +++ b/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiGrinder.java @@ -16,12 +16,22 @@ import java.util.Collections; @SideOnly(Side.CLIENT) public class GuiGrinder extends GuiContainer{ + public static class GuiGrinderDouble extends GuiGrinder{ + public GuiGrinderDouble(InventoryPlayer inventory, TileEntityBase tile){ + super(inventory, tile, true); + } + } + private static final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiGrinder"); private static final ResourceLocation resLocDouble = AssetUtil.getGuiLocation("guiGrinderDouble"); private TileEntityGrinder tileGrinder; private boolean isDouble; - public GuiGrinder(InventoryPlayer inventory, TileEntityBase tile, boolean isDouble){ + public GuiGrinder(InventoryPlayer inventoryPlayer, TileEntityBase tile){ + this(inventoryPlayer, tile, false); + } + + private GuiGrinder(InventoryPlayer inventory, TileEntityBase tile, boolean isDouble){ super(new ContainerGrinder(inventory, tile, isDouble)); this.tileGrinder = (TileEntityGrinder)tile; this.isDouble = isDouble; diff --git a/src/main/java/ellpeck/actuallyadditions/nei/CoffeeMachineRecipeHandler.java b/src/main/java/ellpeck/actuallyadditions/nei/CoffeeMachineRecipeHandler.java index 1d134e88e..ad864cc00 100644 --- a/src/main/java/ellpeck/actuallyadditions/nei/CoffeeMachineRecipeHandler.java +++ b/src/main/java/ellpeck/actuallyadditions/nei/CoffeeMachineRecipeHandler.java @@ -27,7 +27,7 @@ public class CoffeeMachineRecipeHandler extends TemplateRecipeHandler{ public CoffeeMachineRecipeHandler(){ super(); - RecipeInfo.setGuiOffset(this.getGuiClass(), 32, 3); + RecipeInfo.setGuiOffset(this.getGuiClass(), 35, 3); } public class CachedCoffee extends CachedRecipe{ @@ -76,8 +76,8 @@ public class CoffeeMachineRecipeHandler extends TemplateRecipeHandler{ @Override public void loadTransferRects(){ - transferRects.add(new RecipeTransferRect(new Rectangle(21, 39, 22, 16), NAME)); - transferRects.add(new RecipeTransferRect(new Rectangle(67, 42, 22, 10), NAME)); + transferRects.add(new RecipeTransferRect(new Rectangle(20, 39, 20, 16), NAME)); + transferRects.add(new RecipeTransferRect(new Rectangle(64, 42, 23, 10), NAME)); } @Override @@ -136,7 +136,7 @@ public class CoffeeMachineRecipeHandler extends TemplateRecipeHandler{ @Override public void drawExtras(int recipe){ - drawProgressBar(21, 39, 126, 0, 21, 16, 48, 0); + drawProgressBar(20, 39, 126, 0, 21, 16, 48, 0); drawProgressBar(63, 42, 125, 16, 24, 12, 48, 2); CachedCoffee cache = (CachedCoffee)this.arecipes.get(recipe); diff --git a/src/main/java/ellpeck/actuallyadditions/nei/CompostRecipeHandler.java b/src/main/java/ellpeck/actuallyadditions/nei/CompostRecipeHandler.java index 4bb42739a..0a6634161 100644 --- a/src/main/java/ellpeck/actuallyadditions/nei/CompostRecipeHandler.java +++ b/src/main/java/ellpeck/actuallyadditions/nei/CompostRecipeHandler.java @@ -92,7 +92,7 @@ public class CompostRecipeHandler extends TemplateRecipeHandler{ @Override public String getGuiTexture(){ - return ModUtil.MOD_ID_LOWER + ":textures/gui/guiNEICompost.png"; + return ModUtil.MOD_ID_LOWER + ":textures/gui/GuiNEISimple.png"; } @Override diff --git a/src/main/java/ellpeck/actuallyadditions/nei/CrusherRecipeHandler.java b/src/main/java/ellpeck/actuallyadditions/nei/CrusherRecipeHandler.java index 4ff756f4a..00e0bc669 100644 --- a/src/main/java/ellpeck/actuallyadditions/nei/CrusherRecipeHandler.java +++ b/src/main/java/ellpeck/actuallyadditions/nei/CrusherRecipeHandler.java @@ -21,10 +21,21 @@ import java.util.List; public class CrusherRecipeHandler extends TemplateRecipeHandler{ - public static final String NAME = "actuallyadditions.crushing"; + public static class CrusherDoubleRecipeHandler extends CrusherRecipeHandler{ + + @Override + public Class getGuiClass(){ + return GuiGrinder.GuiGrinderDouble.class; + } + + @Override + public void loadTransferRects(){ + transferRects.add(new RecipeTransferRect(new Rectangle(51, 40, 24, 22), this.getName())); + transferRects.add(new RecipeTransferRect(new Rectangle(101, 40, 24, 22), this.getName())); + } + } public CrusherRecipeHandler(){ - super(); RecipeInfo.setGuiOffset(this.getGuiClass(), 0, 0); } @@ -45,7 +56,7 @@ public class CrusherRecipeHandler extends TemplateRecipeHandler{ @Override public List getIngredients(){ - return getCycledIngredients(cycleticks / 48, Collections.singletonList(ingredient)); + return getCycledIngredients(cycleticks/48, Collections.singletonList(ingredient)); } @Override @@ -68,7 +79,7 @@ public class CrusherRecipeHandler extends TemplateRecipeHandler{ @Override public void loadTransferRects(){ - transferRects.add(new RecipeTransferRect(new Rectangle(80, 40, 24, 22), NAME)); + transferRects.add(new RecipeTransferRect(new Rectangle(80, 40, 24, 22), this.getName())); } @Override @@ -78,12 +89,12 @@ public class CrusherRecipeHandler extends TemplateRecipeHandler{ @Override public String getRecipeName(){ - return StatCollector.translateToLocal("container.nei." + NAME + ".name"); + return StatCollector.translateToLocal("container.nei."+this.getName()+".name"); } @Override public void loadCraftingRecipes(String outputId, Object... results){ - if(outputId.equals(NAME) && getClass() == CrusherRecipeHandler.class){ + if(outputId.equals(this.getName()) && (getClass() == CrusherRecipeHandler.class || getClass() == CrusherDoubleRecipeHandler.class)){ ArrayList recipes = CrusherRecipeManualRegistry.recipes; for(CrusherRecipeManualRegistry.CrusherRecipe recipe : recipes){ arecipes.add(new CachedCrush(recipe.input, recipe.firstOutput, recipe.secondOutput, recipe.secondChance)); @@ -96,7 +107,8 @@ public class CrusherRecipeHandler extends TemplateRecipeHandler{ public void loadCraftingRecipes(ItemStack result){ ArrayList recipes = CrusherRecipeManualRegistry.recipes; for(CrusherRecipeManualRegistry.CrusherRecipe recipe : recipes){ - if(NEIServerUtils.areStacksSameType(recipe.firstOutput, result) || NEIServerUtils.areStacksSameType(recipe.secondOutput, result)) arecipes.add(new CachedCrush(recipe.input, recipe.firstOutput, recipe.secondOutput, recipe.secondChance)); + if(NEIServerUtils.areStacksSameType(recipe.firstOutput, result) || NEIServerUtils.areStacksSameType(recipe.secondOutput, result)) + arecipes.add(new CachedCrush(recipe.input, recipe.firstOutput, recipe.secondOutput, recipe.secondChance)); } } @@ -114,7 +126,7 @@ public class CrusherRecipeHandler extends TemplateRecipeHandler{ @Override public String getGuiTexture(){ - return ModUtil.MOD_ID_LOWER + ":textures/gui/guiGrinder.png"; + return ModUtil.MOD_ID_LOWER+":textures/gui/guiGrinder.png"; } @Override @@ -131,13 +143,17 @@ public class CrusherRecipeHandler extends TemplateRecipeHandler{ CachedCrush crush = (CachedCrush)this.arecipes.get(recipe); if(crush.resultTwo != null){ int secondChance = crush.secondChance; - String secondString = secondChance + "%"; + String secondString = secondChance+"%"; GuiDraw.drawString(secondString, 118, 73, StringUtil.DECIMAL_COLOR_GRAY_TEXT, false); } } @Override public String getOverlayIdentifier(){ - return NAME; + return this.getName(); + } + + protected String getName(){ + return "actuallyadditions."+(this instanceof CrusherDoubleRecipeHandler ? "crushingDouble" : "crushing"); } } \ No newline at end of file diff --git a/src/main/java/ellpeck/actuallyadditions/nei/HairyBallRecipeHandler.java b/src/main/java/ellpeck/actuallyadditions/nei/HairyBallRecipeHandler.java index 9ceaa2d57..90ee8fba2 100644 --- a/src/main/java/ellpeck/actuallyadditions/nei/HairyBallRecipeHandler.java +++ b/src/main/java/ellpeck/actuallyadditions/nei/HairyBallRecipeHandler.java @@ -102,7 +102,7 @@ public class HairyBallRecipeHandler extends TemplateRecipeHandler{ @Override public String getGuiTexture(){ - return ModUtil.MOD_ID_LOWER + ":textures/gui/guiNEIHairyBall.png"; + return ModUtil.MOD_ID_LOWER + ":textures/gui/GuiNEISimple.png"; } @Override diff --git a/src/main/java/ellpeck/actuallyadditions/nei/NEIActuallyAdditionsConfig.java b/src/main/java/ellpeck/actuallyadditions/nei/NEIActuallyAdditionsConfig.java index fe200806e..9f4fdd279 100644 --- a/src/main/java/ellpeck/actuallyadditions/nei/NEIActuallyAdditionsConfig.java +++ b/src/main/java/ellpeck/actuallyadditions/nei/NEIActuallyAdditionsConfig.java @@ -22,6 +22,10 @@ public class NEIActuallyAdditionsConfig implements IConfigureNEI{ API.registerRecipeHandler(crusherRecipeHandler); API.registerUsageHandler(crusherRecipeHandler); + CrusherRecipeHandler.CrusherDoubleRecipeHandler crusherDoubleRecipeHandler = new CrusherRecipeHandler.CrusherDoubleRecipeHandler(); + API.registerRecipeHandler(crusherDoubleRecipeHandler); + API.registerUsageHandler(crusherDoubleRecipeHandler); + HairyBallRecipeHandler ballRecipeHandler = new HairyBallRecipeHandler(); API.registerRecipeHandler(ballRecipeHandler); API.registerUsageHandler(ballRecipeHandler); diff --git a/src/main/java/ellpeck/actuallyadditions/nei/TreasureChestRecipeHandler.java b/src/main/java/ellpeck/actuallyadditions/nei/TreasureChestRecipeHandler.java index e8c62f3a3..5734b4239 100644 --- a/src/main/java/ellpeck/actuallyadditions/nei/TreasureChestRecipeHandler.java +++ b/src/main/java/ellpeck/actuallyadditions/nei/TreasureChestRecipeHandler.java @@ -106,7 +106,7 @@ public class TreasureChestRecipeHandler extends TemplateRecipeHandler{ @Override public String getGuiTexture(){ - return ModUtil.MOD_ID_LOWER + ":textures/gui/guiNEITreasure.png"; + return ModUtil.MOD_ID_LOWER + ":textures/gui/GuiNEISimple.png"; } @Override diff --git a/src/main/resources/assets/actuallyadditions/lang/en_US.lang b/src/main/resources/assets/actuallyadditions/lang/en_US.lang index 783c2e04e..316844d7c 100644 --- a/src/main/resources/assets/actuallyadditions/lang/en_US.lang +++ b/src/main/resources/assets/actuallyadditions/lang/en_US.lang @@ -597,6 +597,7 @@ container.actuallyadditions.enervator.name=Enervator container.actuallyadditions.xpSolidifier.name=Experience Solidifier container.nei.actuallyadditions.crushing.name=Crusher +container.nei.actuallyadditions.crushingDouble.name=Double Crusher container.nei.actuallyadditions.ballOfHair.name=Ball Of Hair Usage container.nei.actuallyadditions.compost.name=Compost diff --git a/src/main/resources/assets/actuallyadditions/textures/gui/guiNEICoffeeMachine.png b/src/main/resources/assets/actuallyadditions/textures/gui/guiNEICoffeeMachine.png index 9316922cefbbf7b647cbc9805b1b752d7e3cc0d8..45b997d4a4fa9d1831856d05dbf7e801f91d9fbe 100644 GIT binary patch delta 1180 zcmcaCbV+DK2n*L*1_r*hjC}7K(kI8UsE6+Gba4!+hm!P z|L>ov?#QnHV5^X0iQjb}Sst&edu0`Kj)q@N*`aJd$w-w^V!5#zfCpR()!Od{lKCbQ$xT0+VjBls%nA_#&F{T$%eTebxV0+aqOU`oa~b zh5i)kt2@6^kMX_*bD88V!C%q;GxL8h`~OTKC?J+;(p{$Nd+dLBm1oc0xPh%ctXpBR z;0KpdPKjuT1rct{u99I#mb-qH`&ECsQ1FiagS~O0sT*fa?O$zW!+P)j{Y^DoJlq|^ z`=eSTuCBhR<@fJd&o!Qm$hP{2kteiQc^^n&ak)3W-eS=%79XzzQb2(dOe>OHbQ+5G z%W*F_&6mk|HhuqFUGj0Ds;god~_h=dSsS9XP1A z@npRtWB2Q4K|5~9ZV@*Uz91nX6j1xmal5mxL(1MSta;*GcYZ1_q;^;0BFZ>$k}sWO}hlS)TFfv&Dt_Vh+<~ ze{$TYD&8`E59^eV-gDbeh8%LbV5L z?EB}l0AneVX`dW0O0|Q;xD`@2GN4lRs9d`9>ajVBj;_$g2opi^4Eakt5%+dhchO=C5!TOgbBlF zI4#SzLPzkv#)2CQ?@hkN5?cRGJ28X%Z}zzcS3~X9ufA3u%wFYvpn~bp|6N-0vo}6n z6L;>^r^=syqV}G9F2yuU^1~PZ>;>zZ8?z$!+n$S$t2@70AfRR0www0Bf1~%Gee|GU z57)*ur=}NtsrD=7{BcZjgZKTu3-^EdSKl`OYtBBg>6OrgH)0ka>>lJx+gG9#nUsq{#UtLoZbM>L-hkyU3Jq=zE z?=a`bRjnhd;?9N@elkzrlIC#Q=nwaKr?|jaCN*V+Py7BH7QCvO5X5vXAePBZ%t2H+ ziE+yBuMrHfWggracE5Aych2XZn%1zZ;jd)~4Vm}eQE%69n2#P*gW@MuTO z*Ee@A9JJ$!D6Yu3pHSp$$jf-!tF z&}Y^eTmOwWHs-kY$E5NLaVLBoOfHyj`SqtcuYFd-iK>^}ckFCzTB;Sy88>cqX1Z0X zuty{OtW`nv?KyW8FS~Bo8*r?`atrAeD@dXoDV)+xnS@+ z|CW6&>$lr~cQRQ>DI_$%EmPm4ToT2={@>lA3R=y-zUXh>?ZR*Gr_ZzQ&~kes#Mr&)XVz^_od!MYPl5q?Hj@0w zj3qZG_BWjU?$&-X+Cg&vmC89etY>aLdi?!&|D?4I8<<%9zRmxr8*t3B;1l18D&7j2 z3-#BS*fw5$H^rWJ9%KFd#A`CuGVlKE`_AH%X8(Yv>e+|HZS3hr%o_WWcQE{v+@P=U zTXMqVz6+5|Y>uFq3^C&1Uhtle`@x~3z=(@rn96gA>Ba8DOgjn;LkyL~98{Y(F#LKK zAY5>5{&9Aoj-qJ|>)U~D@0xOy$sglPsrke1xifsv T3+a2y8Gyjk)z4*}Q$iB}2A3I~ diff --git a/src/main/resources/assets/actuallyadditions/textures/gui/guiNEIHairyBall.png b/src/main/resources/assets/actuallyadditions/textures/gui/guiNEIHairyBall.png deleted file mode 100644 index 8f0ac2bc8967ab800ec60aaff69273bbdae9f620..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1786 zcmeAS@N?(olHy`uVBq!ia0y~yU<5K58911MRQ8&P5Fo{p?&#~tz_78O`%fY(0|PTd zfKP}kP~6Kav4M@OO4qV9awC zctjR6F!1dHVMfvYW|x415+$w?CBgY=CFO}lsSE{)nRz98d8s7|CVB>Xrm3w)sSFHE z37#&FAr*0NuiW)Yb`)U??A`ZY`}lsNS;Ydb88=F(dnS#$Kav4M@OO4qV9awC zctjR6F!1dHVMfvYW|x415+$w?CBgY=CFO}lsSE{)nRz98d8s7|CVB>Xrm3w)sSFHE z37#&FAr*0NuiW)Yb`)U??A`ZY`}lsNS;Ydb88=F(dnS#$