Posted December 3, 20186 yr My tileentity have two fluid tank and i want fill one of tanks when right click this block with fluid bucket. But when i test my tileentity, the sever side(when world.isRemote == flase)tank always null when block actived, client side working properly @Override public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { ItemStack itemHeld = playerIn.getHeldItem(hand); IFluidHandlerItem handlerItem = FluidUtil.getFluidHandler(itemHeld); if (handlerItem != null) { TileEntityPurifier purifier = (TileEntityPurifier) worldIn.getTileEntity(pos);// BreakPoint 1 in this line server side tileentity's tank always empty IItemHandler iItemHandler = new InvWrapper(playerIn.inventory); FluidActionResult emptyResult = FluidUtil.tryEmptyContainerAndStow(itemHeld, purifier.tank, iItemHandler, purifier.tank.getCapacity(), playerIn, true);//I break this line , idea show me fluid has filled into tileentity, both side fluid amoount changed if (emptyResult.isSuccess()) { playerIn.setHeldItem(hand, emptyResult.getResult()); worldIn.markChunkDirty(pos, purifier); return true; } FluidActionResult fillResultOut = FluidUtil.tryFillContainerAndStow(itemHeld, purifier.outputTank, iItemHandler, purifier.outputTank.getFluidAmount(), playerIn, true); if (fillResultOut.isSuccess()) { playerIn.setHeldItem(hand, fillResultOut.getResult()); worldIn.markChunkDirty(pos, purifier); return true; } FluidActionResult fillResult = FluidUtil.tryFillContainerAndStow(itemHeld, purifier.outputTank, iItemHandler, purifier.tank.getFluidAmount(), playerIn, true); if (fillResult.isSuccess()) { playerIn.setHeldItem(hand, fillResult.getResult()); worldIn.markChunkDirty(pos, purifier); return true; } } else { BrewingCraft.openGui(playerIn, getGui(), worldIn, pos.getX(), pos.getY(), pos.getZ()); return true; } return false; } any idea to fix this?
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.