Beispiel #1
0
 @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);
   }
 }
Beispiel #2
0
 @Override
 public BlockFace getAttachedFace(short data) {
   return BlockFaces.WESN.get(data - 2);
 }
Beispiel #3
0
 @Override
 public BlockFace getAttachedFace(Block block) {
   return BlockFaces.WESN.get(block.getData() & ~0x4);
 }
Beispiel #4
0
 @Override
 public void setAttachedFace(Block block, BlockFace attachedFace) {
   block.setData((short) BlockFaces.WESN.indexOf(attachedFace, 0));
 }