Some minor fixes to the auto crafting table
This commit is contained in:
parent
ba99f70406
commit
bee8d4aab0
1 changed files with 40 additions and 33 deletions
|
@ -121,7 +121,7 @@ public class TileAutoCraftingTable extends TilePowerAcceptor implements IContain
|
|||
return true;
|
||||
}
|
||||
if (ItemUtils.isItemEqual(stack, output, true, true)) {
|
||||
if (stack.getMaxStackSize() < stack.getCount() + output.getCount()) {
|
||||
if (stack.getMaxStackSize() > stack.getCount() + output.getCount()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -130,15 +130,22 @@ public class TileAutoCraftingTable extends TilePowerAcceptor implements IContain
|
|||
|
||||
public boolean make(IRecipe recipe) {
|
||||
if (canMake(recipe)) {
|
||||
for (Ingredient ingredient : recipe.getIngredients()) {
|
||||
for (int i = 0; i < 9; i++) {
|
||||
ItemStack stack = inventory.getStackInSlot(i);
|
||||
for (int i = 0; i < recipe.getIngredients().size(); i++) {
|
||||
Ingredient ingredient = recipe.getIngredients().get(i);
|
||||
//Looks for the best slot to take it from
|
||||
ItemStack bestSlot = inventory.getStackInSlot(i);
|
||||
if (ingredient.apply(bestSlot)) {
|
||||
bestSlot.shrink(1);
|
||||
} else {
|
||||
for (int j = 0; j < 9; j++) {
|
||||
ItemStack stack = inventory.getStackInSlot(j);
|
||||
if (ingredient.apply(stack)) {
|
||||
stack.shrink(1); //TODO is this right? or do I need to use it as an actull crafting grid
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
ItemStack output = inventory.getStackInSlot(9);
|
||||
if (output.isEmpty()) {
|
||||
inventory.setInventorySlotContents(9, recipe.getRecipeOutput().copy());
|
||||
|
@ -196,7 +203,7 @@ public class TileAutoCraftingTable extends TilePowerAcceptor implements IContain
|
|||
.slot(0, 28, 25).slot(1, 46, 25).slot(2, 64, 25)
|
||||
.slot(3, 28, 43).slot(4, 46, 43).slot(5, 64, 43)
|
||||
.slot(6, 28, 61).slot(7, 46, 61).slot(8, 64, 61)
|
||||
.outputSlot(9, 145, 42)
|
||||
.outputSlot(9, 145, 42).syncEnergyValue()
|
||||
.syncIntegerValue(this::getProgress, this::setProgress)
|
||||
.syncIntegerValue(this::getMaxProgress, this::setMaxProgress)
|
||||
.addInventory().create();
|
||||
|
|
Loading…
Reference in a new issue