Esempio n. 1
0
 public void setBlockMaterial(int xx, int yy, int zz, BlockMaterial material, short data) {
   final Vector3 transformed = transform(xx, yy, zz);
   position
       .getWorld()
       .setBlockMaterial(
           transformed.getFloorX(),
           transformed.getFloorY(),
           transformed.getFloorZ(),
           material,
           data,
           null);
   if (material instanceof Directional) {
     final Directional directional = (Directional) material;
     final Block block = position.getWorld().getBlock(transformed);
     final BlockFace face = directional.getFacing(block);
     if (face != BlockFace.BOTTOM && face != BlockFace.TOP) {
       directional.setFacing(
           block, BlockFace.fromYaw(face.getDirection().getYaw() + rotation.getYaw()));
     }
   } else if (material instanceof Attachable) {
     final Attachable attachable = (Attachable) material;
     final Block block = position.getWorld().getBlock(transformed);
     final BlockFace face = attachable.getAttachedFace(block);
     if (face != BlockFace.BOTTOM && face != BlockFace.TOP) {
       attachable.setAttachedFace(
           block, BlockFace.fromYaw(face.getDirection().getYaw() + rotation.getYaw()), null);
     }
   }
 }
Esempio n. 2
0
 public void placeDoor(int xx, int yy, int zz, DoorBlock door, BlockFace facing) {
   final Block bottom = getBlock(xx, yy, zz);
   door.create(
       getBlock(xx, yy, zz),
       bottom.translate(BlockFace.TOP),
       BlockFace.fromYaw(facing.getDirection().getYaw() + rotation.getYaw()),
       false,
       false);
 }
 @Override
 protected void sendPosition(Point p, Quaternion rot) {
   // TODO: Implement Spout Protocol
   Session session = owner.getSession();
   if (p.distanceSquared(entity.getPosition()) >= 16) {
     EntityTeleportMessage ETMMsg =
         new EntityTeleportMessage(
             entity.getId(),
             (int) p.getX(),
             (int) p.getY(),
             (int) p.getZ(),
             (int) rot.getYaw(),
             (int) rot.getPitch());
     PlayerLookMessage PLMsg = new PlayerLookMessage(rot.getYaw(), rot.getPitch(), true);
     session.sendAll(false, ETMMsg, PLMsg);
   } else {
     PlayerPositionLookMessage PPLMsg =
         new PlayerPositionLookMessage(
             p.getX(), p.getY() + STANCE, p.getZ(), STANCE, rot.getYaw(), rot.getPitch(), true);
     session.send(false, PPLMsg);
   }
 }
 @Override
 protected void sendPosition(Point p, Quaternion rot) {
   PlayerPositionLookMessage PPLMsg =
       new PlayerPositionLookMessage(
           p.getX(),
           p.getY() + STANCE,
           p.getZ(),
           p.getY(),
           rot.getYaw(),
           rot.getPitch(),
           true,
           VanillaBlockDataChannelMessage.CHANNEL_ID,
           getRepositionManager());
   session.send(false, PPLMsg);
 }