
Handles the interaction the right-clicking with a fluid item (like a bucket) onto a block at a position at X Y Z.
The Code first tries to insert the content of the fluid item into the tank, if this fails the code will try to take an, to the fluid item specific, amount of fluid from the tank and put it into the fluid item.
Example: Right-clicking with a water bucket onto a block with a fluid tank, the bucket will be emptied and the water will be put into the tank. When right-clicking again, the bucket gets filled with water again and the tank of the block loses 1000mB of water.
Note: This does not work with bucket created by MCreator, since MCreator handles fluid differently. Items that have an MCreator fluid stored will work when right-clicking.
new Object() { public boolean interactFluidHandler(LevelAccessor level, Entity entity, BlocksPos pos, InteractionHand hand) { if (entity instanceof Player player) { if (level instanceof ILevelExtension _ext) { IFluidHandler _fluidhandler = _ext.getCapability(Capabilities.FluidHandler.BLOCK, pos, null); if (_fluidhandler != null) { return FluidUtil.interactWithFluidHandler(player, hand, _fluidhandler); } return false; } return false; } return false; } }.interactFluidHandler(world, ${input$entity}, BlockPos.containing(${input$x},${input$y},${input$z}), InteractionHand.${field$hand})
${input$x} = X-Position of the Block
${input$y} = Y-Position of the Block
${input$z} = Z-Position of the Block
${input$entity} = The Player right-clicking on a block
${field$hand} = Which Hand to check when right-clicked (MAIN_HAND, OFF_HAND)
Return Boolean
