Exemplo n.º 1
0
  public void sendData(Player player, EntityMetadata data) {
    SetEntityDataPacket pk = new SetEntityDataPacket();
    pk.eid = player == this ? 0 : this.getId();
    pk.metadata = data == null ? this.dataProperties : data;

    player.dataPacket(pk);
  }
Exemplo n.º 2
0
 public void despawnFrom(Player player) {
   if (this.hasSpawned.containsKey(player.getLoaderId())) {
     RemoveEntityPacket pk = new RemoveEntityPacket();
     pk.eid = this.getId();
     player.dataPacket(pk);
     this.hasSpawned.remove(player.getLoaderId());
   }
 }
Exemplo n.º 3
0
  public void sendPotionEffects(Player player) {
    for (Effect effect : this.effects.values()) {
      MobEffectPacket pk = new MobEffectPacket();
      pk.eid = 0;
      pk.effectId = effect.getId();
      pk.amplifier = effect.getAmplifier();
      pk.particles = effect.isVisible();
      pk.duration = effect.getDuration();
      pk.eventId = MobEffectPacket.EVENT_ADD;

      player.dataPacket(pk);
    }
  }
Exemplo n.º 4
0
  @Override
  public void spawnTo(Player player) {
    AddEntityPacket pk = new AddEntityPacket();
    pk.eid = this.getId();
    pk.type = EntityBoat.NETWORK_ID;
    pk.x = (float) this.x;
    pk.y = (float) this.y;
    pk.z = (float) this.z;
    pk.speedX = 0;
    pk.speedY = 0;
    pk.speedZ = 0;
    pk.yaw = (float) this.yaw;
    pk.pitch = (float) this.pitch;
    pk.metadata = this.dataProperties;
    player.dataPacket(pk);

    super.spawnTo(player);
  }