Пример #1
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");
  }
Пример #2
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);
  }
Пример #3
0
 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");
 }
Пример #4
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");
 }
Пример #5
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");
  }
Пример #6
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);
    }
  }