コード例 #1
0
  public long getLastPlayed() {
    Player player = getPlayer();
    if (player != null) return player.getLastPlayed();

    NBTTagCompound data = getBukkitData();

    if (data != null) {
      if (data.hasKey("lastPlayed")) {
        return data.getLong("lastPlayed");
      } else {
        File file = getDataFile();
        return file.lastModified();
      }
    } else {
      return 0;
    }
  }
コード例 #2
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);
    }
  }