Beispiel #1
0
  /** Recursively called by generate() (generate) and optionally by itself. */
  protected void recursiveGenerate(
      World par1World, int par2, int par3, int par4, int par5, byte[] par6ArrayOfByte) {
    if (!this.structureMap.containsKey(Long.valueOf(ChunkCoordIntPair.chunkXZ2Int(par2, par3)))) {
      this.rand.nextInt();

      try {
        if (this.canSpawnStructureAtCoords(par2, par3)) {
          StructureStart var7 = this.getStructureStart(par2, par3);
          this.structureMap.put(Long.valueOf(ChunkCoordIntPair.chunkXZ2Int(par2, par3)), var7);
        }
      } catch (Throwable var10) {
        CrashReport var8 =
            CrashReport.makeCrashReport(var10, "Exception preparing structure feature");
        CrashReportCategory var9 = var8.makeCategory("Feature being prepared");
        var9.addCrashSectionCallable(
            "Is feature chunk", new CallableIsFeatureChunk(this, par2, par3));
        var9.addCrashSection(
            "Chunk location",
            String.format("%d,%d", new Object[] {Integer.valueOf(par2), Integer.valueOf(par3)}));
        var9.addCrashSectionCallable("Chunk pos hash", new CallableChunkPosHash(this, par2, par3));
        var9.addCrashSectionCallable("Structure type", new CallableStructureType(this));
        throw new ReportedException(var8);
      }
    }
  }
  /** Handles all incoming connections and packets */
  public void handleNetworkListenThread() {
    for (int var1 = 0; var1 < this.connections.size(); ++var1) {
      NetServerHandler var2 = (NetServerHandler) this.connections.get(var1);

      try {
        var2.handlePackets();
      } catch (Exception var5) {
        if (var2.netManager instanceof MemoryConnection) {
          CrashReport var4 = CrashReport.makeCrashReport(var5, "Ticking memory connection");
          throw new ReportedException(var4);
        }

        this.mcServer
            .getLogAgent()
            .logWarningException(
                "Failed to handle packet for "
                    + var2.playerEntity.getEntityName()
                    + "/"
                    + var2.playerEntity.getPlayerIP()
                    + ": "
                    + var5,
                var5);
        var2.kickPlayer("Internal server error");
      }

      if (var2.connectionClosed) {
        this.connections.remove(var1--);
      }

      var2.netManager.wakeThreads();
    }
  }
Beispiel #3
0
  public void onUpdateEntity() {
    try {
      super.onUpdate();

      for (int var1 = 0; var1 < this.inventory.getSizeInventory(); ++var1) {
        ItemStack var6 = this.inventory.getStackInSlot(var1);

        if (var6 != null
            && Item.itemsList[var6.itemID].isMap()
            && this.playerNetServerHandler.packetSize() <= 5) {
          Packet var8 =
              ((ItemMapBase) Item.itemsList[var6.itemID])
                  .createMapDataPacket(var6, this.worldObj, this);

          if (var8 != null) {
            this.playerNetServerHandler.sendPacketToPlayer(var8);
          }
        }
      }

      if (this.func_110143_aJ() != this.lastHealth
          || this.lastFoodLevel != this.foodStats.getFoodLevel()
          || this.foodStats.getSaturationLevel() == 0.0F != this.wasHungry) {
        this.playerNetServerHandler.sendPacketToPlayer(
            new Packet8UpdateHealth(
                this.func_110143_aJ(),
                this.foodStats.getFoodLevel(),
                this.foodStats.getSaturationLevel()));
        this.lastHealth = this.func_110143_aJ();
        this.lastFoodLevel = this.foodStats.getFoodLevel();
        this.wasHungry = this.foodStats.getSaturationLevel() == 0.0F;
      }

      if (this.func_110143_aJ() + this.func_110139_bj() != this.field_130068_bO) {
        this.field_130068_bO = this.func_110143_aJ() + this.func_110139_bj();
        Collection var5 =
            this.getWorldScoreboard().func_96520_a(ScoreObjectiveCriteria.field_96638_f);
        Iterator var7 = var5.iterator();

        while (var7.hasNext()) {
          ScoreObjective var9 = (ScoreObjective) var7.next();
          this.getWorldScoreboard()
              .func_96529_a(this.getEntityName(), var9)
              .func_96651_a(Arrays.asList(new EntityPlayer[] {this}));
        }
      }

      if (this.experienceTotal != this.lastExperience) {
        this.lastExperience = this.experienceTotal;
        this.playerNetServerHandler.sendPacketToPlayer(
            new Packet43Experience(this.experience, this.experienceTotal, this.experienceLevel));
      }
    } catch (Throwable var4) {
      CrashReport var2 = CrashReport.makeCrashReport(var4, "Ticking player");
      CrashReportCategory var3 = var2.makeCategory("Player being ticked");
      this.func_85029_a(var3);
      throw new ReportedException(var2);
    }
  }
Beispiel #4
0
  /** Runs through the list of updates to run and ticks them */
  public boolean tickUpdates(boolean par1) {
    int var2 = this.pendingTickListEntriesTreeSet.size();

    if (var2 != this.pendingTickListEntriesHashSet.size()) {
      throw new IllegalStateException("TickNextTick list out of synch");
    } else {
      if (var2 > 1000) {
        var2 = 1000;
      }

      this.theProfiler.startSection("cleaning");
      NextTickListEntry var4;

      for (int var3 = 0; var3 < var2; ++var3) {
        var4 = (NextTickListEntry) this.pendingTickListEntriesTreeSet.first();

        if (!par1 && var4.scheduledTime > this.worldInfo.getWorldTotalTime()) {
          break;
        }

        this.pendingTickListEntriesTreeSet.remove(var4);
        this.pendingTickListEntriesHashSet.remove(var4);
        this.pendingTickListEntriesThisTick.add(var4);
      }

      this.theProfiler.endSection();
      this.theProfiler.startSection("ticking");
      Iterator var14 = this.pendingTickListEntriesThisTick.iterator();

      while (var14.hasNext()) {
        var4 = (NextTickListEntry) var14.next();
        var14.remove();
        byte var5 = 0;

        if (this.checkChunksExist(
            var4.xCoord - var5,
            var4.yCoord - var5,
            var4.zCoord - var5,
            var4.xCoord + var5,
            var4.yCoord + var5,
            var4.zCoord + var5)) {
          int var6 = this.getBlockId(var4.xCoord, var4.yCoord, var4.zCoord);

          if (var6 > 0 && Block.isAssociatedBlockID(var6, var4.blockID)) {
            try {
              Block.blocksList[var6].updateTick(
                  this, var4.xCoord, var4.yCoord, var4.zCoord, this.rand);
            } catch (Throwable var13) {
              CrashReport var8 =
                  CrashReport.makeCrashReport(var13, "Exception while ticking a block");
              CrashReportCategory var9 = var8.makeCategory("Block being ticked");
              int var10;

              try {
                var10 = this.getBlockMetadata(var4.xCoord, var4.yCoord, var4.zCoord);
              } catch (Throwable var12) {
                var10 = -1;
              }

              CrashReportCategory.func_85068_a(
                  var9, var4.xCoord, var4.yCoord, var4.zCoord, var6, var10);
              throw new ReportedException(var8);
            }
          }
        } else {
          this.scheduleBlockUpdate(var4.xCoord, var4.yCoord, var4.zCoord, var4.blockID, 0);
        }
      }

      this.theProfiler.endSection();
      this.pendingTickListEntriesThisTick.clear();
      return !this.pendingTickListEntriesTreeSet.isEmpty();
    }
  }