Ejemplo n.º 1
0
  public static void a(Map map, ItemStack itemstack) {
    NBTTagList nbttaglist = new NBTTagList();
    Iterator iterator = map.keySet().iterator();

    while (iterator.hasNext()) {
      int i = ((Integer) iterator.next()).intValue();
      NBTTagCompound nbttagcompound = new NBTTagCompound();

      nbttagcompound.setShort("id", (short) i);
      nbttagcompound.setShort("lvl", (short) ((Integer) map.get(Integer.valueOf(i))).intValue());
      nbttaglist.add(nbttagcompound);
      if (itemstack.getItem() == Items.ENCHANTED_BOOK) {
        Items.ENCHANTED_BOOK.a(
            itemstack,
            new EnchantmentInstance(i, ((Integer) map.get(Integer.valueOf(i))).intValue()));
      }
    }

    if (nbttaglist.size() > 0) {
      if (itemstack.getItem() != Items.ENCHANTED_BOOK) {
        itemstack.a("ench", (NBTBase) nbttaglist);
      }
    } else if (itemstack.hasTag()) {
      itemstack.getTag().remove("ench");
    }
  }
  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.º 3
0
  protected NBTTagList a(float... afloat) {
    NBTTagList nbttaglist = new NBTTagList();
    float[] afloat1 = afloat;
    int i = afloat.length;

    for (int j = 0; j < i; ++j) {
      float f = afloat1[j];

      nbttaglist.add(new NBTTagFloat(f));
    }

    return nbttaglist;
  }
Ejemplo n.º 4
0
  protected NBTTagList a(double... adouble) {
    NBTTagList nbttaglist = new NBTTagList();
    double[] adouble1 = adouble;
    int i = adouble.length;

    for (int j = 0; j < i; ++j) {
      double d0 = adouble1[j];

      nbttaglist.add(new NBTTagDouble(d0));
    }

    return nbttaglist;
  }
Ejemplo n.º 5
0
  public void addEnchantment(Enchantment enchantment, int i) {
    if (this.tag == null) {
      this.setTag(new NBTTagCompound());
    }

    if (!this.tag.hasKey("ench")) {
      this.tag.set("ench", new NBTTagList("ench"));
    }

    NBTTagList nbttaglist = (NBTTagList) this.tag.get("ench");
    NBTTagCompound nbttagcompound = new NBTTagCompound();

    nbttagcompound.setShort("id", (short) enchantment.id);
    nbttagcompound.setShort("lvl", (short) ((byte) i));
    nbttaglist.add(nbttagcompound);
  }
Ejemplo n.º 6
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.º 7
0
  public NBTTagList h() {
    NBTTagList nbttaglist = new NBTTagList("EnderItems");

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

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

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

    return nbttaglist;
  }
Ejemplo n.º 8
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.º 9
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);
    }
  }
  public NBTTagCompound a() {
    NBTTagCompound var1 = new NBTTagCompound();
    if (this.m != null) {
      var1.put("DragonUUID", this.m);
    }

    var1.put("DragonKilled", this.k);
    var1.put("PreviouslyKilled", this.l);
    NBTTagList var2 = new NBTTagList();
    Iterator var3 = this.e.iterator();

    while (var3.hasNext()) {
      int var4 = ((Integer) var3.next()).intValue();
      var2.add((NBTTag) (new NBTTagInt(var4)));
    }

    var1.put((String) "Gateways", (NBTTag) var2);
    return var1;
  }
Ejemplo n.º 11
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.º 12
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.º 13
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.º 14
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.º 15
0
  public boolean a(class_yg var1, World var2) {
    this.a = null;
    int var3 = 0;
    int var4 = 0;
    int var5 = 0;
    int var6 = 0;
    int var7 = 0;
    int var8 = 0;

    for (int var9 = 0; var9 < var1.getSize(); ++var9) {
      ItemStack var10 = var1.getItem(var9);
      if (var10 != null) {
        if (var10.getItem() == Items.GUNPOWDER) {
          ++var4;
        } else if (var10.getItem() == Items.FIREWORK_CHARGE) {
          ++var6;
        } else if (var10.getItem() == Items.DYE) {
          ++var5;
        } else if (var10.getItem() == Items.PAPER) {
          ++var3;
        } else if (var10.getItem() == Items.GLOWSTONE_DUST) {
          ++var7;
        } else if (var10.getItem() == Items.DIAMOND) {
          ++var7;
        } else if (var10.getItem() == Items.FIRE_CHARGE) {
          ++var8;
        } else if (var10.getItem() == Items.FEATHER) {
          ++var8;
        } else if (var10.getItem() == Items.GOLD_NUGGEST) {
          ++var8;
        } else {
          if (var10.getItem() != Items.SKULL) {
            return false;
          }

          ++var8;
        }
      }
    }

    var7 += var5 + var8;
    if (var4 <= 3 && var3 <= 1) {
      NBTTagCompound var16;
      NBTTagCompound var19;
      if (var4 >= 1 && var3 == 1 && var7 == 0) {
        this.a = new ItemStack(Items.FIREWORKS);
        if (var6 > 0) {
          var16 = new NBTTagCompound();
          var19 = new NBTTagCompound();
          NBTTagList var25 = new NBTTagList();

          for (int var22 = 0; var22 < var1.getSize(); ++var22) {
            ItemStack var26 = var1.getItem(var22);
            if (var26 != null
                && var26.getItem() == Items.FIREWORK_CHARGE
                && var26.hasTag()
                && var26.getTag().hasOfType("Explosion", 10)) {
              var25.add((NBTTag) var26.getTag().getCompound("Explosion"));
            }
          }

          var19.put((String) "Explosions", (NBTTag) var25);
          var19.put("Flight", (byte) var4);
          var16.put((String) "Fireworks", (NBTTag) var19);
          this.a.setTag(var16);
        }

        return true;
      } else if (var4 == 1 && var3 == 0 && var6 == 0 && var5 > 0 && var8 <= 1) {
        this.a = new ItemStack(Items.FIREWORK_CHARGE);
        var16 = new NBTTagCompound();
        var19 = new NBTTagCompound();
        byte var23 = 0;
        ArrayList var12 = Lists.newArrayList();

        for (int var13 = 0; var13 < var1.getSize(); ++var13) {
          ItemStack var14 = var1.getItem(var13);
          if (var14 != null) {
            if (var14.getItem() == Items.DYE) {
              var12.add(Integer.valueOf(ItemDye.a[var14.i() & 15]));
            } else if (var14.getItem() == Items.GLOWSTONE_DUST) {
              var19.put("Flicker", true);
            } else if (var14.getItem() == Items.DIAMOND) {
              var19.put("Trail", true);
            } else if (var14.getItem() == Items.FIRE_CHARGE) {
              var23 = 1;
            } else if (var14.getItem() == Items.FEATHER) {
              var23 = 4;
            } else if (var14.getItem() == Items.GOLD_NUGGEST) {
              var23 = 2;
            } else if (var14.getItem() == Items.SKULL) {
              var23 = 3;
            }
          }
        }

        int[] var24 = new int[var12.size()];

        for (int var27 = 0; var27 < var24.length; ++var27) {
          var24[var27] = ((Integer) var12.get(var27)).intValue();
        }

        var19.put("Colors", var24);
        var19.put("Type", var23);
        var16.put((String) "Explosion", (NBTTag) var19);
        this.a.setTag(var16);
        return true;
      } else if (var4 == 0 && var3 == 0 && var6 == 1 && var5 > 0 && var5 == var7) {
        ArrayList var15 = Lists.newArrayList();

        for (int var17 = 0; var17 < var1.getSize(); ++var17) {
          ItemStack var11 = var1.getItem(var17);
          if (var11 != null) {
            if (var11.getItem() == Items.DYE) {
              var15.add(Integer.valueOf(ItemDye.a[var11.i() & 15]));
            } else if (var11.getItem() == Items.FIREWORK_CHARGE) {
              this.a = var11.clone();
              this.a.count = 1;
            }
          }
        }

        int[] var18 = new int[var15.size()];

        for (int var20 = 0; var20 < var18.length; ++var20) {
          var18[var20] = ((Integer) var15.get(var20)).intValue();
        }

        if (this.a != null && this.a.hasTag()) {
          NBTTagCompound var21 = this.a.getTag().getCompound("Explosion");
          if (var21 == null) {
            return false;
          } else {
            var21.put("FadeColors", var18);
            return true;
          }
        } else {
          return false;
        }
      } else {
        return false;
      }
    } else {
      return false;
    }
  }
Ejemplo n.º 16
0
  public static void a(
      OldChunk oldchunk, NBTTagCompound nbttagcompound, WorldChunkManager worldchunkmanager) {
    nbttagcompound.setInt("xPos", oldchunk.k);
    nbttagcompound.setInt("zPos", oldchunk.l);
    nbttagcompound.setLong("LastUpdate", oldchunk.a);
    int[] aint = new int[oldchunk.c.length];

    for (int i = 0; i < oldchunk.c.length; ++i) {
      aint[i] = oldchunk.c[i];
    }

    nbttagcompound.setIntArray("HeightMap", aint);
    nbttagcompound.setBoolean("TerrainPopulated", oldchunk.b);
    NBTTagList nbttaglist = new NBTTagList();

    int j;

    for (int k = 0; k < 8; ++k) {
      boolean flag = true;

      for (j = 0; j < 16 && flag; ++j) {
        int l = 0;

        while (l < 16 && flag) {
          int i1 = 0;

          while (true) {
            if (i1 < 16) {
              int j1 = j << 11 | i1 << 7 | l + (k << 4);
              byte b0 = oldchunk.g[j1];

              if (b0 == 0) {
                ++i1;
                continue;
              }

              flag = false;
            }

            ++l;
            break;
          }
        }
      }

      if (!flag) {
        byte[] abyte = new byte[4096];
        NibbleArray nibblearray = new NibbleArray(abyte.length, 4);
        NibbleArray nibblearray1 = new NibbleArray(abyte.length, 4);
        NibbleArray nibblearray2 = new NibbleArray(abyte.length, 4);

        for (int k1 = 0; k1 < 16; ++k1) {
          for (int l1 = 0; l1 < 16; ++l1) {
            for (int i2 = 0; i2 < 16; ++i2) {
              int j2 = k1 << 11 | i2 << 7 | l1 + (k << 4);
              byte b1 = oldchunk.g[j2];

              abyte[l1 << 8 | i2 << 4 | k1] = (byte) (b1 & 255);
              nibblearray.a(k1, l1, i2, oldchunk.f.a(k1, l1 + (k << 4), i2));
              nibblearray1.a(k1, l1, i2, oldchunk.e.a(k1, l1 + (k << 4), i2));
              nibblearray2.a(k1, l1, i2, oldchunk.d.a(k1, l1 + (k << 4), i2));
            }
          }
        }

        NBTTagCompound nbttagcompound1 = new NBTTagCompound();

        nbttagcompound1.setByte("Y", (byte) (k & 255));
        nbttagcompound1.setByteArray("Blocks", abyte);
        nbttagcompound1.setByteArray("Data", nibblearray.a);
        nbttagcompound1.setByteArray("SkyLight", nibblearray1.a);
        nbttagcompound1.setByteArray("BlockLight", nibblearray2.a);
        nbttaglist.add(nbttagcompound1);
      }
    }

    nbttagcompound.set("Sections", nbttaglist);
    byte[] abyte1 = new byte[256];

    for (int k2 = 0; k2 < 16; ++k2) {
      for (j = 0; j < 16; ++j) {
        abyte1[j << 4 | k2] =
            (byte) (worldchunkmanager.getBiome(oldchunk.k << 4 | k2, oldchunk.l << 4 | j).id & 255);
      }
    }

    nbttagcompound.setByteArray("Biomes", abyte1);
    nbttagcompound.set("Entities", oldchunk.h);
    nbttagcompound.set("TileEntities", oldchunk.i);
    if (oldchunk.j != null) {
      nbttagcompound.set("TileTicks", oldchunk.j);
    }
  }