Posted July 24, 20178 yr I'm trying to figure out how to get the density of a fluid block in the world. I'd like to check it something like this: world.getFluidDensity(pos) But that obviously doesn't work. Also I'm working with finite fluids if that matters What is the best way to get a fluid block's density? Edit: Is it also possible to change a fluid blocks density? Edited July 24, 20178 yr by Aidiah
July 24, 20178 yr Assuming the block is a subclass of BlockFluidBase, you can use BlockFluidBase.getDensity(IBlockAccess, BlockPos).
July 24, 20178 yr Author 4 minutes ago, Jay Avery said: Assuming the block is a subclass of BlockFluidBase, you can use BlockFluidBase.getDensity(IBlockAccess, BlockPos). Thanks, I was looking in the wrong places.
July 25, 20178 yr Author Having another issue with getting the density, fluid 1 has a density of -1000, and fluid 2 has a density of -1500. However: int density = BlockFluidBase.getDensity(world, pos); and int density2 = BlockFluidBase.getDensity(world, pos2); are both being set to -1000 any ideas why? Edit: Also if fluid1 is on top of fluid2, they seem to be acting as the same block? When fluid two calls to see what is on top of it the check returns the density of the block above fluid1. Edited July 25, 20178 yr by Aidiah
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.