Added filter for fluidSlot. Closes #1352
This commit is contained in:
parent
6e6a0c199c
commit
2f54305f6d
2 changed files with 26 additions and 19 deletions
|
@ -61,11 +61,15 @@ public class GuiIndustrialGrinder extends GuiBase {
|
|||
super.drawGuiContainerBackgroundLayer(f, mouseX, mouseY);
|
||||
final Layer layer = Layer.BACKGROUND;
|
||||
|
||||
// Battery slot
|
||||
this.drawSlot(8, 72, layer);
|
||||
|
||||
// Liquid input slot
|
||||
this.drawSlot(34, 35, layer);
|
||||
// Liquid output slot
|
||||
this.drawSlot(34, 55, layer);
|
||||
// Solid material input slot
|
||||
this.drawSlot(84, 43, layer);
|
||||
// Output slots
|
||||
this.drawSlot(126, 18, layer);
|
||||
this.drawSlot(126, 36, layer);
|
||||
this.drawSlot(126, 54, layer);
|
||||
|
@ -149,13 +153,11 @@ public class GuiIndustrialGrinder extends GuiBase {
|
|||
final MultiblockSet set = new MultiblockSet(multiblock);
|
||||
ClientProxy.multiblockRenderEvent.setMultiblock(set);
|
||||
ClientProxy.multiblockRenderEvent.parent = this.tile.getPos();
|
||||
//new Location(this.tile.getPos().getX(),
|
||||
//this.tile.getPos().getY(), this.tile.getPos().getZ(), this.tile.getWorld());
|
||||
MultiblockRenderEvent.anchor = new BlockPos(
|
||||
this.tile.getPos().getX()
|
||||
- EnumFacing.getFront(this.tile.getFacingInt()).getFrontOffsetX() * 2,
|
||||
this.tile.getPos().getY() - 1, this.tile.getPos().getZ()
|
||||
- EnumFacing.getFront(this.tile.getFacingInt()).getFrontOffsetZ() * 2);
|
||||
this.tile.getPos().getX()
|
||||
- EnumFacing.getFront(this.tile.getFacingInt()).getFrontOffsetX() * 2,
|
||||
this.tile.getPos().getY() - 1, this.tile.getPos().getZ()
|
||||
- EnumFacing.getFront(this.tile.getFacingInt()).getFrontOffsetZ() * 2);
|
||||
}
|
||||
} else {
|
||||
ClientProxy.multiblockRenderEvent.setMultiblock(null);
|
||||
|
|
|
@ -99,7 +99,8 @@ public class TileIndustrialGrinder extends TilePowerAcceptor implements IToolDro
|
|||
final boolean blade = this.multiblockChecker.checkRingY(1, 1, MultiblockChecker.REINFORCED_CASING,
|
||||
new BlockPos(0, 1, 0));
|
||||
final IBlockState centerBlock = this.multiblockChecker.getBlock(0, 1, 0);
|
||||
final boolean center = ((centerBlock.getBlock() instanceof BlockLiquid || centerBlock.getBlock() instanceof IFluidBlock) && centerBlock.getBlock().getMaterial(centerBlock) == Material.WATER);
|
||||
final boolean center = ((centerBlock.getBlock() instanceof BlockLiquid
|
||||
|| centerBlock.getBlock() instanceof IFluidBlock) && centerBlock.getMaterial() == Material.WATER);
|
||||
return down && center && blade && up;
|
||||
}
|
||||
|
||||
|
@ -141,16 +142,6 @@ public class TileIndustrialGrinder extends TilePowerAcceptor implements IToolDro
|
|||
return tagCompound;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invalidate() {
|
||||
super.invalidate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChunkUnload() {
|
||||
super.onChunkUnload();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCapability(final Capability<?> capability, final EnumFacing facing) {
|
||||
if (capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY) {
|
||||
|
@ -180,6 +171,19 @@ public class TileIndustrialGrinder extends TilePowerAcceptor implements IToolDro
|
|||
return false;
|
||||
return this.isItemValidForSlot(slotIndex, itemStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int slotIndex, ItemStack itemStack) {
|
||||
if (slotIndex == 1) {
|
||||
if (itemStack.hasCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null)){
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(final int slotIndex, final ItemStack itemStack, final EnumFacing side) {
|
||||
|
@ -276,8 +280,9 @@ public class TileIndustrialGrinder extends TilePowerAcceptor implements IToolDro
|
|||
|
||||
@Override
|
||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||
// fluidSlot first to support automation and shift-click
|
||||
return new ContainerBuilder("industrialgrinder").player(player.inventory).inventory().hotbar().addInventory()
|
||||
.tile(this).slot(1, 34, 35).slot(0, 84, 43).outputSlot(2, 126, 18).outputSlot(3, 126, 36)
|
||||
.tile(this).fluidSlot(1, 34, 35).slot(0, 84, 43).outputSlot(2, 126, 18).outputSlot(3, 126, 36)
|
||||
.outputSlot(4, 126, 54).outputSlot(5, 126, 72).outputSlot(6, 34, 55).energySlot(7, 8, 72)
|
||||
.syncEnergyValue().syncCrafterValue().addInventory().create(this);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue