Esempio n. 1
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();
  }
Esempio n. 2
0
  public void c(NBTTagCompound nbttagcompound) {
    if (nbttagcompound.hasKeyOfType("id", 8)) {
      this.item = Item.d(nbttagcompound.getString("id"));
    } else {
      this.item = Item.getById(nbttagcompound.getShort("id"));
    }

    this.count = nbttagcompound.getByte("Count");
    /* CraftBukkit start - Route through setData for filtering
    this.damage = nbttagcompound.getShort("Damage");
    if (this.damage < 0) {
        this.damage = 0;
    }
    */
    this.setData(nbttagcompound.getShort("Damage"));
    // CraftBukkit end

    if (nbttagcompound.hasKeyOfType("tag", 10)) {
      // CraftBukkit - make defensive copy as this data may be coming from the save thread
      this.tag = (NBTTagCompound) nbttagcompound.getCompound("tag").clone();
      if (this.item != null) {
        this.item.a(this.tag);
      }
    }
  }
  CraftMetaBlockState(NBTTagCompound tag, Material material) {
    super(tag);
    this.material = material;

    if (tag.hasKeyOfType(BLOCK_ENTITY_TAG.NBT, 10)) {
      blockEntityTag = tag.getCompound(BLOCK_ENTITY_TAG.NBT);
    } else {
      blockEntityTag = null;
    }
  }
  private NBTTagCompound getBukkitData() {
    NBTTagCompound result = getData();

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

    return result;
  }
Esempio n. 5
0
  public void c(NBTTagCompound nbttagcompound) {
    this.id = nbttagcompound.getShort("id");
    this.count = nbttagcompound.getByte("Count");
    this.damage = nbttagcompound.getShort("Damage");
    if (this.damage < 0) {
      this.damage = 0;
    }

    if (nbttagcompound.hasKey("tag")) {
      this.tag = nbttagcompound.getCompound("tag");
    }
  }
 public void a(NBTTagCompound nbttagcompound) {
   super.a(nbttagcompound);
   this.a = nbttagcompound.getByte("SkullType");
   this.i = nbttagcompound.getByte("Rot");
   if (this.a == 3) {
     if (nbttagcompound.hasKeyOfType("Owner", 10)) {
       this.j = GameProfileSerializer.a(nbttagcompound.getCompound("Owner"));
     } else if (nbttagcompound.hasKeyOfType("ExtraType", 8)
         && !UtilColor.b(nbttagcompound.getString("ExtraType"))) {
       this.j = new GameProfile((UUID) null, nbttagcompound.getString("ExtraType"));
       this.d();
     }
   }
 }
  public void a(NBTTagCompound var1) {
    if (this.c == null) {
      this.d = var1;
    } else {
      this.b(var1.getList("Objectives", 10));
      this.c(var1.getList("PlayerScores", 10));
      if (var1.hasOfType("DisplaySlots", 10)) {
        this.c(var1.getCompound("DisplaySlots"));
      }

      if (var1.hasOfType("Teams", 9)) {
        this.a(var1.getList("Teams", 10));
      }
    }
  }
 @Override
 void deserializeInternal(NBTTagCompound tag) {
   if (tag.hasKeyOfType(BLOCK_ENTITY_TAG.NBT, 10)) {
     blockEntityTag = tag.getCompound(BLOCK_ENTITY_TAG.NBT);
   }
 }
  public UseResult interactWith(
      ItemStack var1,
      EntityHuman var2,
      World var3,
      BlockPosition var4,
      EnumUsedHand var5,
      EnumDirection var6,
      float var7,
      float var8,
      float var9) {
    if (var6 == EnumDirection.DOWN) {
      return UseResult.CANT_USE;
    } else {
      boolean var10 = var3.getType(var4).getBlock().isReplaceable(var3, var4);
      BlockPosition var11 = var10 ? var4 : var4.shift(var6);
      if (!var2.a(var11, var6, var1)) {
        return UseResult.CANT_USE;
      } else {
        BlockPosition var12 = var11.up();
        boolean var13 =
            !var3.isEmpty(var11) && !var3.getType(var11).getBlock().isReplaceable(var3, var11);
        var13 |= !var3.isEmpty(var12) && !var3.getType(var12).getBlock().isReplaceable(var3, var12);
        if (var13) {
          return UseResult.CANT_USE;
        } else {
          double var14 = (double) var11.getX();
          double var16 = (double) var11.getY();
          double var18 = (double) var11.getZ();
          List var20 =
              var3.getEntities(
                  (Entity) null,
                  (AxisAlignedBB)
                      AxisAlignedBB.a(
                          var14, var16, var18, var14 + 1.0D, var16 + 2.0D, var18 + 1.0D));
          if (!var20.isEmpty()) {
            return UseResult.CANT_USE;
          } else {
            if (!var3.isClientSide) {
              var3.setAir(var11);
              var3.setAir(var12);
              EntityArmorStand var21 =
                  new EntityArmorStand(var3, var14 + 0.5D, var16, var18 + 0.5D);
              float var22 =
                  (float)
                          MathHelper.floor(
                              (MathHelper.clampAngle(var2.yaw - 180.0F) + 22.5F) / 45.0F)
                      * 45.0F;
              var21.setPositionRotation(var14 + 0.5D, var16, var18 + 0.5D, var22, 0.0F);
              this.a(var21, var3.random);
              NBTTagCompound var23 = var1.getTag();
              if (var23 != null && var23.hasOfType("EntityTag", 10)) {
                NBTTagCompound var24 = new NBTTagCompound();
                var21.d(var24);
                var24.copyFrom(var23.getCompound("EntityTag"));
                var21.f(var24);
              }

              var3.addEntity((Entity) var21);
            }

            --var1.count;
            return UseResult.SUCCESS;
          }
        }
      }
    }
  }