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);
|
super.drawGuiContainerBackgroundLayer(f, mouseX, mouseY);
|
||||||
final Layer layer = Layer.BACKGROUND;
|
final Layer layer = Layer.BACKGROUND;
|
||||||
|
|
||||||
|
// Battery slot
|
||||||
this.drawSlot(8, 72, layer);
|
this.drawSlot(8, 72, layer);
|
||||||
|
// Liquid input slot
|
||||||
this.drawSlot(34, 35, layer);
|
this.drawSlot(34, 35, layer);
|
||||||
|
// Liquid output slot
|
||||||
this.drawSlot(34, 55, layer);
|
this.drawSlot(34, 55, layer);
|
||||||
|
// Solid material input slot
|
||||||
this.drawSlot(84, 43, layer);
|
this.drawSlot(84, 43, layer);
|
||||||
|
// Output slots
|
||||||
this.drawSlot(126, 18, layer);
|
this.drawSlot(126, 18, layer);
|
||||||
this.drawSlot(126, 36, layer);
|
this.drawSlot(126, 36, layer);
|
||||||
this.drawSlot(126, 54, layer);
|
this.drawSlot(126, 54, layer);
|
||||||
|
@ -149,8 +153,6 @@ public class GuiIndustrialGrinder extends GuiBase {
|
||||||
final MultiblockSet set = new MultiblockSet(multiblock);
|
final MultiblockSet set = new MultiblockSet(multiblock);
|
||||||
ClientProxy.multiblockRenderEvent.setMultiblock(set);
|
ClientProxy.multiblockRenderEvent.setMultiblock(set);
|
||||||
ClientProxy.multiblockRenderEvent.parent = this.tile.getPos();
|
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(
|
MultiblockRenderEvent.anchor = new BlockPos(
|
||||||
this.tile.getPos().getX()
|
this.tile.getPos().getX()
|
||||||
- EnumFacing.getFront(this.tile.getFacingInt()).getFrontOffsetX() * 2,
|
- EnumFacing.getFront(this.tile.getFacingInt()).getFrontOffsetX() * 2,
|
||||||
|
|
|
@ -99,7 +99,8 @@ public class TileIndustrialGrinder extends TilePowerAcceptor implements IToolDro
|
||||||
final boolean blade = this.multiblockChecker.checkRingY(1, 1, MultiblockChecker.REINFORCED_CASING,
|
final boolean blade = this.multiblockChecker.checkRingY(1, 1, MultiblockChecker.REINFORCED_CASING,
|
||||||
new BlockPos(0, 1, 0));
|
new BlockPos(0, 1, 0));
|
||||||
final IBlockState centerBlock = this.multiblockChecker.getBlock(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;
|
return down && center && blade && up;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -141,16 +142,6 @@ public class TileIndustrialGrinder extends TilePowerAcceptor implements IToolDro
|
||||||
return tagCompound;
|
return tagCompound;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void invalidate() {
|
|
||||||
super.invalidate();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onChunkUnload() {
|
|
||||||
super.onChunkUnload();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasCapability(final Capability<?> capability, final EnumFacing facing) {
|
public boolean hasCapability(final Capability<?> capability, final EnumFacing facing) {
|
||||||
if (capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY) {
|
if (capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY) {
|
||||||
|
@ -181,6 +172,19 @@ public class TileIndustrialGrinder extends TilePowerAcceptor implements IToolDro
|
||||||
return this.isItemValidForSlot(slotIndex, itemStack);
|
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
|
@Override
|
||||||
public boolean canExtractItem(final int slotIndex, final ItemStack itemStack, final EnumFacing side) {
|
public boolean canExtractItem(final int slotIndex, final ItemStack itemStack, final EnumFacing side) {
|
||||||
return slotIndex == 2 || slotIndex == 3 || slotIndex == 4 || slotIndex == 5 || slotIndex == 6;
|
return slotIndex == 2 || slotIndex == 3 || slotIndex == 4 || slotIndex == 5 || slotIndex == 6;
|
||||||
|
@ -276,8 +280,9 @@ public class TileIndustrialGrinder extends TilePowerAcceptor implements IToolDro
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||||
|
// fluidSlot first to support automation and shift-click
|
||||||
return new ContainerBuilder("industrialgrinder").player(player.inventory).inventory().hotbar().addInventory()
|
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)
|
.outputSlot(4, 126, 54).outputSlot(5, 126, 72).outputSlot(6, 34, 55).energySlot(7, 8, 72)
|
||||||
.syncEnergyValue().syncCrafterValue().addInventory().create(this);
|
.syncEnergyValue().syncCrafterValue().addInventory().create(this);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue