Posted May 25, 201510 yr Hi there! Back after a long hiatus for school! Anyways, on to the point. I am trying to have my block check each of the 8 spots around it (each diagonal and adjacent) for a lava block. My problem is flowing_lava is being treated the same as lava when I do my check. Block lava = Blocks.lava; // Check 8 sides around block and return if all are lava if(world.getBlock(x + 1, y, z).equals(lava) && world.getBlock(x - 1, y, z).equals(lava) && world.getBlock(x, y, z + 1).equals(lava) && world.getBlock(x, y, z - 1).equals(lava) && world.getBlock(x + 1, y, z + 1).equals(lava) && world.getBlock(x + 1, y, z - 1).equals(lava) && world.getBlock(x - 1, y, z + 1).equals(lava) && world.getBlock(x - 1, y, z - 1).equals(lava)) return true; I know there is a different block for each in the code currently but for some reason if I place a lava source block at two opposite corners and let the lava flow in the remaining 2 slots, the updateTick sees the setup as valid when it should not. Any ideas?
May 25, 201510 yr Maybe that's because (if I remember correctly) flowing lava is not a separate type of block rather another damage value.
May 25, 201510 yr Maybe that's because (if I remember correctly) flowing lava is not a separate type of block rather another damage value. Right. It is the same block, but with different metadata. Here is an explanation of how the metadata values (or block state in 1.8 ) work. http://minecraft.gamepedia.com/Lava#Data_values Note also what it says about how the blocks are mostly set as stationary even if they are in a position to flow -- the flowing is only set temporarily during block updates. Check out my tutorials here: http://jabelarminecraft.blogspot.com/
May 25, 201510 yr Maybe that's because (if I remember correctly) flowing lava is not a separate type of block rather another damage value. Yes that is correct, All liquids have multiple damage values I think 0 is idle (not flowing), 1 and on is like the different heights and directions and all that
May 25, 201510 yr So then, using that information, to fix this problem you would have to also check to see if the metadata is 0, as well as that the block is lava.
May 25, 201510 yr Author @Awesome_Spider @Jabelar @tiffit After 5-6 different tries of things (was looking at Blocks.getDamageValue(World, int, int, int) for help, didn't work) I finally got it. This would have gone a LOT faster if the darn tickUpdate wasn't so slow. I'll post the new, working code (removed that big ugly if structure and replaced it with some fancy for loops and a smaller if). Thanks so much everybody! Block lava = Blocks.lava; for(int i = -1; i <= 1; i++) for(int j = -1; j <= 1; j++) if(i != 0 & j != 0) if(!world.getBlock(x + i, y, z + j).equals(lava) || world.getBlockMetadata(x + i, y, z + j) != 0) return false; return true;
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.