use of powercrystals.minefactoryreloaded.core.ITankContainerBucketable in project MineFactoryReloaded by powercrystals.
the class BlockFactoryMachine method onBlockActivated.
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityplayer, int side, float xOffset, float yOffset, float zOffset) {
PlayerInteractEvent e = new PlayerInteractEvent(entityplayer, Action.RIGHT_CLICK_BLOCK, x, y, z, side);
if (MinecraftForge.EVENT_BUS.post(e) || e.getResult() == Result.DENY || e.useBlock == Result.DENY) {
return false;
}
TileEntity te = world.getBlockTileEntity(x, y, z);
if (te == null) {
return false;
}
if (te instanceof ITankContainerBucketable && LiquidContainerRegistry.isEmptyContainer(entityplayer.inventory.getCurrentItem()) && ((ITankContainerBucketable) te).allowBucketDrain()) {
if (MFRLiquidMover.manuallyDrainTank((ITankContainerBucketable) te, entityplayer)) {
return true;
}
} else if (te instanceof ITankContainerBucketable && LiquidContainerRegistry.isFilledContainer(entityplayer.inventory.getCurrentItem()) && ((ITankContainerBucketable) te).allowBucketFill()) {
if (MFRLiquidMover.manuallyFillTank((ITankContainerBucketable) te, entityplayer)) {
return true;
}
}
if (MFRUtil.isHoldingHammer(entityplayer) && te instanceof TileEntityFactory && ((TileEntityFactory) te).canRotate()) {
((TileEntityFactory) te).rotate();
world.markBlockForUpdate(x, y, z);
return true;
} else if (te instanceof TileEntityFactory && ((TileEntityFactory) te).getContainer(entityplayer.inventory) != null) {
if (!world.isRemote) {
entityplayer.openGui(MineFactoryReloadedCore.instance(), 0, world, x, y, z);
}
return true;
}
return false;
}
Aggregations