public void a(NBTTagCompound nbttagcompound) {
    super.a(nbttagcompound);
    NBTTagList nbttaglist = nbttagcompound.m("Items");

    this.i = new ItemStack[this.j_()];
    if (nbttagcompound.b("CustomName")) {
      this.s = nbttagcompound.i("CustomName");
    }

    for (int i0 = 0; i0 < nbttaglist.c(); ++i0) {
      NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.b(i0);
      int i1 = nbttagcompound1.c("Slot") & 255;

      if (i1 >= 0 && i1 < this.i.length) {
        this.i[i1] = ItemStack.a(nbttagcompound1);
      }
    }
  }
示例#2
0
  public void e(NBTTagCompound nbttagcompound) {
    NBTTagList nbttaglist = nbttagcompound.l("Pos");
    NBTTagList nbttaglist1 = nbttagcompound.l("Motion");
    NBTTagList nbttaglist2 = nbttagcompound.l("Rotation");

    this.motX = ((NBTTagDouble) nbttaglist1.a(0)).a;
    this.motY = ((NBTTagDouble) nbttaglist1.a(1)).a;
    this.motZ = ((NBTTagDouble) nbttaglist1.a(2)).a;
    /* CraftBukkit start - moved section down
    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;
    }
    // CraftBukkit end */

    this.lastX = this.bo = this.locX = ((NBTTagDouble) nbttaglist.a(0)).a;
    this.lastY = this.bp = this.locY = ((NBTTagDouble) nbttaglist.a(1)).a;
    this.lastZ = this.bq = this.locZ = ((NBTTagDouble) nbttaglist.a(2)).a;
    this.lastYaw = this.yaw = ((NBTTagFloat) nbttaglist2.a(0)).a;
    this.lastPitch = this.pitch = ((NBTTagFloat) nbttaglist2.a(1)).a;
    this.fallDistance = nbttagcompound.g("FallDistance");
    this.fireTicks = nbttagcompound.d("Fire");
    this.airTicks = nbttagcompound.d("Air");
    this.onGround = nbttagcompound.m("OnGround");
    this.setPosition(this.locX, this.locY, this.locZ);

    // CraftBukkit start
    long least = nbttagcompound.f("UUIDLeast");
    long most = nbttagcompound.f("UUIDMost");

    if (least != 0L && most != 0L) {
      this.uniqueId = new UUID(most, least);
    }
    // CraftBukkit end

    this.c(this.yaw, this.pitch);
    this.a(nbttagcompound);

    // CraftBukkit start - Exempt Vehicles from notch's sanity check
    if (!(this.getBukkitEntity() instanceof CraftVehicle)) {
      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;
      }
    }
    // CraftBukkit end

    // CraftBukkit Start - reset world
    CraftWorld world = null;
    if (this instanceof EntityPlayer) {
      EntityPlayer entityPlayer = (EntityPlayer) this;
      String worldName = nbttagcompound.getString("World");
      if (worldName == "") {
        world = ((CraftServer) Bukkit.getServer()).getServer().a(entityPlayer.dimension).getWorld();
      } else {
        world = (CraftWorld) Bukkit.getServer().getWorld(worldName);
      }
    } else {
      world = (CraftWorld) Bukkit.getServer().getWorld(nbttagcompound.getString("World"));
    }

    a(world == null ? null : world.getHandle());
    // CraftBukkit End
  }
示例#3
0
 public void a(String s, NBTTagCompound nbttagcompound) {
   a.put(s, nbttagcompound.m(s));
 }