public boolean loadTexture(ResourceLocation p_110579_1_, final ITextureObject p_110579_2_) {
    boolean flag = true;
    ITextureObject p_110579_2_2 = p_110579_2_;

    try {
      ((ITextureObject) p_110579_2_).loadTexture(this.theResourceManager);
    } catch (IOException ioexception) {
      logger.warn("Failed to load texture: " + p_110579_1_, ioexception);
      p_110579_2_2 = TextureUtil.missingTexture;
      this.mapTextureObjects.put(p_110579_1_, p_110579_2_2);
      flag = false;
    } catch (Throwable throwable) {
      CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Registering texture");
      CrashReportCategory crashreportcategory =
          crashreport.makeCategory("Resource location being registered");
      crashreportcategory.addCrashSection("Resource location", p_110579_1_);
      crashreportcategory.addCrashSectionCallable(
          "Texture object class",
          new Callable() {
            private static final String __OBFID = "CL_00001065";

            public String call() {
              return p_110579_2_.getClass().getName();
            }
          });
      throw new ReportedException(crashreport);
    }

    this.mapTextureObjects.put(p_110579_1_, p_110579_2_2);
    return flag;
  }
Пример #2
0
  public boolean loadTexture(ResourceLocation textureLocation, ITextureObject textureObj) {
    boolean flag = true;

    try {
      ((ITextureObject) textureObj).loadTexture(this.theResourceManager);
    } catch (IOException ioexception) {
      logger.warn((String) ("Failed to load texture: " + textureLocation), (Throwable) ioexception);
      textureObj = TextureUtil.missingTexture;
      this.mapTextureObjects.put(textureLocation, (ITextureObject) textureObj);
      flag = false;
    } catch (Throwable throwable) {
      final ITextureObject textureObjf = textureObj;
      CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Registering texture");
      CrashReportCategory crashreportcategory =
          crashreport.makeCategory("Resource location being registered");
      crashreportcategory.addCrashSection("Resource location", textureLocation);
      crashreportcategory.addCrashSectionCallable(
          "Texture object class",
          new Callable<String>() {
            public String call() throws Exception {
              return textureObjf.getClass().getName();
            }
          });
      throw new ReportedException(crashreport);
    }

    this.mapTextureObjects.put(textureLocation, (ITextureObject) textureObj);
    return flag;
  }
  /** Returns an array of biomes for the location input. */
  public BiomeGenBase[] getBiomesForGeneration(
      BiomeGenBase[] p_76937_1_, int p_76937_2_, int p_76937_3_, int p_76937_4_, int p_76937_5_) {
    IntCache.resetIntCache();

    if (p_76937_1_ == null || p_76937_1_.length < p_76937_4_ * p_76937_5_) {
      p_76937_1_ = new BiomeGenBase[p_76937_4_ * p_76937_5_];
    }

    int[] var6 = this.genBiomes.getInts(p_76937_2_, p_76937_3_, p_76937_4_, p_76937_5_);

    try {
      for (int var7 = 0; var7 < p_76937_4_ * p_76937_5_; ++var7) {
        p_76937_1_[var7] =
            BiomeGenBase.getBiomeFromBiomeList(var6[var7], BiomeGenBase.field_180279_ad);
      }

      return p_76937_1_;
    } catch (Throwable var10) {
      CrashReport var8 = CrashReport.makeCrashReport(var10, "Invalid Biome id");
      CrashReportCategory var9 = var8.makeCategory("RawBiomeBlock");
      var9.addCrashSection("biomes[] size", Integer.valueOf(p_76937_1_.length));
      var9.addCrashSection("x", Integer.valueOf(p_76937_2_));
      var9.addCrashSection("z", Integer.valueOf(p_76937_3_));
      var9.addCrashSection("w", Integer.valueOf(p_76937_4_));
      var9.addCrashSection("h", Integer.valueOf(p_76937_5_));
      throw new ReportedException(var8);
    }
  }
  /** checks given Chunk's Biomes against List of allowed ones */
  @Override
  public boolean areBiomesViable(int par1, int par2, int par3, List par4List) {
    IntCache.resetIntCache();
    int l = par1 - par3 >> 2;
    int i1 = par2 - par3 >> 2;
    int j1 = par1 + par3 >> 2;
    int k1 = par2 + par3 >> 2;
    int l1 = j1 - l + 1;
    int i2 = k1 - i1 + 1;
    int[] aint = this.mbGenBiomes.getInts(l, i1, l1, i2);

    try {
      for (int j2 = 0; j2 < l1 * i2; ++j2) {
        BiomeGenBase biomegenbase = BiomeGenBase.getBiome(aint[j2]);

        if (!par4List.contains(biomegenbase)) {
          return false;
        }
      }

      return true;
    } catch (Throwable throwable) {
      CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Invalid Biome id");
      CrashReportCategory crashreportcategory = crashreport.makeCategory("Layer");
      crashreportcategory.addCrashSection("Layer", this.mbGenBiomes.toString());
      crashreportcategory.addCrashSection("x", Integer.valueOf(par1));
      crashreportcategory.addCrashSection("z", Integer.valueOf(par2));
      crashreportcategory.addCrashSection("radius", Integer.valueOf(par3));
      crashreportcategory.addCrashSection("allowed", par4List);
      throw new ReportedException(crashreport);
    }
  }
  private void updateEffects() {
    for (int k = 0; k < fxes.length; ++k) {

      for (int j = 0; j < this.fxes[k].size(); ++j) {
        final EntityFX entityfx = this.fxes[k].get(j);

        try {
          if (entityfx != null) {
            entityfx.onUpdate();
          }
        } catch (Throwable throwable) {
          CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Ticking Particle");
          CrashReportCategory crashreportcategory =
              crashreport.makeCategory("Particle being ticked");
          crashreportcategory.addCrashSectionCallable(
              "Particle",
              new Callable() {
                private static final String __OBFID = "CL_00000916";

                public String call() {
                  return entityfx.toString();
                }
              });
          throw new ReportedException(crashreport);
        }

        if (entityfx == null || entityfx.isDead) {
          this.fxes[k].remove(j--);
        }
      }
    }
  }
  /** Returns an array of biomes for the location input. */
  @Override
  public BiomeGenBase[] getBiomesForGeneration(
      BiomeGenBase[] par1ArrayOfBiomeGenBase, int par2, int par3, int par4, int par5) {
    IntCache.resetIntCache();

    if (par1ArrayOfBiomeGenBase == null || par1ArrayOfBiomeGenBase.length < par4 * par5) {
      par1ArrayOfBiomeGenBase = new BiomeGenBase[par4 * par5];
    }

    int[] aint = this.mbGenBiomes.getInts(par2, par3, par4, par5);

    try {
      for (int i1 = 0; i1 < par4 * par5; ++i1) {
        par1ArrayOfBiomeGenBase[i1] = BiomeGenBase.getBiome(aint[i1]);
      }

      return par1ArrayOfBiomeGenBase;
    } catch (Throwable throwable) {
      CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Invalid Biome id");
      CrashReportCategory crashreportcategory = crashreport.makeCategory("RawBiomeBlock");
      crashreportcategory.addCrashSection(
          "biomes[] size", Integer.valueOf(par1ArrayOfBiomeGenBase.length));
      crashreportcategory.addCrashSection("x", Integer.valueOf(par2));
      crashreportcategory.addCrashSection("z", Integer.valueOf(par3));
      crashreportcategory.addCrashSection("w", Integer.valueOf(par4));
      crashreportcategory.addCrashSection("h", Integer.valueOf(par5));
      throw new ReportedException(crashreport);
    }
  }
  /** checks given Chunk's Biomes against List of allowed ones */
  public boolean areBiomesViable(int p_76940_1_, int p_76940_2_, int p_76940_3_, List p_76940_4_) {
    IntCache.resetIntCache();
    int var5 = p_76940_1_ - p_76940_3_ >> 2;
    int var6 = p_76940_2_ - p_76940_3_ >> 2;
    int var7 = p_76940_1_ + p_76940_3_ >> 2;
    int var8 = p_76940_2_ + p_76940_3_ >> 2;
    int var9 = var7 - var5 + 1;
    int var10 = var8 - var6 + 1;
    int[] var11 = this.genBiomes.getInts(var5, var6, var9, var10);

    try {
      for (int var12 = 0; var12 < var9 * var10; ++var12) {
        BiomeGenBase var16 = BiomeGenBase.getBiome(var11[var12]);

        if (!p_76940_4_.contains(var16)) {
          return false;
        }
      }

      return true;
    } catch (Throwable var15) {
      CrashReport var13 = CrashReport.makeCrashReport(var15, "Invalid Biome id");
      CrashReportCategory var14 = var13.makeCategory("Layer");
      var14.addCrashSection("Layer", this.genBiomes.toString());
      var14.addCrashSection("x", Integer.valueOf(p_76940_1_));
      var14.addCrashSection("z", Integer.valueOf(p_76940_2_));
      var14.addCrashSection("radius", Integer.valueOf(p_76940_3_));
      var14.addCrashSection("allowed", p_76940_4_);
      throw new ReportedException(var13);
    }
  }
Пример #8
0
  private CrashReport func_82581_a(
      String p_82581_1_, int p_82581_2_, ClassCastException p_82581_3_) {
    CrashReport var4 = CrashReport.func_85055_a(p_82581_3_, "Reading NBT data");
    CrashReportCategory var5 = var4.func_85057_a("Corrupt NBT tag", 1);
    var5.func_71500_a("Tag type found", new CallableTagCompound1(this, p_82581_1_));
    var5.func_71500_a("Tag type expected", new CallableTagCompound2(this, p_82581_2_));
    var5.func_71507_a("Tag name", p_82581_1_);
    if (this.func_74740_e() != null && this.func_74740_e().length() > 0) {
      var5.func_71507_a("Tag parent", this.func_74740_e());
    }

    return var4;
  }
  public void renderParticles(Entity entity, float f) {
    float f1 = ActiveRenderInfo.rotationX;
    float f2 = ActiveRenderInfo.rotationZ;
    float f3 = ActiveRenderInfo.rotationYZ;
    float f4 = ActiveRenderInfo.rotationXY;
    float f5 = ActiveRenderInfo.rotationXZ;
    EntityFX.interpPosX = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * (double) f;
    EntityFX.interpPosY = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * (double) f;
    EntityFX.interpPosZ = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * (double) f;

    for (int k = 0; k < fxes.length; ++k) {
      if (!this.fxes[k].isEmpty()) {
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        GL11.glDepthMask(false);
        GL11.glEnable(GL11.GL_BLEND);
        switch (k) {
          case 0:
            GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE);
            renderer.bindTexture(additiveTextureSheet);
            break;
        }

        GL11.glAlphaFunc(GL11.GL_GREATER, 0.003921569F);
        Tessellator tessellator = Tessellator.instance;
        tessellator.startDrawingQuads();

        for (int j = 0; j < this.fxes[k].size(); ++j) {
          final EntityFX entityfx = this.fxes[k].get(j);
          if (entityfx == null) continue;
          tessellator.setBrightness(entityfx.getBrightnessForRender(f));

          try {
            entityfx.renderParticle(tessellator, f, f1, f5, f2, f3, f4);
          } catch (Throwable throwable) {
            CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Rendering Particle");
            CrashReportCategory crashreportcategory =
                crashreport.makeCategory("Particle being rendered");
            crashreportcategory.addCrashSectionCallable("Particle", entityfx::toString);
            throw new ReportedException(crashreport);
          }
        }

        tessellator.draw();
        GL11.glDisable(GL11.GL_BLEND);
        GL11.glDepthMask(true);
        GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F);
      }
    }
  }
Пример #10
0
  private DataWatcher.WatchableObject func_75691_i(int p_75691_1_) {
    this.field_75694_d.readLock().lock();

    DataWatcher.WatchableObject var2;
    try {
      var2 = (DataWatcher.WatchableObject) this.field_75695_b.get(Integer.valueOf(p_75691_1_));
    } catch (Throwable var6) {
      CrashReport var4 = CrashReport.func_85055_a(var6, "Getting synched entity data");
      CrashReportCategory var5 = var4.func_85058_a("Synched entity data");
      var5.func_71507_a("Data ID", Integer.valueOf(p_75691_1_));
      throw new ReportedException(var4);
    }

    this.field_75694_d.readLock().unlock();
    return var2;
  }
Пример #11
0
  /** is threadsafe, unless it throws an exception, then */
  private WatchableObject getWatchedObject(int par1) {
    this.lock.readLock().lock();
    WatchableObject watchableobject;

    try {
      watchableobject = (WatchableObject) this.watchedObjects.get(Integer.valueOf(par1));
    } catch (Throwable throwable) {
      CrashReport crashreport =
          CrashReport.makeCrashReport(throwable, "Getting synched entity data");
      CrashReportCategory crashreportcategory = crashreport.makeCategory("Synched entity data");
      crashreportcategory.addCrashSection("Data ID", Integer.valueOf(par1));
      throw new ReportedException(crashreport);
    }

    this.lock.readLock().unlock();
    return watchableobject;
  }
Пример #12
0
  private <T> EntityDataManager.DataEntry<T> getEntry(DataParameter<T> key) {
    this.lock.readLock().lock();
    EntityDataManager.DataEntry<T> dataentry;

    try {
      dataentry = (EntityDataManager.DataEntry) this.entries.get(Integer.valueOf(key.getId()));
    } catch (Throwable throwable) {
      CrashReport crashreport =
          CrashReport.makeCrashReport(throwable, "Getting synched entity data");
      CrashReportCategory crashreportcategory = crashreport.makeCategory("Synched entity data");
      crashreportcategory.addCrashSection("Data ID", key);
      throw new ReportedException(crashreport);
    }

    this.lock.readLock().unlock();
    return dataentry;
  }
Пример #13
0
  /** Adds the server info, including from theWorldServer, to the crash report. */
  public CrashReport addServerInfoToCrashReport(CrashReport par1CrashReport) {
    par1CrashReport
        .func_85056_g()
        .addCrashSectionCallable("Profiler Position", new CallableIsServerModded(this));

    if (this.worldServers != null && this.worldServers.length > 0 && this.worldServers[0] != null) {
      par1CrashReport
          .func_85056_g()
          .addCrashSectionCallable("Vec3 Pool Size", new CallableServerProfiler(this));
    }

    if (this.serverConfigManager != null) {
      par1CrashReport
          .func_85056_g()
          .addCrashSectionCallable("Player Count", new CallableServerMemoryStats(this));
    }

    return par1CrashReport;
  }
Пример #14
0
  protected static boolean func_151616_a(final int p_151616_0_, final int p_151616_1_) {
    if (p_151616_0_ == p_151616_1_) {
      return true;
    } else if (p_151616_0_ != BiomeGenBase.field_150607_aa.biomeID
        && p_151616_0_ != BiomeGenBase.field_150608_ab.biomeID) {
      try {
        return BiomeGenBase.func_150568_d(p_151616_0_) != null
                && BiomeGenBase.func_150568_d(p_151616_1_) != null
            ? BiomeGenBase.func_150568_d(p_151616_0_)
                .func_150569_a(BiomeGenBase.func_150568_d(p_151616_1_))
            : false;
      } catch (Throwable var5) {
        CrashReport var3 = CrashReport.makeCrashReport(var5, "Comparing biomes");
        CrashReportCategory var4 = var3.makeCategory("Biomes being compared");
        var4.addCrashSection("Biome A ID", Integer.valueOf(p_151616_0_));
        var4.addCrashSection("Biome B ID", Integer.valueOf(p_151616_1_));
        var4.addCrashSectionCallable(
            "Biome A",
            new Callable() {
              private static final String __OBFID = "CL_00000560";

              public String call() {
                return String.valueOf(BiomeGenBase.func_150568_d(p_151616_0_));
              }
            });
        var4.addCrashSectionCallable(
            "Biome B",
            new Callable() {
              private static final String __OBFID = "CL_00000561";

              public String call() {
                return String.valueOf(BiomeGenBase.func_150568_d(p_151616_1_));
              }
            });
        throw new ReportedException(var3);
      }
    } else {
      return p_151616_1_ == BiomeGenBase.field_150607_aa.biomeID
          || p_151616_1_ == BiomeGenBase.field_150608_ab.biomeID;
    }
  }
Пример #15
0
 public void run() {
   try {
     while (true) {
       this.func_178474_a(this.field_178477_b.func_178511_d());
     }
   } catch (InterruptedException var3) {
     LOGGER.debug("Stopping due to interrupt");
   } catch (Throwable var4) {
     CrashReport var2 = CrashReport.makeCrashReport(var4, "Batching chunks");
     Minecraft.getMinecraft()
         .crashed(Minecraft.getMinecraft().addGraphicsAndWorldToCrashReport(var2));
   }
 }
Пример #16
0
  /**
   * Returns a list of rainfall values for the specified blocks. Args: listToReuse, x, z, width,
   * length.
   */
  public float[] getRainfall(
      float[] p_76936_1_, int p_76936_2_, int p_76936_3_, int p_76936_4_, int p_76936_5_) {
    IntCache.resetIntCache();

    if (p_76936_1_ == null || p_76936_1_.length < p_76936_4_ * p_76936_5_) {
      p_76936_1_ = new float[p_76936_4_ * p_76936_5_];
    }

    int[] var6 = this.biomeIndexLayer.getInts(p_76936_2_, p_76936_3_, p_76936_4_, p_76936_5_);

    for (int var7 = 0; var7 < p_76936_4_ * p_76936_5_; ++var7) {
      try {
        float var8 =
            (float)
                    BiomeGenBase.getBiomeFromBiomeList(var6[var7], BiomeGenBase.field_180279_ad)
                        .getIntRainfall()
                / 65536.0F;

        if (var8 > 1.0F) {
          var8 = 1.0F;
        }

        p_76936_1_[var7] = var8;
      } catch (Throwable var11) {
        CrashReport var9 = CrashReport.makeCrashReport(var11, "Invalid Biome id");
        CrashReportCategory var10 = var9.makeCategory("DownfallBlock");
        var10.addCrashSection("biome id", Integer.valueOf(var7));
        var10.addCrashSection("downfalls[] size", Integer.valueOf(p_76936_1_.length));
        var10.addCrashSection("x", Integer.valueOf(p_76936_2_));
        var10.addCrashSection("z", Integer.valueOf(p_76936_3_));
        var10.addCrashSection("w", Integer.valueOf(p_76936_4_));
        var10.addCrashSection("h", Integer.valueOf(p_76936_5_));
        throw new ReportedException(var9);
      }
    }

    return p_76936_1_;
  }
Пример #17
0
  public static void populateCrashReport(CrashReport crashReport) {
    if (EventProxy.error != null) {
      CrashReportCategory category = crashReport.makeCategoryDepth("Event Handler Error", 1);

      category.addCrashSectionCallable(
          EventProxy.error,
          new Callable<String>() {
            @Override
            public String call() throws Exception {
              return EventProxy.errorDetails.toString();
            }
          });
    }
  }
  /** Adds the server info, including from theWorldServer, to the crash report. */
  public CrashReport addServerInfoToCrashReport(CrashReport par1CrashReport) {
    par1CrashReport = super.addServerInfoToCrashReport(par1CrashReport);
    par1CrashReport
        .getCategory()
        .addCrashSectionCallable(
            "Type",
            new Callable() {
              private static final String __OBFID = "CL_00001130";

              public String call() {
                return "Integrated Server (map_client.txt)";
              }
            });
    par1CrashReport
        .getCategory()
        .addCrashSectionCallable(
            "Is Modded",
            new Callable() {
              private static final String __OBFID = "CL_00001131";

              public String call() {
                String var1 = ClientBrandRetriever.getClientModName();

                if (!var1.equals("vanilla")) {
                  return "Definitely; Client brand changed to \'" + var1 + "\'";
                } else {
                  var1 = IntegratedServer.this.getServerModName();
                  return !var1.equals("vanilla")
                      ? "Definitely; Server brand changed to \'" + var1 + "\'"
                      : (Minecraft.class.getSigners() == null
                          ? "Very likely; Jar signature invalidated"
                          : "Probably not. Jar signature remains and both client + server brands are untouched.");
                }
              }
            });
    return par1CrashReport;
  }
Пример #19
0
  /** Adds the server info, including from theWorldServer, to the crash report. */
  public CrashReport addServerInfoToCrashReport(CrashReport report) {
    report
        .getCategory()
        .addCrashSectionCallable(
            "Profiler Position",
            new Callable() {

              public String func_179879_a() {
                return MinecraftServer.this.theProfiler.profilingEnabled
                    ? MinecraftServer.this.theProfiler.getNameOfLastSection()
                    : "N/A (disabled)";
              }

              public Object call() {
                return this.func_179879_a();
              }
            });

    if (this.serverConfigManager != null) {
      report
          .getCategory()
          .addCrashSectionCallable(
              "Player Count",
              new Callable() {

                public String call() {
                  return MinecraftServer.this.serverConfigManager.getCurrentPlayerCount()
                      + " / "
                      + MinecraftServer.this.serverConfigManager.getMaxPlayers()
                      + "; "
                      + MinecraftServer.this.serverConfigManager.playerEntityList;
                }
              });
    }

    return report;
  }
Пример #20
0
  /**
   * Renders the specified entity with the passed in position, yaw, and partialTickTime. Args:
   * entity, x, y, z, yaw, partialTickTime
   */
  public void renderEntityWithPosYaw(
      Entity par1Entity, double par2, double par4, double par6, float par8, float par9) {
    Render render = null;

    try {
      render = this.getEntityRenderObject(par1Entity);

      if (render != null && this.renderEngine != null) {
        if (field_85095_o && !par1Entity.isInvisible()) {
          try {
            this.func_85094_b(par1Entity, par2, par4, par6, par8, par9);
          } catch (Throwable throwable) {
            throw new ReportedException(
                CrashReport.makeCrashReport(throwable, "Rendering entity hitbox in world"));
          }
        }

        try {
          render.doRender(par1Entity, par2, par4, par6, par8, par9);
        } catch (Throwable throwable1) {
          throw new ReportedException(
              CrashReport.makeCrashReport(throwable1, "Rendering entity in world"));
        }

        try {
          render.doRenderShadowAndFire(par1Entity, par2, par4, par6, par8, par9);
        } catch (Throwable throwable2) {
          throw new ReportedException(
              CrashReport.makeCrashReport(throwable2, "Post-rendering entity in world"));
        }
      }
    } catch (Throwable throwable3) {
      CrashReport crashreport =
          CrashReport.makeCrashReport(throwable3, "Rendering entity in world");
      CrashReportCategory crashreportcategory = crashreport.makeCategory("Entity being rendered");
      par1Entity.func_85029_a(crashreportcategory);
      CrashReportCategory crashreportcategory1 = crashreport.makeCategory("Renderer details");
      crashreportcategory1.addCrashSection("Assigned renderer", render);
      crashreportcategory1.addCrashSection(
          "Location", CrashReportCategory.func_85074_a(par2, par4, par6));
      crashreportcategory1.addCrashSection("Rotation", Float.valueOf(par8));
      crashreportcategory1.addCrashSection("Delta", Float.valueOf(par9));
      throw new ReportedException(crashreport);
    }
  }
Пример #21
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();
  }
Пример #22
0
  public void run() {
    try {
      if (this.startServer()) {
        this.currentTime = getCurrentTimeMillis();
        long var1 = 0L;
        this.statusResponse.setServerDescription(new ChatComponentText(this.motd));
        this.statusResponse.setProtocolVersionInfo(
            new ServerStatusResponse.MinecraftProtocolVersionIdentifier("1.8", 47));
        this.addFaviconToStatusResponse(this.statusResponse);

        while (this.serverRunning) {
          long var48 = getCurrentTimeMillis();
          long var5 = var48 - this.currentTime;

          if (var5 > 2000L && this.currentTime - this.timeOfLastWarning >= 15000L) {
            logger.warn(
                "Can\'t keep up! Did the system time change, or is the server overloaded? Running {}ms behind, skipping {} tick(s)",
                new Object[] {Long.valueOf(var5), Long.valueOf(var5 / 50L)});
            var5 = 2000L;
            this.timeOfLastWarning = this.currentTime;
          }

          if (var5 < 0L) {
            logger.warn("Time ran backwards! Did the system time change?");
            var5 = 0L;
          }

          var1 += var5;
          this.currentTime = var48;

          if (this.worldServers[0].areAllPlayersAsleep()) {
            this.tick();
            var1 = 0L;
          } else {
            while (var1 > 50L) {
              var1 -= 50L;
              this.tick();
            }
          }

          Thread.sleep(Math.max(1L, 50L - var1));
          this.serverIsRunning = true;
        }
      } else {
        this.finalTick((CrashReport) null);
      }
    } catch (Throwable var46) {
      logger.error("Encountered an unexpected exception", var46);
      CrashReport var2 = null;

      if (var46 instanceof ReportedException) {
        var2 = this.addServerInfoToCrashReport(((ReportedException) var46).getCrashReport());
      } else {
        var2 =
            this.addServerInfoToCrashReport(
                new CrashReport("Exception in server tick loop", var46));
      }

      File var3 =
          new File(
              new File(this.getDataDirectory(), "crash-reports"),
              "crash-"
                  + (new SimpleDateFormat("yyyy-MM-dd_HH.mm.ss")).format(new Date())
                  + "-server.txt");

      if (var2.saveToFile(var3)) {
        logger.error("This crash report has been saved to: " + var3.getAbsolutePath());
      } else {
        logger.error("We were unable to save this crash report to disk.");
      }

      this.finalTick(var2);
    } finally {
      try {
        this.stopServer();
        this.serverStopped = true;
      } catch (Throwable var44) {
        logger.error("Exception stopping the server", var44);
      } finally {
        this.systemExitNow();
      }
    }
  }
  public void onUpdateEntity() {
    try {
      super.onUpdate();

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

        if (itemstack != null && itemstack.getItem().isMap()) {
          Packet packet =
              ((ItemMapBase) itemstack.getItem())
                  .createMapDataPacket(itemstack, this.worldObj, this);

          if (packet != null) {
            this.playerNetServerHandler.sendPacket(packet);
          }
        }
      }

      if (this.getHealth() != this.lastHealth
          || this.lastFoodLevel != this.foodStats.getFoodLevel()
          || this.foodStats.getSaturationLevel() == 0.0F != this.wasHungry) {
        this.playerNetServerHandler.sendPacket(
            new S06PacketUpdateHealth(
                this.getHealth(),
                this.foodStats.getFoodLevel(),
                this.foodStats.getSaturationLevel()));
        this.lastHealth = this.getHealth();
        this.lastFoodLevel = this.foodStats.getFoodLevel();
        this.wasHungry = this.foodStats.getSaturationLevel() == 0.0F;
      }

      if (this.getHealth() + this.getAbsorptionAmount() != this.field_130068_bO) {
        this.field_130068_bO = this.getHealth() + this.getAbsorptionAmount();
        Collection collection =
            this.getWorldScoreboard().func_96520_a(IScoreObjectiveCriteria.health);
        Iterator iterator = collection.iterator();

        while (iterator.hasNext()) {
          ScoreObjective scoreobjective = (ScoreObjective) iterator.next();
          this.getWorldScoreboard()
              .getValueFromObjective(this.getCommandSenderName(), scoreobjective)
              .func_96651_a(Arrays.asList(new EntityPlayer[] {this}));
        }
      }

      if (this.experienceTotal != this.lastExperience) {
        this.lastExperience = this.experienceTotal;
        this.playerNetServerHandler.sendPacket(
            new S1FPacketSetExperience(
                this.experience, this.experienceTotal, this.experienceLevel));
      }

      if (this.ticksExisted % 20 * 5 == 0
          && !this.getStatFile().hasAchievementUnlocked(AchievementList.exploreAllBiomes)) {
        this.func_147098_j();
      }
    } catch (Throwable throwable) {
      CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Ticking player");
      CrashReportCategory crashreportcategory = crashreport.makeCategory("Player being ticked");
      this.addEntityCrashInfo(crashreportcategory);
      throw new ReportedException(crashreport);
    }
  }
Пример #24
0
  public void run() {
    try {
      if (this.startServer()) {
        FMLCommonHandler.instance().handleServerStarted();

        long i = System.currentTimeMillis();

        FMLCommonHandler.instance().onWorldLoadTick(worldServers);

        for (long j = 0L; this.serverRunning; this.serverIsRunning = true) {
          long k = System.currentTimeMillis();
          long l = k - i;

          if (l > 2000L && i - this.timeOfLastWarning >= 15000L) {
            this.func_98033_al()
                .func_98236_b(
                    "Can\'t keep up! Did the system time change, or is the server overloaded?");
            l = 2000L;
            this.timeOfLastWarning = i;
          }

          if (l < 0L) {
            this.func_98033_al().func_98236_b("Time ran backwards! Did the system time change?");
            l = 0L;
          }

          j += l;
          i = k;

          if (this.worldServers[0].areAllPlayersAsleep()) {
            this.tick();
            j = 0L;
          } else {
            while (j > 50L) {
              j -= 50L;
              this.tick();
            }
          }

          Thread.sleep(1L);
        }
        FMLCommonHandler.instance().handleServerStopping();
      } else {
        this.finalTick((CrashReport) null);
      }
    } catch (Throwable throwable) {
      if (FMLCommonHandler.instance().shouldServerBeKilledQuietly()) {
        return;
      }
      throwable.printStackTrace();
      this.func_98033_al()
          .func_98234_c(
              "Encountered an unexpected exception " + throwable.getClass().getSimpleName(),
              throwable);
      CrashReport crashreport = null;

      if (throwable instanceof ReportedException) {
        crashreport =
            this.addServerInfoToCrashReport(((ReportedException) throwable).getCrashReport());
      } else {
        crashreport =
            this.addServerInfoToCrashReport(
                new CrashReport("Exception in server tick loop", throwable));
      }

      File file1 =
          new File(
              new File(this.getDataDirectory(), "crash-reports"),
              "crash-"
                  + (new SimpleDateFormat("yyyy-MM-dd_HH.mm.ss")).format(new Date())
                  + "-server.txt");

      if (crashreport.saveToFile(file1, this.func_98033_al())) {
        this.func_98033_al()
            .func_98232_c("This crash report has been saved to: " + file1.getAbsolutePath());
      } else {
        this.func_98033_al().func_98232_c("We were unable to save this crash report to disk.");
      }

      this.finalTick(crashreport);
    } finally {
      try {
        if (FMLCommonHandler.instance().shouldServerBeKilledQuietly()) {
          return;
        }
        this.stopServer();
        this.serverStopped = true;
      } catch (Throwable throwable1) {
        throwable1.printStackTrace();
      } finally {
        FMLCommonHandler.instance().handleServerStopped();
        this.systemExitNow();
      }
    }
  }
Пример #25
0
  public void updateTimeLightAndEntities() {
    this.theProfiler.startSection("levels");
    int i;

    Integer[] ids = DimensionManager.getIDs(this.tickCounter % 200 == 0);
    for (int x = 0; x < ids.length; x++) {
      int id = ids[x];
      long j = System.nanoTime();

      if (id == 0 || this.getAllowNether()) {
        WorldServer worldserver = DimensionManager.getWorld(id);
        this.theProfiler.startSection(worldserver.getWorldInfo().getWorldName());
        this.theProfiler.startSection("pools");
        worldserver.getWorldVec3Pool().clear();
        this.theProfiler.endSection();

        if (this.tickCounter % 20 == 0) {
          this.theProfiler.startSection("timeSync");
          this.serverConfigManager.sendPacketToAllPlayersInDimension(
              new Packet4UpdateTime(worldserver.getTotalWorldTime(), worldserver.getWorldTime()),
              worldserver.provider.dimensionId);
          this.theProfiler.endSection();
        }

        this.theProfiler.startSection("tick");
        FMLCommonHandler.instance().onPreWorldTick(worldserver);
        CrashReport crashreport;

        try {
          worldserver.tick();
        } catch (Throwable throwable) {
          crashreport = CrashReport.makeCrashReport(throwable, "Exception ticking world");
          worldserver.addWorldInfoToCrashReport(crashreport);
          throw new ReportedException(crashreport);
        }

        try {
          worldserver.updateEntities();
        } catch (Throwable throwable1) {
          crashreport = CrashReport.makeCrashReport(throwable1, "Exception ticking world entities");
          worldserver.addWorldInfoToCrashReport(crashreport);
          throw new ReportedException(crashreport);
        }

        FMLCommonHandler.instance().onPostWorldTick(worldserver);
        this.theProfiler.endSection();
        this.theProfiler.startSection("tracker");
        worldserver.getEntityTracker().updateTrackedEntities();
        this.theProfiler.endSection();
        this.theProfiler.endSection();
      }

      worldTickTimes.get(id)[this.tickCounter % 100] = System.nanoTime() - j;
    }

    this.theProfiler.endStartSection("dim_unloading");
    DimensionManager.unloadWorlds(worldTickTimes);
    this.theProfiler.endStartSection("connection");
    this.getNetworkThread().networkTick();
    this.theProfiler.endStartSection("players");
    this.serverConfigManager.sendPlayerInfoToAllPlayers();
    this.theProfiler.endStartSection("tickables");

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

    this.theProfiler.endSection();
  }