Ejemplo n.º 1
0
  protected void initEntity() {
    if (this.namedTag.contains("ActiveEffects")) {
      ListTag<CompoundTag> effects = this.namedTag.getList("ActiveEffects", CompoundTag.class);
      for (CompoundTag e : effects.getAll()) {
        Effect effect = Effect.getEffect(e.getByte("Id"));
        if (effect == null) {
          continue;
        }

        effect
            .setAmplifier(e.getByte("Amplifier"))
            .setDuration(e.getInt("Duration"))
            .setVisible(e.getBoolean("showParticles"));

        this.addEffect(effect);
      }
    }

    if (this.namedTag.contains("CustomName")) {
      this.setNameTag(this.namedTag.getString("CustomName"));
      if (this.namedTag.contains("CustomNameVisible")) {
        this.setNameTagVisible(this.namedTag.getBoolean("CustomNameVisible"));
      }
    }

    this.scheduleUpdate();
  }
Ejemplo n.º 2
0
 @Override
 public Item getItem(int index) {
   int i = this.getSlotIndex(index);
   if (i < 0) {
     return new ItemBlock(new BlockAir(), 0, 0);
   } else {
     CompoundTag data = (CompoundTag) this.namedTag.getList("Items").get(i);
     return Item.get(data.getShort("id"), data.getShort("Damage"), data.getByte("Count"));
   }
 }