From 944d2b7b5cc881691a85159235880d0a19cc6267 Mon Sep 17 00:00:00 2001 From: modmuss50 Date: Wed, 21 Jun 2017 16:35:15 +0100 Subject: [PATCH] Fix some small issues --- .../client/gui/autocrafting/GuiAutoCrafting.java | 12 +++++++----- src/main/java/techreborn/init/ModBlocks.java | 8 +++----- .../techreborn/tiles/TileAutoCraftingTable.java | 15 ++++++++++----- 3 files changed, 20 insertions(+), 15 deletions(-) diff --git a/src/main/java/techreborn/client/gui/autocrafting/GuiAutoCrafting.java b/src/main/java/techreborn/client/gui/autocrafting/GuiAutoCrafting.java index 56e5b8bee..e2a8a3103 100644 --- a/src/main/java/techreborn/client/gui/autocrafting/GuiAutoCrafting.java +++ b/src/main/java/techreborn/client/gui/autocrafting/GuiAutoCrafting.java @@ -70,14 +70,11 @@ public class GuiAutoCrafting extends GuiBase { IRecipe recipe = tileAutoCraftingTable.getIRecipe(); if (recipe != null) { renderItemStack(recipe.getRecipeOutput(), 95, 42); - - int x = mouseX -= getGuiLeft(); - int y = mouseY -= getGuiTop(); - renderRecipe(recipe, 91, 66); } final Layer layer = Layer.FOREGROUND; this.builder.drawMultiEnergyBar(this, 9, 26, (int) this.tileAutoCraftingTable.getEnergy(), (int) this.tileAutoCraftingTable.getMaxPower(), mouseX, mouseY, 0, layer); this.builder.drawProgressBar(this, tileAutoCraftingTable.getProgress(), tileAutoCraftingTable.getMaxProgress(), 120, 44, mouseX, mouseY, TRBuilder.ProgressDirection.RIGHT, layer); + } //Based of vanilla code @@ -125,7 +122,7 @@ public class GuiAutoCrafting extends GuiBase { } @Override - protected void drawGuiContainerBackgroundLayer(final float f, final int mouseX, final int mouseY) { + protected void drawGuiContainerBackgroundLayer(final float f, int mouseX, int mouseY) { super.drawGuiContainerBackgroundLayer(f, mouseX, mouseY); final Layer layer = Layer.BACKGROUND; for (int i = 0; i < 3; i++) { @@ -136,6 +133,11 @@ public class GuiAutoCrafting extends GuiBase { drawOutputSlot(145, 42, layer); drawOutputSlot(95, 42, layer); drawString("Inventory", 8, 82, 4210752, layer); + + IRecipe recipe = tileAutoCraftingTable.getIRecipe(); + if (recipe != null) { + renderRecipe(recipe, guiLeft + 91, 66 + guiTop); + } } @Override diff --git a/src/main/java/techreborn/init/ModBlocks.java b/src/main/java/techreborn/init/ModBlocks.java index 09c436949..2e8ce5fd6 100644 --- a/src/main/java/techreborn/init/ModBlocks.java +++ b/src/main/java/techreborn/init/ModBlocks.java @@ -379,11 +379,9 @@ public class ModBlocks { registerBlock(HV_TRANSFORMER, "hv_transformer"); GameRegistry.registerTileEntity(TileHVTransformer.class, "TileHVTransformerTR"); - if(Core.DEV_FEATURES){ - AUTO_CRAFTING_TABLE = new BlockAutoCraftingTable(); - registerBlock(AUTO_CRAFTING_TABLE, "auto_crafting_table"); - GameRegistry.registerTileEntity(TileAutoCraftingTable.class, "TileAutoCraftingTableTR"); - } + AUTO_CRAFTING_TABLE = new BlockAutoCraftingTable(); + registerBlock(AUTO_CRAFTING_TABLE, "auto_crafting_table"); + GameRegistry.registerTileEntity(TileAutoCraftingTable.class, "TileAutoCraftingTableTR"); IRON_FURNACE = new BlockIronFurnace(); registerBlock(IRON_FURNACE, "iron_furnace"); diff --git a/src/main/java/techreborn/tiles/TileAutoCraftingTable.java b/src/main/java/techreborn/tiles/TileAutoCraftingTable.java index 0f589c15b..07ea17e50 100644 --- a/src/main/java/techreborn/tiles/TileAutoCraftingTable.java +++ b/src/main/java/techreborn/tiles/TileAutoCraftingTable.java @@ -59,7 +59,6 @@ public class TileAutoCraftingTable extends TilePowerAcceptor implements IContain IRecipe recipe = getIRecipe(); if (recipe != null) { if (progress >= maxProgress) { - //TODO make the thing if (make(recipe)) { progress = 0; } @@ -77,15 +76,21 @@ public class TileAutoCraftingTable extends TilePowerAcceptor implements IContain public boolean canMake(IRecipe recipe) { if (recipe.canFit(3, 3)) { boolean missingOutput = false; + int[] stacksInSlots = new int[9]; + for (int i = 0; i < 9; i++) { + stacksInSlots[i] = inventory.getStackInSlot(i).getCount(); + } for (Ingredient ingredient : recipe.getIngredients()) { if (ingredient != Ingredient.EMPTY) { boolean foundIngredient = false; for (int i = 0; i < 9; i++) { ItemStack stack = inventory.getStackInSlot(i); - //TODO count if items are used more than once, like 8 wooden planks for a chest - if (ingredient.apply(stack)) { - foundIngredient = true; - break; + if(stacksInSlots[i] > 0){ + if (ingredient.apply(stack)) { + foundIngredient = true; + stacksInSlots[i] --; + break; + } } } if(!foundIngredient){