Fix automation for IndustrialGrinder and IndustrialElectrolyzer, closes #953

This commit is contained in:
Ourten 2017-02-03 16:57:34 +01:00
parent e0300d3a05
commit 9847719a91
2 changed files with 13 additions and 7 deletions

View file

@ -13,12 +13,14 @@ import reborncore.common.IWrenchable;
import reborncore.common.powerSystem.TilePowerAcceptor;
import reborncore.common.recipes.RecipeCrafter;
import reborncore.common.util.Inventory;
import reborncore.common.util.ItemUtils;
import techreborn.api.Reference;
import techreborn.client.container.IContainerProvider;
import techreborn.client.container.builder.BuiltContainer;
import techreborn.client.container.builder.ContainerBuilder;
import techreborn.init.ModBlocks;
import techreborn.items.DynamicCell;
public class TileIndustrialElectrolyzer extends TilePowerAcceptor
implements IWrenchable, IInventoryProvider, ISidedInventory, IRecipeCrafterProvider, IContainerProvider {
@ -107,10 +109,12 @@ public class TileIndustrialElectrolyzer extends TilePowerAcceptor
}
@Override
public boolean canInsertItem(final int slotIndex, final ItemStack itemStack, final EnumFacing side) {
if (slotIndex >= 1)
public boolean canInsertItem(final int slotIndex, final ItemStack stack, final EnumFacing side) {
if (slotIndex > 1)
return false;
return this.isItemValidForSlot(slotIndex, itemStack);
if(slotIndex == 1)
return ItemUtils.isItemEqual(stack, DynamicCell.getEmptyCell(1), true, true);
return !ItemUtils.isItemEqual(stack, DynamicCell.getEmptyCell(1), true, true);
}
@Override
@ -168,8 +172,10 @@ public class TileIndustrialElectrolyzer extends TilePowerAcceptor
@Override
public BuiltContainer createContainer(final EntityPlayer player) {
return new ContainerBuilder("industrialelectrolyzer").player(player.inventory).inventory(8, 84).hotbar(8, 142)
.addInventory().tile(this).slot(0, 80, 51).slot(1, 50, 51).outputSlot(2, 50, 19).outputSlot(3, 70, 19)
.outputSlot(4, 90, 19).outputSlot(5, 110, 19).energySlot(6, 18, 51).syncEnergyValue().syncCrafterValue()
.addInventory().create();
.addInventory().tile(this)
.filterSlot(1, 50, 51, stack -> ItemUtils.isItemEqual(stack, DynamicCell.getEmptyCell(1), true, true))
.filterSlot(0, 80, 51, stack -> !ItemUtils.isItemEqual(stack, DynamicCell.getEmptyCell(1), true, true))
.outputSlot(2, 50, 19).outputSlot(3, 70, 19).outputSlot(4, 90, 19).outputSlot(5, 110, 19)
.energySlot(6, 18, 51).syncEnergyValue().syncCrafterValue().addInventory().create();
}
}

View file

@ -150,7 +150,7 @@ public class TileIndustrialGrinder extends TilePowerAcceptor implements IWrencha
// ISidedInventory
@Override
public int[] getSlotsForFace(final EnumFacing side) {
return side == EnumFacing.DOWN ? new int[] { 0, 1, 2, 3, 4, 5 } : new int[] { 0, 1, 2, 3, 4, 5 };
return new int[] { 0, 1, 2, 3, 4, 5, 6 };
}
@Override