Posted July 10, 201411 yr Is there a way to detect which blocks were placed by a player and which were naturally generated? I am trying to make a autobuilder, and I don't want it to overwrite anyone's blocks.
July 10, 201411 yr As diesieben said you can't do this however simply check if it's Blocks.air before you set the block or check if everythings air before it sets any block at all. If I helped please press the Thank You button.
July 11, 201411 yr Hi >How does minecraft do it (leaf blocks)? Not sure what you mean? Leaf blocks don't overwrite existing blocks, only empty space. If you just want your autobuild to overwrite air only, it's easy. Get the block using world.getBlock, check block.isAirBlock(x,y,z), and only overwrite if it's air. If you want your autobuild to overwrite (eg) naturally generated stone, but not stone placed by a player, then that is possible but very complicated (and almost certainly not worth the trouble) -TGG
July 11, 201411 yr I am not sure what leaves do to differentiate between having been placed by a player, and having been spawned by a tree, but it seems like something akin to using a single bit of metadata - the third least significant bit, in this case. While you can of course not use this for blocks that have directions, etc., perhaps this can be of use when determining whether, say, dirt or stone was placed by a player. There would be several ways to go about this, I presume - but relying on metadata in blocks that don't expect metadata is just asking for trouble.
July 11, 201411 yr If you mean leaves disappear when placed by a player when you say what you said, then try sticking a wood block next to those leaves. If that isn't what you meant... * shrugs * learn how to use ASM and add a flag to blocks as to whether or not they were placed by a player. As TGG said, a lot of hassle and not really worth it. We all stuff up sometimes... But I seem to be at the bottom of that pot.
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.