Fixed Crusher Recipe NEI Handling Transfer Rects being off by adding a different Recipe Handler for that

This commit is contained in:
Ellpeck 2015-07-29 11:03:17 +02:00
parent e182ce87c7
commit 367d1b3385
13 changed files with 51 additions and 20 deletions

View file

@ -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:

View file

@ -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;

View file

@ -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);

View file

@ -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

View file

@ -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<? extends GuiContainer> 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<PositionedStack> 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<CrusherRecipeManualRegistry.CrusherRecipe> 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<CrusherRecipeManualRegistry.CrusherRecipe> 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");
}
}

View file

@ -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

View file

@ -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);

View file

@ -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

View file

@ -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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB