@Override public boolean onBlockActivatedDelegate(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) { TileDynamoBase tile = (TileDynamoBase) world.getTileEntity(pos); if (tile == null || !tile.canPlayerAccess(player)) { return false; } if (tile.hasCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, null)) { ItemStack heldItem = player.getHeldItem(hand); IFluidHandler handler = tile.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, null); if (FluidHelper.isFluidHandler(heldItem)) { FluidHelper.interactWithHandler(heldItem, handler, player, hand); return true; } } return false; }
@Override public boolean onBlockActivatedDelegate(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) { TileMachineBase tile = (TileMachineBase) world.getTileEntity(pos); if (tile == null || !tile.canPlayerAccess(player)) { return false; } if (tile.hasCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, null)) { ItemStack heldItem = player.getHeldItem(hand); IFluidHandler handler = tile.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, null); if (FluidHelper.isFluidHandler(heldItem)) { FluidHelper.interactWithHandler(heldItem, handler, player, hand); return true; } } return false; }
@Override public boolean onBlockActivatedDelegate(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) { TileDeviceBase tile = (TileDeviceBase) world.getTileEntity(pos); if (tile == null || !tile.canPlayerAccess(player)) { return false; } if (ItemHelper.isPlayerHoldingNothing(player)) { if (player.isSneaking() && tile.hasConfigGui() && ServerHelper.isServerWorld(world)) { return tile.openConfigGui(player); } } if (tile.hasCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, null)) { ItemStack heldItem = player.getHeldItem(hand); IFluidHandler handler = tile.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, null); if (FluidHelper.isFluidHandler(heldItem)) { FluidHelper.interactWithHandler(heldItem, handler, player, hand); return true; } } return false; }
@Override public boolean onBlockActivatedDelegate(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) { TileTank tile = (TileTank) world.getTileEntity(pos); if (tile == null || !tile.canPlayerAccess(player)) { return false; } if (ItemHelper.isPlayerHoldingNothing(player)) { if (player.isSneaking()) { tile.setLocked(!tile.isLocked()); if (tile.isLocked()) { world.playSound(null, pos, SoundEvents.UI_BUTTON_CLICK, SoundCategory.BLOCKS, 0.2F, 0.8F); } else { world.playSound(null, pos, SoundEvents.UI_BUTTON_CLICK, SoundCategory.BLOCKS, 0.3F, 0.5F); } return true; } } ItemStack heldItem = player.getHeldItem(hand); IFluidHandler handler = tile.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, null); if (FluidHelper.isFluidHandler(heldItem)) { FluidHelper.interactWithHandler(heldItem, handler, player, hand); return true; } return false; }