Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.