コード例 #1
0
 public void readEntityFromNBT(NBTTagCompound nbttagcompound) {
   super.readEntityFromNBT(nbttagcompound);
   NBTTagList nbttaglist = nbttagcompound.getTagList("Inventory");
   inventory.readFromNBT(nbttaglist);
   dimension = nbttagcompound.getInteger("Dimension");
   sleeping = nbttagcompound.getBoolean("Sleeping");
   sleepTimer = nbttagcompound.getShort("SleepTimer");
   currentXP = nbttagcompound.getFloat("XpP");
   playerLevel = nbttagcompound.getInteger("XpLevel");
   totalXP = nbttagcompound.getInteger("XpTotal");
   if (sleeping) {
     bedChunkCoordinates =
         new ChunkCoordinates(
             MathHelper.floor_double(posX),
             MathHelper.floor_double(posY),
             MathHelper.floor_double(posZ));
     wakeUpPlayer(true, true, false);
   }
   if (nbttagcompound.hasKey("SpawnX")
       && nbttagcompound.hasKey("SpawnY")
       && nbttagcompound.hasKey("SpawnZ")) {
     playerSpawnCoordinate =
         new ChunkCoordinates(
             nbttagcompound.getInteger("SpawnX"),
             nbttagcompound.getInteger("SpawnY"),
             nbttagcompound.getInteger("SpawnZ"));
   }
   foodStats.readStatsFromNBT(nbttagcompound);
   capabilities.readCapabilitiesFromNBT(nbttagcompound);
 }
コード例 #2
0
  /** (abstract) Protected helper method to read subclass entity data from NBT. */
  public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) {
    super.readEntityFromNBT(par1NBTTagCompound);
    NBTTagList var2 = par1NBTTagCompound.getTagList("Inventory");
    this.inventory.readFromNBT(var2);
    this.dimension = par1NBTTagCompound.getInteger("Dimension");
    this.sleeping = par1NBTTagCompound.getBoolean("Sleeping");
    this.sleepTimer = par1NBTTagCompound.getShort("SleepTimer");
    this.experience = par1NBTTagCompound.getFloat("XpP");
    this.experienceLevel = par1NBTTagCompound.getInteger("XpLevel");
    this.experienceTotal = par1NBTTagCompound.getInteger("XpTotal");

    if (this.sleeping) {
      this.playerLocation =
          new ChunkCoordinates(
              MathHelper.floor_double(this.posX),
              MathHelper.floor_double(this.posY),
              MathHelper.floor_double(this.posZ));
      this.wakeUpPlayer(true, true, false);
    }

    if (par1NBTTagCompound.hasKey("SpawnX")
        && par1NBTTagCompound.hasKey("SpawnY")
        && par1NBTTagCompound.hasKey("SpawnZ")) {
      this.spawnChunk =
          new ChunkCoordinates(
              par1NBTTagCompound.getInteger("SpawnX"),
              par1NBTTagCompound.getInteger("SpawnY"),
              par1NBTTagCompound.getInteger("SpawnZ"));
    }

    this.foodStats.readNBT(par1NBTTagCompound);
    this.capabilities.readCapabilitiesFromNBT(par1NBTTagCompound);
  }
コード例 #3
0
 public void readEntityFromNBT(NBTTagCompound nbttagcompound) {
   super.readEntityFromNBT(nbttagcompound);
   setSlimeSize(nbttagcompound.getInteger("Size") + 1);
 }