fabricator77 Posted May 8, 2012 Posted May 8, 2012 I have some code with this line in it. int k = par1World.getTopSolidOrLiquidBlock(i, j) - 1; k is the height of the block involved. Problem is it lies, and returns to the top solid block completely ignoring water, ice etc. So what I want is the code to detect what blockID is above the dirt/sand/grass etc, and if its not air (water, ice etc) then use different code. I tried using getBlockIdAtCurrentPosition, but no matter what I've tried it just won't return any value except 0 (air). Anyone used this function and know how it works ? Is there a better way to code this ?
jakj Posted May 9, 2012 Posted May 9, 2012 Can you explain what's going on in better detail? Are you saying that, if you have a water block above a dirt block, it tells you the top block is the dirt block? If so, you could just start at that block and do getBlockId for each block above it until you reach the top of the world or get an air block.
fabricator77 Posted May 9, 2012 Author Posted May 9, 2012 Are you saying that, if you have a water block above a dirt block, it tells you the top block is the dirt block? If so, you could just start at that block and do getBlockId for each block above it until you reach the top of the world or get an air block. That is precisely what it is doing, and what solution I need. I tried many times but I could not get the undocumented functions in MC to move to the block above. It should be simple but I don't know which of the parameters are x,y,z in the call to getBlockIdAtCurrentPosition.
jakj Posted May 9, 2012 Posted May 9, 2012 There are quite a few functions in MC you will find like that, half-vestigal. Notch will partly get a function working but stop, and then just use what he wrote of it for another purpose entirely. He also likes to create status variables that are updated but never used. If a function doesn't do what you want, you just have to give up and write your own.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now