コード例 #1
0
ファイル: ItemStack.java プロジェクト: randyzingle/javaalg
  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);
      }
    }
  }
コード例 #2
0
ファイル: EntityArrow.java プロジェクト: MDAWG25/backup
 public void a(NBTTagCompound nbttagcompound) {
   this.e = nbttagcompound.getShort("xTile");
   this.f = nbttagcompound.getShort("yTile");
   this.g = nbttagcompound.getShort("zTile");
   this.h = nbttagcompound.getByte("inTile") & 255;
   this.i = nbttagcompound.getByte("inData") & 255;
   this.shake = nbttagcompound.getByte("shake") & 255;
   this.inGround = nbttagcompound.getByte("inGround") == 1;
   this.fromPlayer = nbttagcompound.getBoolean("player");
 }
コード例 #3
0
ファイル: ItemStack.java プロジェクト: Ezence/mc-dev
  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");
    }
  }
コード例 #4
0
  public void a(NBTTagCompound nbttagcompound) {
    this.m(nbttagcompound.getFloat("AbsorptionAmount"));
    if (nbttagcompound.hasKey("Attributes") && this.world != null && !this.world.isStatic) {
      GenericAttributes.a(
          this.aX(),
          nbttagcompound.getList("Attributes"),
          this.world == null ? null : this.world.getLogger());
    }

    if (nbttagcompound.hasKey("ActiveEffects")) {
      NBTTagList nbttaglist = nbttagcompound.getList("ActiveEffects");

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

        this.effects.put(Integer.valueOf(mobeffect.getEffectId()), mobeffect);
      }
    }

    // CraftBukkit start
    if (nbttagcompound.hasKey("Bukkit.MaxHealth")) {
      NBTBase nbtbase = nbttagcompound.get("Bukkit.MaxHealth");
      if (nbtbase.getTypeId() == 5) {
        this.getAttributeInstance(GenericAttributes.a)
            .setValue((double) ((NBTTagFloat) nbtbase).data);
      } else if (nbtbase.getTypeId() == 3) {
        this.getAttributeInstance(GenericAttributes.a)
            .setValue((double) ((NBTTagInt) nbtbase).data);
      }
    }
    // CraftBukkit end

    if (nbttagcompound.hasKey("HealF")) {
      this.setHealth(nbttagcompound.getFloat("HealF"));
    } else {
      NBTBase nbtbase = nbttagcompound.get("Health");

      if (nbtbase == null) {
        this.setHealth(this.getMaxHealth());
      } else if (nbtbase.getTypeId() == 5) {
        this.setHealth(((NBTTagFloat) nbtbase).data);
      } else if (nbtbase.getTypeId() == 2) {
        this.setHealth((float) ((NBTTagShort) nbtbase).data);
      }
    }

    this.hurtTicks = nbttagcompound.getShort("HurtTime");
    this.deathTicks = nbttagcompound.getShort("DeathTime");
    this.attackTicks = nbttagcompound.getShort("AttackTime");
  }
コード例 #5
0
  public void a(NBTTagCompound nbttagcompound) {
    this.e = nbttagcompound.getShort("xTile");
    this.f = nbttagcompound.getShort("yTile");
    this.g = nbttagcompound.getShort("zTile");
    this.h = Block.e(nbttagcompound.getByte("inTile") & 255);
    this.i = nbttagcompound.getByte("inGround") == 1;
    if (nbttagcompound.hasKeyOfType("direction", 9)) {
      NBTTagList nbttaglist = nbttagcompound.getList("direction", 6);

      this.motX = nbttaglist.d(0);
      this.motY = nbttaglist.d(1);
      this.motZ = nbttaglist.d(2);
    } else {
      this.die();
    }
  }
コード例 #6
0
ファイル: EntityHuman.java プロジェクト: Chocanto/mc-dev
  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);
  }
コード例 #7
0
  public void a(NBTTagCompound nbttagcompound) {
    this.e = nbttagcompound.getShort("xTile");
    this.f = nbttagcompound.getShort("yTile");
    this.g = nbttagcompound.getShort("zTile");
    this.h = nbttagcompound.getByte("inTile") & 255;
    this.i = nbttagcompound.getByte("inGround") == 1;
    // CraftBukkit start - direction -> power
    if (nbttagcompound.hasKey("power")) {
      NBTTagList nbttaglist = nbttagcompound.getList("power");

      this.dirX = ((NBTTagDouble) nbttaglist.get(0)).data;
      this.dirY = ((NBTTagDouble) nbttaglist.get(1)).data;
      this.dirZ = ((NBTTagDouble) nbttaglist.get(2)).data;
      // CraftBukkit end
    } else {
      this.die();
    }
  }
コード例 #8
0
ファイル: EntityArrow.java プロジェクト: Nike1234/CraftBukkit
  public void a(NBTTagCompound nbttagcompound) {
    this.d = nbttagcompound.getShort("xTile");
    this.e = nbttagcompound.getShort("yTile");
    this.f = nbttagcompound.getShort("zTile");
    this.g = nbttagcompound.getByte("inTile") & 255;
    this.h = nbttagcompound.getByte("inData") & 255;
    this.shake = nbttagcompound.getByte("shake") & 255;
    this.inGround = nbttagcompound.getByte("inGround") == 1;
    if (nbttagcompound.hasKey("damage")) {
      this.damage = nbttagcompound.getDouble("damage");
    }

    if (nbttagcompound.hasKey("pickup")) {
      this.fromPlayer = nbttagcompound.getByte("pickup");
    } else if (nbttagcompound.hasKey("player")) {
      this.fromPlayer = nbttagcompound.getBoolean("player") ? 1 : 0;
    }
  }
コード例 #9
0
  public void a(NBTTagCompound nbttagcompound) {
    this.m(nbttagcompound.getFloat("AbsorptionAmount"));
    if (nbttagcompound.hasKeyOfType("Attributes", 9)
        && this.world != null
        && !this.world.isStatic) {
      GenericAttributes.a(this.bc(), nbttagcompound.getList("Attributes", 10));
    }

    if (nbttagcompound.hasKeyOfType("ActiveEffects", 9)) {
      NBTTagList nbttaglist = nbttagcompound.getList("ActiveEffects", 10);

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

        if (mobeffect != null) {
          this.effects.put(Integer.valueOf(mobeffect.getEffectId()), mobeffect);
        }
      }
    }

    if (nbttagcompound.hasKeyOfType("HealF", 99)) {
      this.setHealth(nbttagcompound.getFloat("HealF"));
    } else {
      NBTBase nbtbase = nbttagcompound.get("Health");

      if (nbtbase == null) {
        this.setHealth(this.getMaxHealth());
      } else if (nbtbase.getTypeId() == 5) {
        this.setHealth(((NBTTagFloat) nbtbase).h());
      } else if (nbtbase.getTypeId() == 2) {
        this.setHealth((float) ((NBTTagShort) nbtbase).e());
      }
    }

    this.hurtTicks = nbttagcompound.getShort("HurtTime");
    this.deathTicks = nbttagcompound.getShort("DeathTime");
    this.attackTicks = nbttagcompound.getShort("AttackTime");
  }
コード例 #10
0
 public void read(NBTTagCompound var1) {
   super.read(var1);
   this.bs = var1.getShort("Anger");
   String var2 = var1.getString("HurtBy");
   if (!var2.isEmpty()) {
     this.bu = UUID.fromString(var2);
     EntityHuman var3 = this.o.b(this.bu);
     this.b((EntityLiving) var3);
     if (var3 != null) {
       this.aQ = var3;
       this.aR = this.bf();
     }
   }
 }
コード例 #11
0
  public void a(NBTTagCompound nbttagcompound) {
    super.a(nbttagcompound);
    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);
      byte b0 = nbttagcompound1.getByte("Slot");

      if (b0 >= 0 && b0 < this.items.length) {
        this.items[b0] = ItemStack.a(nbttagcompound1);
      }
    }

    this.brewTime = nbttagcompound.getShort("BrewTime");
  }
コード例 #12
0
ファイル: EntityMinecart.java プロジェクト: plleg/mc-dev
  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);
        }
      }
    }
  }
コード例 #13
0
ファイル: EntityEnderman.java プロジェクト: ssamba777/mc-dev
 public void a(NBTTagCompound nbttagcompound) {
   super.a(nbttagcompound);
   this.setCarried(Block.getById(nbttagcompound.getShort("carried")));
   this.setCarriedData(nbttagcompound.getShort("carriedData"));
 }
コード例 #14
0
ファイル: Entity.java プロジェクト: randyzingle/javaalg
  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);
    }
  }
コード例 #15
0
 public void a(NBTTagCompound nbttagcompound) {
   super.a(nbttagcompound);
   this.angerLevel = nbttagcompound.getShort("Anger");
 }
コード例 #16
0
 public void a(NBTTagCompound nbttagcompound) {
   this.d = nbttagcompound.getShort("Health") & 255;
   this.b = nbttagcompound.getShort("Age");
   this.value = nbttagcompound.getShort("Value");
 }