示例#1
0
  @Override
  public void sendMetaData(Player player, FakeEntity entity) {
    DataWatcher watcher = new DataWatcher(getHandle(entity.getEntity()));
    watcher.a(5, 32);
    watcher.a(6, entity.getHealth());
    watcher.a(7, Integer.valueOf(0));
    watcher.a(8, (byte) 0);
    watcher.a(10, entity.getName());
    watcher.a(11, (byte) 1);

    PacketPlayOutEntityMetadata packet =
        new PacketPlayOutEntityMetadata(entity.getId(), watcher, true);
    sendPacket(player, packet);
  }
示例#2
0
  @Override
  public void sendDestroyPacket(Player player, FakeEntity entity) {
    PacketPlayOutEntityDestroy packet = new PacketPlayOutEntityDestroy();
    try {
      Field a = packet.getClass().getDeclaredField("a");
      a.setAccessible(true);

      a.set(packet, new int[] {entity.getId()});
      sendPacket(player, packet);
    } catch (Exception e) {
    }
  }
示例#3
0
 @Override
 public void sendTeleport(Player player, FakeEntity entity) {
   Location loc = TopBar.transform(player.getLocation());
   PacketPlayOutEntityTeleport packet =
       new PacketPlayOutEntityTeleport(
           entity.getId(),
           loc.getBlockX() * 32,
           loc.getBlockY() * 32,
           loc.getBlockZ() * 32,
           Byte.valueOf((byte) ((int) loc.getYaw() * 256 / 360)),
           Byte.valueOf((byte) ((int) loc.getPitch() * 256 / 360)),
           false);
   sendPacket(player, packet);
 }
示例#4
0
 @Override
 public void sendSpawnPacket(Player player, FakeEntity fakeEntity) {
   EntityEnderDragon dragon = new EntityEnderDragon(getHandle(fakeEntity.getWorld()));
   dragon.setLocation(
       fakeEntity.getX(),
       fakeEntity.getY(),
       fakeEntity.getZ(),
       fakeEntity.getPitch(),
       fakeEntity.getYaw());
   dragon.setInvisible(true);
   dragon.setCustomName(fakeEntity.getName());
   dragon.setHealth(fakeEntity.getHealth());
   dragon.motX = fakeEntity.getMotX();
   dragon.motY = fakeEntity.getMotY();
   dragon.motZ = fakeEntity.getMotZ();
   fakeEntity.setId(dragon.getId());
   fakeEntity.setEntity(dragon.getBukkitEntity());
   PacketPlayOutSpawnEntityLiving packet = new PacketPlayOutSpawnEntityLiving(dragon);
   sendPacket(player, packet);
   return;
 }