Exemple #1
0
  /** Main function called by run() every loop. */
  public void tick() {
    long var1 = System.nanoTime();
    ++this.tickCounter;

    if (this.startProfiling) {
      this.startProfiling = false;
      this.theProfiler.profilingEnabled = true;
      this.theProfiler.clearProfiling();
    }

    this.theProfiler.startSection("root");
    this.updateTimeLightAndEntities();

    if (var1 - this.nanoTimeSinceStatusRefresh >= 5000000000L) {
      this.nanoTimeSinceStatusRefresh = var1;
      this.statusResponse.setPlayerCountData(
          new ServerStatusResponse.PlayerCountData(
              this.getMaxPlayers(), this.getCurrentPlayerCount()));
      GameProfile[] var3 = new GameProfile[Math.min(this.getCurrentPlayerCount(), 12)];
      int var4 =
          MathHelper.getRandomIntegerInRange(
              this.random, 0, this.getCurrentPlayerCount() - var3.length);

      for (int var5 = 0; var5 < var3.length; ++var5) {
        var3[var5] =
            ((EntityPlayerMP) this.serverConfigManager.playerEntityList.get(var4 + var5))
                .getGameProfile();
      }

      Collections.shuffle(Arrays.asList(var3));
      this.statusResponse.getPlayerCountData().setPlayers(var3);
    }

    if (this.tickCounter % 900 == 0) {
      this.theProfiler.startSection("save");
      this.serverConfigManager.saveAllPlayerData();
      this.saveAllWorlds(true);
      this.theProfiler.endSection();
    }

    this.theProfiler.startSection("tallying");
    this.tickTimeArray[this.tickCounter % 100] = System.nanoTime() - var1;
    this.theProfiler.endSection();
    this.theProfiler.startSection("snooper");

    if (!this.usageSnooper.isSnooperRunning() && this.tickCounter > 100) {
      this.usageSnooper.startSnooper();
    }

    if (this.tickCounter % 6000 == 0) {
      this.usageSnooper.addMemoryStatsToSnooper();
    }

    this.theProfiler.endSection();
    this.theProfiler.endSection();
  }
  @Override
  public void readPageFromXML(Element element) {
    NodeList nodes = element.getElementsByTagName("tooltype");
    if (nodes != null) type = nodes.item(0).getTextContent();

    nodes = element.getElementsByTagName("recipe");
    if (nodes != null) {
      String recipe = nodes.item(0).getTextContent();
      icons = MantleClientRegistry.getRecipeIcons(recipe);

      if (type.equals("travelmulti")) {
        List<ItemStack[]> stacks = new LinkedList<ItemStack[]>();
        List<String> tools = new LinkedList<String>();
        String[] suffixes = new String[] {"goggles", "vest", "wings", "boots", "glove", "belt"};
        for (String suffix : suffixes) {
          ItemStack[] icons2 =
              MantleClientRegistry.getRecipeIcons(nodes.item(0).getTextContent() + suffix);
          if (icons2 != null) {
            stacks.add(icons2);
            tools.add(suffix);
          }
        }

        iconsMulti = new ItemStack[stacks.size()][];
        toolMulti = new ItemStack[stacks.size()];
        for (int i = 0; i < stacks.size(); i++) {
          iconsMulti[i] = stacks.get(i);
          toolMulti[i] = MantleClientRegistry.getManualIcon("travel" + tools.get(i));
        }

        icons = iconsMulti[0];

        lastUpdate = System.currentTimeMillis();
        counter = 0;
      }
    }
  }
  @Override
  public void renderContentLayer(int localWidth, int localHeight, boolean isTranslatable) {
    String tStation = StatCollector.translateToLocal("manual.page.modifier1");
    if (icons.length > 3) tStation = StatCollector.translateToLocal("manual.page.modifier2");
    if (icons.length > 4) tStation = StatCollector.translateToLocal("manual.page.modifier3");
    if (isTranslatable) tStation = StatCollector.translateToLocal(tStation);
    manual.fonts.drawString("\u00a7n" + tStation, localWidth + 60, localHeight + 4, 0);
    GL11.glScalef(2f, 2f, 2f);
    GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    RenderHelper.enableGUIStandardItemLighting();

    ItemStack toolstack = MantleClientRegistry.getManualIcon("ironpick");
    if (type.equals("weapon")) toolstack = MantleClientRegistry.getManualIcon("ironlongsword");
    if (type.equals("travelgoggles"))
      toolstack = MantleClientRegistry.getManualIcon("travelgoggles");
    if (type.equals("travelvest")) toolstack = MantleClientRegistry.getManualIcon("travelvest");
    if (type.equals("travelwings")) toolstack = MantleClientRegistry.getManualIcon("travelwings");
    if (type.equals("travelboots")) toolstack = MantleClientRegistry.getManualIcon("travelboots");
    if (type.equals("travelbelt")) toolstack = MantleClientRegistry.getManualIcon("travelbelt");
    if (type.equals("travelglove")) toolstack = MantleClientRegistry.getManualIcon("travelglove");
    if (type.equals("travelmulti")) toolstack = toolMulti[counter];

    // update displayed item
    if (iconsMulti != null
        && iconsMulti.length > 0
        && type.equals("travelmulti")
        && System.currentTimeMillis() - lastUpdate > 1000) {
      lastUpdate = System.currentTimeMillis();
      counter++;
      if (counter >= iconsMulti.length) counter = 0;
      icons = iconsMulti[counter];
      toolstack = toolMulti[counter];
    }

    manual.renderitem.zLevel = 100;
    if (icons.length < 4) {
      manual.renderitem.renderItemAndEffectIntoGUI(
          manual.fonts,
          manual.getMC().renderEngine,
          toolstack,
          (localWidth + 54) / 2,
          (localHeight + 54) / 2);
      manual.renderitem.renderItemAndEffectIntoGUI(
          manual.fonts,
          manual.getMC().renderEngine,
          icons[0],
          (localWidth + 130) / 2,
          (localHeight + 54) / 2);
      manual.renderitem.renderItemAndEffectIntoGUI(
          manual.fonts,
          manual.getMC().renderEngine,
          icons[1],
          (localWidth + 18) / 2,
          (localHeight + 36) / 2);
      if (icons[2] != null)
        manual.renderitem.renderItemAndEffectIntoGUI(
            manual.fonts,
            manual.getMC().renderEngine,
            icons[2],
            (localWidth + 18) / 2,
            (localHeight + 74) / 2);
    } else {
      manual.renderitem.renderItemAndEffectIntoGUI(
          manual.fonts,
          manual.getMC().renderEngine,
          toolstack,
          (localWidth + 74) / 2,
          (localHeight + 54) / 2);
      manual.renderitem.renderItemAndEffectIntoGUI(
          manual.fonts,
          manual.getMC().renderEngine,
          icons[0],
          (localWidth + 140) / 2,
          (localHeight + 54) / 2);
      manual.renderitem.renderItemAndEffectIntoGUI(
          manual.fonts,
          manual.getMC().renderEngine,
          icons[1],
          (localWidth - 2) / 2,
          (localHeight + 36) / 2);
      manual.renderitem.renderItemAndEffectIntoGUI(
          manual.fonts,
          manual.getMC().renderEngine,
          icons[2],
          (localWidth - 2) / 2,
          (localHeight + 74) / 2);
      manual.renderitem.renderItemAndEffectIntoGUI(
          manual.fonts,
          manual.getMC().renderEngine,
          icons[3],
          (localWidth + 36) / 2,
          (localHeight + 36) / 2);
      if (icons[4] != null)
        manual.renderitem.renderItemAndEffectIntoGUI(
            manual.fonts,
            manual.getMC().renderEngine,
            icons[4],
            (localWidth + 36) / 2,
            (localHeight + 74) / 2);
    }
    manual.renderitem.zLevel = 0;

    GL11.glScalef(0.5F, 0.5F, 0.5F);
    RenderHelper.disableStandardItemLighting();
    GL11.glDisable(GL12.GL_RESCALE_NORMAL);
  }
Exemple #4
0
  public void updateTimeLightAndEntities() {
    this.theProfiler.startSection("jobs");
    Queue var1 = this.futureTaskQueue;

    synchronized (this.futureTaskQueue) {
      while (!this.futureTaskQueue.isEmpty()) {
        try {
          ((FutureTask) this.futureTaskQueue.poll()).run();
        } catch (Throwable var9) {
          logger.fatal(var9);
        }
      }
    }

    this.theProfiler.endStartSection("levels");
    int var11;

    for (var11 = 0; var11 < this.worldServers.length; ++var11) {
      long var2 = System.nanoTime();

      if (var11 == 0 || this.getAllowNether()) {
        WorldServer var4 = this.worldServers[var11];
        this.theProfiler.startSection(var4.getWorldInfo().getWorldName());

        if (this.tickCounter % 20 == 0) {
          this.theProfiler.startSection("timeSync");
          this.serverConfigManager.sendPacketToAllPlayersInDimension(
              new S03PacketTimeUpdate(
                  var4.getTotalWorldTime(),
                  var4.getWorldTime(),
                  var4.getGameRules().getGameRuleBooleanValue("doDaylightCycle")),
              var4.provider.getDimensionId());
          this.theProfiler.endSection();
        }

        this.theProfiler.startSection("tick");
        CrashReport var6;

        try {
          var4.tick();
        } catch (Throwable var8) {
          var6 = CrashReport.makeCrashReport(var8, "Exception ticking world");
          var4.addWorldInfoToCrashReport(var6);
          throw new ReportedException(var6);
        }

        try {
          var4.updateEntities();
        } catch (Throwable var7) {
          var6 = CrashReport.makeCrashReport(var7, "Exception ticking world entities");
          var4.addWorldInfoToCrashReport(var6);
          throw new ReportedException(var6);
        }

        this.theProfiler.endSection();
        this.theProfiler.startSection("tracker");
        var4.getEntityTracker().updateTrackedEntities();
        this.theProfiler.endSection();
        this.theProfiler.endSection();
      }

      this.timeOfLastDimensionTick[var11][this.tickCounter % 100] = System.nanoTime() - var2;
    }

    this.theProfiler.endStartSection("connection");
    this.getNetworkSystem().networkTick();
    this.theProfiler.endStartSection("players");
    this.serverConfigManager.onTick();
    this.theProfiler.endStartSection("tickables");

    for (var11 = 0; var11 < this.playersOnline.size(); ++var11) {
      ((IUpdatePlayerListBox) this.playersOnline.get(var11)).update();
    }

    this.theProfiler.endSection();
  }
Exemple #5
0
 public static long getCurrentTimeMillis() {
   return System.currentTimeMillis();
 }
Exemple #6
0
 /** Overriden in a sign to provide the text. */
 public Packet getDescriptionPacket() {
   IChatComponent[] var1 = new IChatComponent[4];
   System.arraycopy(this.signText, 0, var1, 0, 4);
   return new S33PacketUpdateSign(this.worldObj, this.pos, var1);
 }