Exemple #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);
   }
 }
Exemple #2
0
 /**
  * Checks if the given entity's position is contained within the region.
  *
  * @param entity
  * @return true, if the entity is contained within this Region, otherwise false.
  */
 public boolean contains(Entity entity) {
   return contains(entity.getTransform().getPosition());
 }