Jump to content

Recommended Posts

Posted

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 ?

Posted

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.

Posted

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.

Posted

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.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...