@Override public void setAttachedFace(Block block, BlockFace attachedFace, Cause<?> cause) { if (attachedFace == BlockFace.BOTTOM) { short data = 0; if (cause instanceof EntityCause) { Entity entity = ((EntityCause) cause).getSource(); float yaw = entity.getTransform().getYaw() * -1.0f; float rotation = (yaw + 180F) * 16F / 360F; data = (short) (rotation + 0.5F); data &= 15; } block.setMaterial(VanillaMaterials.SIGN_POST, data, cause); } else { // get the data for this face short data = (short) (BlockFaces.WESN.indexOf(attachedFace, 0) + 2); block.setMaterial(VanillaMaterials.WALL_SIGN, data, cause); } }
@Override public BlockFace getAttachedFace(short data) { return BlockFaces.WESN.get(data - 2); }
@Override public BlockFace getAttachedFace(Block block) { return BlockFaces.WESN.get(block.getData() & ~0x4); }
@Override public void setAttachedFace(Block block, BlockFace attachedFace) { block.setData((short) BlockFaces.WESN.indexOf(attachedFace, 0)); }