use of com.cjm721.overloaded.block.tile.TileInfiniteWaterSource in project Overloaded by CJ-MC-Mods.
the class BlockInfiniteWaterSource method onBlockActivated.
@Override
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
if (!worldIn.isRemote && hand == EnumHand.MAIN_HAND) {
TileEntity te = worldIn.getTileEntity(pos);
if (te != null && te instanceof TileInfiniteWaterSource) {
IFluidHandler handler = te.getCapability(FLUID_HANDLER_CAPABILITY, facing);
// FluidUtil.interactWithFluidHandler(playerIn.getHeldItem(hand), te.getCapability(FLUID_HANDLER_CAPABILITY, facing), playerIn);
FluidActionResult result = FluidUtil.tryFillContainerAndStow(playerIn.getHeldItem(hand), handler, null, Integer.MAX_VALUE, playerIn);
if (result.isSuccess())
playerIn.setHeldItem(hand, result.getResult());
}
}
return true;
}
Aggregations