Posted July 18, 201312 yr http://pastebin.com/jB1xJe1W is the code in question. What I want to happen, is depending on the blocks rotation, it should place extra "gag blocks" to fill out some gaps. And, for meta 0, this works brilliantly: However, when I try and place in another direction, I want the blocks to obviously be placed in the correct direction again. But, the extra blocks always go to the same place, like so: Probably some sort of really simple mistake, but can anyone point me in the right direction? Sorry for posting something so trivial, but noone on IRC could help http://s13.postimg.org/z9mlly2av/siglogo.png[/img] My mods (Links coming soon) Cities | Roads | Remula | SilvaniaMod | MoreStats
July 18, 201312 yr It appears to me that you are checking the block metadata as soon as it is placed, then setting the rotation from the players look vector. As the metadata is 0 when you place it, and you use the metadata from when it is placed, this will always be 0. try this instead: @Override public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entityliving, ItemStack itemStack) { int meta = world.getBlockMetadata(x, y, z); int blockSet = meta / 4; int direction = MathHelper.floor_double((double)(entityliving.rotationYaw * 4.0F / 360.0F) + 2.5D) & 3; int newMeta = (blockSet * 4) + direction; world.setBlockMetadataWithNotify(x, y, z, newMeta, 0); if (newMeta == 0) { world.setBlock(x + 1, y, z, Roads.blockGag1.blockID); world.setBlock(x + 2, y, z, Roads.blockGag2.blockID); world.setBlock(x + 3, y, z, Roads.blockGag3.blockID); } else if (newMeta == 1) { world.setBlock(x - 1, y, z, Roads.blockGag1.blockID); world.setBlock(x - 2, y, z, Roads.blockGag2.blockID); world.setBlock(x - 3, y, z, Roads.blockGag3.blockID); } else if (newMeta == 2) { world.setBlock(x, y, z + 1, Roads.blockGag1.blockID); world.setBlock(x, y, z + 2, Roads.blockGag2.blockID); world.setBlock(x, y, z + 3, Roads.blockGag3.blockID); } else if (newMeta == 3) { world.setBlock(x, y, z - 1, Roads.blockGag1.blockID); world.setBlock(x, y, z - 2, Roads.blockGag2.blockID); world.setBlock(x, y, z - 3, Roads.blockGag3.blockID); } } no promise but worth a shot. github
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.