@Override
  void applyToItem(NBTTagCompound tag) {
    super.applyToItem(tag);

    if (blockEntityTag != null) {
      tag.set(BLOCK_ENTITY_TAG.NBT, blockEntityTag);
    }
  }
Ejemplo n.º 2
0
 public void b(NBTTagCompound nbttagcompound) {
   nbttagcompound.setShort("xTile", (short) this.e);
   nbttagcompound.setShort("yTile", (short) this.f);
   nbttagcompound.setShort("zTile", (short) this.g);
   nbttagcompound.setByte("inTile", (byte) Block.b(this.h));
   nbttagcompound.setByte("inGround", (byte) (this.i ? 1 : 0));
   nbttagcompound.set("direction", this.a(new double[] {this.motX, this.motY, this.motZ}));
 }
Ejemplo n.º 3
0
 public void b(NBTTagCompound nbttagcompound) {
   nbttagcompound.setShort("xTile", (short) this.e);
   nbttagcompound.setShort("yTile", (short) this.f);
   nbttagcompound.setShort("zTile", (short) this.g);
   nbttagcompound.setByte("inTile", (byte) this.h);
   nbttagcompound.setByte("inGround", (byte) (this.i ? 1 : 0));
   // CraftBukkit - Fix direction being mismapped to invalid variables
   nbttagcompound.set("power", this.a(new double[] {this.dirX, this.dirY, this.dirZ}));
 }
Ejemplo n.º 4
0
  public void b(NBTTagCompound nbttagcompound) {
    nbttagcompound.setFloat("HealF", this.getHealth());
    nbttagcompound.setShort("Health", (short) ((int) Math.ceil((double) this.getHealth())));
    nbttagcompound.setShort("HurtTime", (short) this.hurtTicks);
    nbttagcompound.setShort("DeathTime", (short) this.deathTicks);
    nbttagcompound.setShort("AttackTime", (short) this.attackTicks);
    nbttagcompound.setFloat("AbsorptionAmount", this.bn());
    ItemStack[] aitemstack = this.getEquipment();
    int i = aitemstack.length;

    int j;
    ItemStack itemstack;

    for (j = 0; j < i; ++j) {
      itemstack = aitemstack[j];
      if (itemstack != null) {
        this.d.a(itemstack.D());
      }
    }

    nbttagcompound.set("Attributes", GenericAttributes.a(this.aX()));
    aitemstack = this.getEquipment();
    i = aitemstack.length;

    for (j = 0; j < i; ++j) {
      itemstack = aitemstack[j];
      if (itemstack != null) {
        this.d.b(itemstack.D());
      }
    }

    if (!this.effects.isEmpty()) {
      NBTTagList nbttaglist = new NBTTagList();
      Iterator iterator = this.effects.values().iterator();

      while (iterator.hasNext()) {
        MobEffect mobeffect = (MobEffect) iterator.next();

        nbttaglist.add(mobeffect.a(new NBTTagCompound()));
      }

      nbttagcompound.set("ActiveEffects", nbttaglist);
    }
  }
Ejemplo n.º 5
0
  public NBTTagCompound save(NBTTagCompound nbttagcompound) {
    nbttagcompound.setShort("id", (short) this.id);
    nbttagcompound.setByte("Count", (byte) this.count);
    nbttagcompound.setShort("Damage", (short) this.damage);
    if (this.tag != null) {
      nbttagcompound.set("tag", this.tag);
    }

    return nbttagcompound;
  }
Ejemplo n.º 6
0
  public void b(NBTTagCompound nbttagcompound) {
    super.b(nbttagcompound);
    nbttagcompound.setByte("SkullType", (byte) (this.a & 255));
    nbttagcompound.setByte("Rot", (byte) (this.i & 255));
    if (this.j != null) {
      NBTTagCompound nbttagcompound1 = new NBTTagCompound();

      GameProfileSerializer.a(nbttagcompound1, this.j);
      nbttagcompound.set("Owner", nbttagcompound1);
    }
  }
Ejemplo n.º 7
0
  public void e(NBTTagCompound nbttagcompound) {
    try {
      nbttagcompound.set("Pos", this.a(new double[] {this.locX, this.locY, this.locZ}));
      nbttagcompound.set("Motion", this.a(new double[] {this.motX, this.motY, this.motZ}));
      nbttagcompound.set("Rotation", this.a(new float[] {this.yaw, this.pitch}));
      nbttagcompound.setFloat("FallDistance", this.fallDistance);
      nbttagcompound.setShort("Fire", (short) this.fireTicks);
      nbttagcompound.setShort("Air", (short) this.getAirTicks());
      nbttagcompound.setBoolean("OnGround", this.onGround);
      nbttagcompound.setInt("Dimension", this.dimension);
      nbttagcompound.setBoolean("Invulnerable", this.invulnerable);
      nbttagcompound.setInt("PortalCooldown", this.portalCooldown);
      nbttagcompound.setLong("UUIDMost", this.getUniqueID().getMostSignificantBits());
      nbttagcompound.setLong("UUIDLeast", this.getUniqueID().getLeastSignificantBits());
      if (this.getCustomName() != null && this.getCustomName().length() > 0) {
        nbttagcompound.setString("CustomName", this.getCustomName());
        nbttagcompound.setBoolean("CustomNameVisible", this.getCustomNameVisible());
      }

      this.as.b(nbttagcompound);
      if (this.R()) {
        nbttagcompound.setBoolean("Silent", this.R());
      }

      this.b(nbttagcompound);
      if (this.vehicle != null) {
        NBTTagCompound nbttagcompound1 = new NBTTagCompound();

        if (this.vehicle.c(nbttagcompound1)) {
          nbttagcompound.set("Riding", nbttagcompound1);
        }
      }

    } catch (Throwable throwable) {
      CrashReport crashreport = CrashReport.a(throwable, "Saving entity NBT");
      CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Entity being saved");

      this.appendEntityCrashDetails(crashreportsystemdetails);
      throw new ReportedException(crashreport);
    }
  }
  protected void a(NBTTagCompound nbttagcompound) {
    NBTTagList nbttaglist = new NBTTagList();
    Iterator iterator = this.a.iterator();

    while (iterator.hasNext()) {
      StructureBoundingBox structureboundingbox = (StructureBoundingBox) iterator.next();

      nbttaglist.add(structureboundingbox.h());
    }

    nbttagcompound.set("Entrances", nbttaglist);
  }
Ejemplo n.º 9
0
  private NBTTagCompound getBukkitData() {
    NBTTagCompound result = getData();

    if (result != null) {
      if (!result.hasKey("bukkit")) {
        result.set("bukkit", new NBTTagCompound());
      }
      result = result.getCompound("bukkit");
    }

    return result;
  }
Ejemplo n.º 10
0
  public void b(NBTTagCompound nbttagcompound) {
    super.b(nbttagcompound);
    nbttagcompound.setBoolean("EatingHaystack", this.cm());
    nbttagcompound.setBoolean("ChestedHorse", this.hasChest());
    nbttagcompound.setBoolean("HasReproduced", this.cp());
    nbttagcompound.setBoolean("Bred", this.co());
    nbttagcompound.setInt("Type", this.getType());
    nbttagcompound.setInt("Variant", this.getVariant());
    nbttagcompound.setInt("Temper", this.getTemper());
    nbttagcompound.setBoolean("Tame", this.isTame());
    nbttagcompound.setString("OwnerUUID", this.getOwnerUUID());
    nbttagcompound.setInt("Bukkit.MaxDomestication", this.maxDomestication); // CraftBukkit
    if (this.hasChest()) {
      NBTTagList nbttaglist = new NBTTagList();

      for (int i = 2; i < this.inventoryChest.getSize(); ++i) {
        ItemStack itemstack = this.inventoryChest.getItem(i);

        if (itemstack != null) {
          NBTTagCompound nbttagcompound1 = new NBTTagCompound();

          nbttagcompound1.setByte("Slot", (byte) i);
          itemstack.save(nbttagcompound1);
          nbttaglist.add(nbttagcompound1);
        }
      }

      nbttagcompound.set("Items", nbttaglist);
    }

    if (this.inventoryChest.getItem(1) != null) {
      nbttagcompound.set("ArmorItem", this.inventoryChest.getItem(1).save(new NBTTagCompound()));
    }

    if (this.inventoryChest.getItem(0) != null) {
      nbttagcompound.set("SaddleItem", this.inventoryChest.getItem(0).save(new NBTTagCompound()));
    }
  }
Ejemplo n.º 11
0
  public NBTTagCompound save(NBTTagCompound nbttagcompound) {
    MinecraftKey minecraftkey = (MinecraftKey) Item.REGISTRY.c(this.item);

    nbttagcompound.setString(
        "id", minecraftkey == null ? "minecraft:air" : minecraftkey.toString());
    nbttagcompound.setByte("Count", (byte) this.count);
    nbttagcompound.setShort("Damage", (short) this.damage);
    if (this.tag != null) {
      nbttagcompound.set(
          "tag",
          this.tag.clone()); // CraftBukkit - make defensive copy, data is going to another thread
    }

    return nbttagcompound;
  }
Ejemplo n.º 12
0
  public void a(NBTTagCompound nbttagcompound) {
    super.a(nbttagcompound);
    NBTTagList nbttaglist = new NBTTagList();
    Iterator iterator = this.c.iterator();

    while (iterator.hasNext()) {
      ChunkCoordIntPair chunkcoordintpair = (ChunkCoordIntPair) iterator.next();
      NBTTagCompound nbttagcompound1 = new NBTTagCompound();

      nbttagcompound1.setInt("X", chunkcoordintpair.x);
      nbttagcompound1.setInt("Z", chunkcoordintpair.z);
      nbttaglist.add(nbttagcompound1);
    }

    nbttagcompound.set("Processed", nbttaglist);
  }
Ejemplo n.º 13
0
  @Override
  void applyToItem(NBTTagCompound itemData) {
    super.applyToItem(itemData);

    if (hasTitle()) {
      itemData.setString(BOOK_TITLE.NBT, this.title);
    }

    if (hasAuthor()) {
      itemData.setString(BOOK_AUTHOR.NBT, this.author);
    }

    if (hasPages()) {
      itemData.set(BOOK_PAGES.NBT, createStringList(pages, BOOK_PAGES));
    }
  }
Ejemplo n.º 14
0
  @Override
  void applyToItem(NBTTagCompound tag) {
    super.applyToItem(tag);
    if (hasCustomEffects()) {
      NBTTagList effectList = new NBTTagList();
      tag.set(POTION_EFFECTS.NBT, effectList);

      for (PotionEffect effect : customEffects) {
        NBTTagCompound effectData = new NBTTagCompound();
        effectData.setByte(ID.NBT, (byte) effect.getType().getId());
        effectData.setByte(AMPLIFIER.NBT, (byte) effect.getAmplifier());
        effectData.setInt(DURATION.NBT, effect.getDuration());
        effectData.setBoolean(AMBIENT.NBT, effect.isAmbient());
        effectList.add(effectData);
      }
    }
  }
Ejemplo n.º 15
0
  public void b(NBTTagCompound nbttagcompound) {
    super.b(nbttagcompound);
    nbttagcompound.setShort("BrewTime", (short) this.brewTime);
    NBTTagList nbttaglist = new NBTTagList();

    for (int i = 0; i < this.items.length; ++i) {
      if (this.items[i] != null) {
        NBTTagCompound nbttagcompound1 = new NBTTagCompound();

        nbttagcompound1.setByte("Slot", (byte) i);
        this.items[i].save(nbttagcompound1);
        nbttaglist.add(nbttagcompound1);
      }
    }

    nbttagcompound.set("Items", nbttaglist);
  }
Ejemplo n.º 16
0
  public void b(NBTTagCompound nbttagcompound) {
    super.b(nbttagcompound);
    nbttagcompound.set("Inventory", this.inventory.a(new NBTTagList()));
    nbttagcompound.setInt("Dimension", this.dimension);
    nbttagcompound.setBoolean("Sleeping", this.sleeping);
    nbttagcompound.setShort("SleepTimer", (short) this.sleepTicks);
    nbttagcompound.setFloat("XpP", this.exp);
    nbttagcompound.setInt("XpLevel", this.expLevel);
    nbttagcompound.setInt("XpTotal", this.expTotal);
    if (this.b != null) {
      nbttagcompound.setInt("SpawnX", this.b.x);
      nbttagcompound.setInt("SpawnY", this.b.y);
      nbttagcompound.setInt("SpawnZ", this.b.z);
    }

    this.foodData.b(nbttagcompound);
    this.abilities.a(nbttagcompound);
  }
Ejemplo n.º 17
0
  public void b(NBTTagCompound nbttagcompound) {
    super.b(nbttagcompound);
    NBTTagList nbttaglist = new NBTTagList();

    for (int i = 0; i < this.items.length; ++i) {
      if (this.items[i] != null) {
        NBTTagCompound nbttagcompound1 = new NBTTagCompound();

        nbttagcompound1.setByte("Slot", (byte) i);
        this.items[i].save(nbttagcompound1);
        nbttaglist.add(nbttagcompound1);
      }
    }

    nbttagcompound.set("Items", nbttaglist);
    if (this.k_()) {
      nbttagcompound.setString("CustomName", this.a);
    }
  }
Ejemplo n.º 18
0
  protected void b(NBTTagCompound nbttagcompound) {
    nbttagcompound.setInt("Type", this.type);
    if (this.type == 2) {
      nbttagcompound.setDouble("PushX", this.b);
      nbttagcompound.setDouble("PushZ", this.c);
      nbttagcompound.setShort("Fuel", (short) this.e);
    } else if (this.type == 1) {
      NBTTagList nbttaglist = new NBTTagList();

      for (int i = 0; i < this.items.length; ++i) {
        if (this.items[i] != null) {
          NBTTagCompound nbttagcompound1 = new NBTTagCompound();

          nbttagcompound1.setByte("Slot", (byte) i);
          this.items[i].save(nbttagcompound1);
          nbttaglist.add(nbttagcompound1);
        }
      }

      nbttagcompound.set("Items", nbttaglist);
    }
  }
Ejemplo n.º 19
0
  @Override
  public boolean a(InventoryCrafting inventorycrafting, World world) {
    a = null;
    int i = 0;
    int j = 0;
    int k = 0;
    int l = 0;
    int i1 = 0;
    int j1 = 0;

    for (int k1 = 0; k1 < inventorycrafting.getSize(); ++k1) {
      ItemStack itemstack = inventorycrafting.getItem(k1);

      if (itemstack != null) {
        if (itemstack.getItem() == Items.SULPHUR) {
          ++j;
        } else if (itemstack.getItem() == Items.FIREWORKS_CHARGE) {
          ++l;
        } else if (itemstack.getItem() == Items.INK_SACK) {
          ++k;
        } else if (itemstack.getItem() == Items.PAPER) {
          ++i;
        } else if (itemstack.getItem() == Items.GLOWSTONE_DUST) {
          ++i1;
        } else if (itemstack.getItem() == Items.DIAMOND) {
          ++i1;
        } else if (itemstack.getItem() == Items.FIREBALL) {
          ++j1;
        } else if (itemstack.getItem() == Items.FEATHER) {
          ++j1;
        } else if (itemstack.getItem() == Items.GOLD_NUGGET) {
          ++j1;
        } else {
          if (itemstack.getItem() != Items.SKULL) return false;

          ++j1;
        }
      }
    }

    i1 += k + j1;
    if (j <= 3 && i <= 1) {
      NBTTagCompound nbttagcompound;
      NBTTagCompound nbttagcompound1;

      if (j >= 1 && i == 1 && i1 == 0) {
        a = new ItemStack(Items.FIREWORKS);
        if (l > 0) {
          nbttagcompound = new NBTTagCompound();
          nbttagcompound1 = new NBTTagCompound();
          NBTTagList nbttaglist = new NBTTagList();

          for (int l1 = 0; l1 < inventorycrafting.getSize(); ++l1) {
            ItemStack itemstack1 = inventorycrafting.getItem(l1);

            if (itemstack1 != null
                && itemstack1.getItem() == Items.FIREWORKS_CHARGE
                && itemstack1.hasTag()
                && itemstack1.getTag().hasKeyOfType("Explosion", 10)) {
              nbttaglist.add(itemstack1.getTag().getCompound("Explosion"));
            }
          }

          nbttagcompound1.set("Explosions", nbttaglist);
          nbttagcompound1.setByte("Flight", (byte) j);
          nbttagcompound.set("Fireworks", nbttagcompound1);
          a.setTag(nbttagcompound);
        }

        return true;
      } else if (j == 1 && i == 0 && l == 0 && k > 0 && j1 <= 1) {
        a = new ItemStack(Items.FIREWORKS_CHARGE);
        nbttagcompound = new NBTTagCompound();
        nbttagcompound1 = new NBTTagCompound();
        byte b0 = 0;
        ArrayList arraylist = new ArrayList();

        for (int i2 = 0; i2 < inventorycrafting.getSize(); ++i2) {
          ItemStack itemstack2 = inventorycrafting.getItem(i2);

          if (itemstack2 != null) {
            if (itemstack2.getItem() == Items.INK_SACK) {
              arraylist.add(Integer.valueOf(ItemDye.c[itemstack2.getData()]));
            } else if (itemstack2.getItem() == Items.GLOWSTONE_DUST) {
              nbttagcompound1.setBoolean("Flicker", true);
            } else if (itemstack2.getItem() == Items.DIAMOND) {
              nbttagcompound1.setBoolean("Trail", true);
            } else if (itemstack2.getItem() == Items.FIREBALL) {
              b0 = 1;
            } else if (itemstack2.getItem() == Items.FEATHER) {
              b0 = 4;
            } else if (itemstack2.getItem() == Items.GOLD_NUGGET) {
              b0 = 2;
            } else if (itemstack2.getItem() == Items.SKULL) {
              b0 = 3;
            }
          }
        }

        int[] aint = new int[arraylist.size()];

        for (int j2 = 0; j2 < aint.length; ++j2) {
          aint[j2] = ((Integer) arraylist.get(j2)).intValue();
        }

        nbttagcompound1.setIntArray("Colors", aint);
        nbttagcompound1.setByte("Type", b0);
        nbttagcompound.set("Explosion", nbttagcompound1);
        a.setTag(nbttagcompound);
        return true;
      } else if (j == 0 && i == 0 && l == 1 && k > 0 && k == i1) {
        ArrayList arraylist1 = new ArrayList();

        for (int k2 = 0; k2 < inventorycrafting.getSize(); ++k2) {
          ItemStack itemstack3 = inventorycrafting.getItem(k2);

          if (itemstack3 != null) {
            if (itemstack3.getItem() == Items.INK_SACK) {
              arraylist1.add(Integer.valueOf(ItemDye.c[itemstack3.getData()]));
            } else if (itemstack3.getItem() == Items.FIREWORKS_CHARGE) {
              a = itemstack3.cloneItemStack();
              a.count = 1;
            }
          }
        }

        int[] aint1 = new int[arraylist1.size()];

        for (int l2 = 0; l2 < aint1.length; ++l2) {
          aint1[l2] = ((Integer) arraylist1.get(l2)).intValue();
        }

        if (a != null && a.hasTag()) {
          NBTTagCompound nbttagcompound2 = a.getTag().getCompound("Explosion");

          if (nbttagcompound2 == null) return false;
          else {
            nbttagcompound2.setIntArray("FadeColors", aint1);
            return true;
          }
        } else return false;
      } else return false;
    } else return false;
  }
Ejemplo n.º 20
0
 public static void a(NBTTagCompound var0, int var1, NBTTagList var2) {
   var0.setInt("Base", var1);
   if (var2 != null) {
     var0.set("Patterns", var2);
   }
 }