Fix some small issues
This commit is contained in:
parent
6982342dc0
commit
944d2b7b5c
3 changed files with 20 additions and 15 deletions
|
@ -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
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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){
|
||||
|
|
Loading…
Reference in a new issue