Example #1
0
  public void a(NBTTagCompound nbttagcompound) {
    super.a(nbttagcompound);
    NBTTagList nbttaglist = nbttagcompound.getList("Inventory");

    this.inventory.b(nbttaglist);
    this.dimension = nbttagcompound.getInt("Dimension");
    this.sleeping = nbttagcompound.getBoolean("Sleeping");
    this.sleepTicks = nbttagcompound.getShort("SleepTimer");
    this.exp = nbttagcompound.getFloat("XpP");
    this.expLevel = nbttagcompound.getInt("XpLevel");
    this.expTotal = nbttagcompound.getInt("XpTotal");
    if (this.sleeping) {
      this.F =
          new ChunkCoordinates(
              MathHelper.floor(this.locX),
              MathHelper.floor(this.locY),
              MathHelper.floor(this.locZ));
      this.a(true, true, false);
    }

    if (nbttagcompound.hasKey("SpawnX")
        && nbttagcompound.hasKey("SpawnY")
        && nbttagcompound.hasKey("SpawnZ")) {
      this.b =
          new ChunkCoordinates(
              nbttagcompound.getInt("SpawnX"),
              nbttagcompound.getInt("SpawnY"),
              nbttagcompound.getInt("SpawnZ"));
    }

    this.foodData.a(nbttagcompound);
    this.abilities.b(nbttagcompound);
  }
  protected void a(NBTTagCompound var1) {
    if (var1.getBoolean("CustomDisplayTile")) {
      int var2 = var1.getInt("DisplayData");
      Block var3;
      if (var1.hasKeyOfType("DisplayTile", 8)) {
        var3 = Block.getByName(var1.getString("DisplayTile"));
        if (var3 == null) {
          this.setDisplayBlock(Blocks.AIR.getBlockData());
        } else {
          this.setDisplayBlock(var3.fromLegacyData(var2));
        }
      } else {
        var3 = Block.getById(var1.getInt("DisplayTile"));
        if (var3 == null) {
          this.setDisplayBlock(Blocks.AIR.getBlockData());
        } else {
          this.setDisplayBlock(var3.fromLegacyData(var2));
        }
      }

      this.SetDisplayBlockOffset(var1.getInt("DisplayOffset"));
    }

    if (var1.hasKeyOfType("CustomName", 8) && var1.getString("CustomName").length() > 0) {
      this.b = var1.getString("CustomName");
    }
  }
Example #3
0
  public void a(NBTTagCompound nbttagcompound) {
    super.a(nbttagcompound);
    this.o(nbttagcompound.getBoolean("EatingHaystack"));
    this.k(nbttagcompound.getBoolean("Bred"));
    this.setHasChest(nbttagcompound.getBoolean("ChestedHorse"));
    this.m(nbttagcompound.getBoolean("HasReproduced"));
    this.setType(nbttagcompound.getInt("Type"));
    this.setVariant(nbttagcompound.getInt("Variant"));
    this.setTemper(nbttagcompound.getInt("Temper"));
    this.setTame(nbttagcompound.getBoolean("Tame"));
    if (nbttagcompound.hasKeyOfType("OwnerUUID", 8)) {
      this.setOwnerUUID(nbttagcompound.getString("OwnerUUID"));
    }
    // CraftBukkit start
    if (nbttagcompound.hasKey("Bukkit.MaxDomestication")) {
      this.maxDomestication = nbttagcompound.getInt("Bukkit.MaxDomestication");
    }
    // CraftBukkit end
    AttributeInstance attributeinstance = this.bb().a("Speed");

    if (attributeinstance != null) {
      this.getAttributeInstance(GenericAttributes.d).setValue(attributeinstance.b() * 0.25D);
    }

    if (this.hasChest()) {
      NBTTagList nbttaglist = nbttagcompound.getList("Items", 10);

      this.loadChest();

      for (int i = 0; i < nbttaglist.size(); ++i) {
        NBTTagCompound nbttagcompound1 = nbttaglist.get(i);
        int j = nbttagcompound1.getByte("Slot") & 255;

        if (j >= 2 && j < this.inventoryChest.getSize()) {
          this.inventoryChest.setItem(j, ItemStack.createStack(nbttagcompound1));
        }
      }
    }

    ItemStack itemstack;

    if (nbttagcompound.hasKeyOfType("ArmorItem", 10)) {
      itemstack = ItemStack.createStack(nbttagcompound.getCompound("ArmorItem"));
      if (itemstack != null && a(itemstack.getItem())) {
        this.inventoryChest.setItem(1, itemstack);
      }
    }

    if (nbttagcompound.hasKeyOfType("SaddleItem", 10)) {
      itemstack = ItemStack.createStack(nbttagcompound.getCompound("SaddleItem"));
      if (itemstack != null && itemstack.getItem() == Items.SADDLE) {
        this.inventoryChest.setItem(0, itemstack);
      }
    } else if (nbttagcompound.getBoolean("Saddle")) {
      this.inventoryChest.setItem(0, new ItemStack(Items.SADDLE));
    }

    this.cO();
  }
 public void a(NBTTagCompound nbttagcompound) {
   super.a(nbttagcompound);
   this.a = Block.getById(nbttagcompound.getInt("blockId"));
   this.i = nbttagcompound.getInt("blockData");
   this.j = nbttagcompound.getInt("facing");
   this.n = this.m = nbttagcompound.getFloat("progress");
   this.k = nbttagcompound.getBoolean("extending");
 }
Example #5
0
 public void a(NBTTagCompound nbttagcompound) {
   super.a(nbttagcompound);
   this.a = nbttagcompound.getInt("blockId");
   this.b = nbttagcompound.getInt("blockData");
   this.c = nbttagcompound.getInt("facing");
   this.g = this.f = nbttagcompound.getFloat("progress");
   this.d = nbttagcompound.getBoolean("extending");
 }
  public void b(NBTTagCompound nbttagcompound) {
    super.b(nbttagcompound);
    if (nbttagcompound.hasKeyOfType("Processed", 9)) {
      NBTTagList nbttaglist = nbttagcompound.getList("Processed", 10);

      for (int i = 0; i < nbttaglist.size(); ++i) {
        NBTTagCompound nbttagcompound1 = nbttaglist.get(i);

        this.c.add(new ChunkCoordIntPair(nbttagcompound1.getInt("X"), nbttagcompound1.getInt("Z")));
      }
    }
  }
 public void a(NBTTagCompound nbttagcompound) {
   super.a(nbttagcompound);
   if (nbttagcompound.hasKey("playerGameType")) {
     this.playerInteractManager.setGameMode(
         EnumGamemode.a(nbttagcompound.getInt("playerGameType")));
   }
   this.getBukkitEntity().readExtraData(nbttagcompound); // CraftBukkit
 }
  public Location getBedSpawnLocation() {
    NBTTagCompound data = getData();
    if (data == null) return null;

    if (data.hasKey("SpawnX") && data.hasKey("SpawnY") && data.hasKey("SpawnZ")) {
      String spawnWorld = data.getString("SpawnWorld");
      if (spawnWorld.equals("")) {
        spawnWorld = server.getWorlds().get(0).getName();
      }
      return new Location(
          server.getWorld(spawnWorld),
          data.getInt("SpawnX"),
          data.getInt("SpawnY"),
          data.getInt("SpawnZ"));
    }
    return null;
  }
 public void a(NBTTagCompound var1) {
   super.a(var1);
   this.color = var1.getInt("Base");
   this.patterns = var1.getList("Patterns", 10);
   this.h = null;
   this.i = null;
   this.j = null;
   this.g = true;
 }
Example #10
0
  public CraftBanner(final Material material, final TileEntityBanner te) {
    super(material);
    banner = te;

    base = DyeColor.getByDyeData((byte) banner.color);

    if (banner.patterns != null) {
      for (int i = 0; i < banner.patterns.size(); i++) {
        NBTTagCompound p = (NBTTagCompound) banner.patterns.get(i);
        patterns.add(
            new Pattern(
                DyeColor.getByDyeData((byte) p.getInt("Color")),
                PatternType.getByIdentifier(p.getString("Pattern"))));
      }
    }
  }
  protected void c(NBTTagList var1) {
    for (int var2 = 0; var2 < var1.getSize(); ++var2) {
      NBTTagCompound var3 = var1.getCompound(var2);
      class_awj var4 = this.c.b(var3.getString("Objective"));
      String var5 = var3.getString("Name");
      if (var5.length() > 40) {
        var5 = var5.substring(0, 40);
      }

      class_awl var6 = this.c.c(var5, var4);
      var6.c(var3.getInt("Score"));
      if (var3.has("Locked")) {
        var6.a(var3.getBoolean("Locked"));
      }
    }
  }
Example #12
0
  public CraftBanner(final Block block) {
    super(block);

    CraftWorld world = (CraftWorld) block.getWorld();
    banner = (TileEntityBanner) world.getTileEntityAt(getX(), getY(), getZ());

    base = DyeColor.getByDyeData((byte) banner.color);

    if (banner.patterns != null) {
      for (int i = 0; i < banner.patterns.size(); i++) {
        NBTTagCompound p = (NBTTagCompound) banner.patterns.get(i);
        patterns.add(
            new Pattern(
                DyeColor.getByDyeData((byte) p.getInt("Color")),
                PatternType.getByIdentifier(p.getString("Pattern"))));
      }
    }
  }
Example #13
0
  CraftMetaPotion(NBTTagCompound tag) {
    super(tag);

    if (tag.hasKey(POTION_EFFECTS.NBT)) {
      NBTTagList list = tag.getList(POTION_EFFECTS.NBT);
      int length = list.size();
      if (length > 0) {
        customEffects = new ArrayList<PotionEffect>(length);

        for (int i = 0; i < length; i++) {
          NBTTagCompound effect = (NBTTagCompound) list.get(i);
          PotionEffectType type = PotionEffectType.getById(effect.getByte(ID.NBT));
          int amp = effect.getByte(AMPLIFIER.NBT);
          int duration = effect.getInt(DURATION.NBT);
          boolean ambient = effect.getBoolean(AMBIENT.NBT);
          customEffects.add(new PotionEffect(type, duration, amp, ambient));
        }
      }
    }
  }
Example #14
0
  public void a(NBTTagCompound nbttagcompound) {
    super.a(nbttagcompound);
    NBTTagList nbttaglist = nbttagcompound.getList("Items", 10);

    this.a = new ItemStack[this.getSize()];
    if (nbttagcompound.hasKeyOfType("CustomName", 8)) {
      this.i = nbttagcompound.getString("CustomName");
    }

    this.j = nbttagcompound.getInt("TransferCooldown");

    for (int i = 0; i < nbttaglist.size(); ++i) {
      NBTTagCompound nbttagcompound1 = nbttaglist.get(i);
      byte b0 = nbttagcompound1.getByte("Slot");

      if (b0 >= 0 && b0 < this.a.length) {
        this.a[b0] = ItemStack.createStack(nbttagcompound1);
      }
    }
  }
Example #15
0
  protected void a(NBTTagCompound nbttagcompound) {
    this.type = nbttagcompound.getInt("Type");
    if (this.type == 2) {
      this.b = nbttagcompound.getDouble("PushX");
      this.c = nbttagcompound.getDouble("PushZ");
      this.e = nbttagcompound.getShort("Fuel");
    } else if (this.type == 1) {
      NBTTagList nbttaglist = nbttagcompound.getList("Items");

      this.items = new ItemStack[this.getSize()];

      for (int i = 0; i < nbttaglist.size(); ++i) {
        NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.get(i);
        int j = nbttagcompound1.getByte("Slot") & 255;

        if (j >= 0 && j < this.items.length) {
          this.items[j] = ItemStack.a(nbttagcompound1);
        }
      }
    }
  }
Example #16
0
  public void a(ItemStack var1) {
    this.patterns = null;
    if (var1.hasTag() && var1.getTag().hasKeyOfType("BlockEntityTag", 10)) {
      NBTTagCompound var2 = var1.getTag().getCompound("BlockEntityTag");
      if (var2.hasKey("Patterns")) {
        this.patterns = (NBTTagList) var2.getList("Patterns", 10).clone();
      }

      if (var2.hasKeyOfType("Base", 99)) {
        this.color = var2.getInt("Base");
      } else {
        this.color = var1.getData() & 15;
      }
    } else {
      this.color = var1.getData() & 15;
    }

    this.h = null;
    this.i = null;
    this.j = "";
    this.g = true;
  }
Example #17
0
 public void a(NBTTagCompound nbttagcompound) {
   this.position =
       new BlockPosition(
           nbttagcompound.getInt("x"), nbttagcompound.getInt("y"), nbttagcompound.getInt("z"));
 }
Example #18
0
 public void a(NBTTagCompound nbttagcompound) {
   x = nbttagcompound.getInt("x");
   y = nbttagcompound.getInt("y");
   z = nbttagcompound.getInt("z");
 }
Example #19
0
  public void f(NBTTagCompound nbttagcompound) {
    try {
      NBTTagList nbttaglist = nbttagcompound.getList("Pos", 6);
      NBTTagList nbttaglist1 = nbttagcompound.getList("Motion", 6);
      NBTTagList nbttaglist2 = nbttagcompound.getList("Rotation", 5);

      this.motX = nbttaglist1.d(0);
      this.motY = nbttaglist1.d(1);
      this.motZ = nbttaglist1.d(2);
      if (Math.abs(this.motX) > 10.0D) {
        this.motX = 0.0D;
      }

      if (Math.abs(this.motY) > 10.0D) {
        this.motY = 0.0D;
      }

      if (Math.abs(this.motZ) > 10.0D) {
        this.motZ = 0.0D;
      }

      this.lastX = this.P = this.locX = nbttaglist.d(0);
      this.lastY = this.Q = this.locY = nbttaglist.d(1);
      this.lastZ = this.R = this.locZ = nbttaglist.d(2);
      this.lastYaw = this.yaw = nbttaglist2.e(0);
      this.lastPitch = this.pitch = nbttaglist2.e(1);
      this.fallDistance = nbttagcompound.getFloat("FallDistance");
      this.fireTicks = nbttagcompound.getShort("Fire");
      this.setAirTicks(nbttagcompound.getShort("Air"));
      this.onGround = nbttagcompound.getBoolean("OnGround");
      this.dimension = nbttagcompound.getInt("Dimension");
      this.invulnerable = nbttagcompound.getBoolean("Invulnerable");
      this.portalCooldown = nbttagcompound.getInt("PortalCooldown");
      if (nbttagcompound.hasKeyOfType("UUIDMost", 4)
          && nbttagcompound.hasKeyOfType("UUIDLeast", 4)) {
        this.uniqueID =
            new UUID(nbttagcompound.getLong("UUIDMost"), nbttagcompound.getLong("UUIDLeast"));
      } else if (nbttagcompound.hasKeyOfType("UUID", 8)) {
        this.uniqueID = UUID.fromString(nbttagcompound.getString("UUID"));
      }

      this.setPosition(this.locX, this.locY, this.locZ);
      this.setYawPitch(this.yaw, this.pitch);
      if (nbttagcompound.hasKeyOfType("CustomName", 8)
          && nbttagcompound.getString("CustomName").length() > 0) {
        this.setCustomName(nbttagcompound.getString("CustomName"));
      }

      this.setCustomNameVisible(nbttagcompound.getBoolean("CustomNameVisible"));
      this.as.a(nbttagcompound);
      this.b(nbttagcompound.getBoolean("Silent"));
      this.a(nbttagcompound);
      if (this.af()) {
        this.setPosition(this.locX, this.locY, this.locZ);
      }

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

      this.appendEntityCrashDetails(crashreportsystemdetails);
      throw new ReportedException(crashreport);
    }
  }
Example #20
0
 public void a(NBTTagCompound nbttagcompound) {
   super.a(nbttagcompound);
   this.love = nbttagcompound.getInt("InLove");
 }
 protected void b(NBTTagCompound nbttagcompound) {
   super.b(nbttagcompound);
   this.a = nbttagcompound.getInt("Length");
 }
Example #22
0
 public ItemData(NBTTagCompound tag) {
   this.modId = tag.getString("ModId");
   this.itemType = tag.getString("ItemType");
   this.itemId = tag.getInt("ItemId");
   this.ordinal = tag.getInt("ordinal");
 }
Example #23
0
 public void a(NBTTagCompound nbttagcompound) {
   super.a(nbttagcompound);
   this.p(nbttagcompound.getInt("Invul"));
 }
Example #24
0
 public static int b(ItemStack var0) {
   NBTTagCompound var1 = var0.a("BlockEntityTag", false);
   return var1 != null && var1.hasKey("Base") ? var1.getInt("Base") : var0.getData();
 }