How do I make a certain block directional.
Java
- @Override
- public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entityLiving, ItemStack itemStack)
- {
- final int angle = MathHelper.floor_double(entityLiving.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
- int change = 0;
- switch (angle)
- {
- case 0:
- change = 3;
- break;
- case 1:
- change = 1;
- break;
- case 2:
- change = 2;
- break;
- case 3:
- change = 0;
- break;
- }
- world.setBlockMetadataWithNotify(x, y, z, change, 2);
- }
I tried with this code all i get is this: