/** * Gets the NBTTagList object with the given name. */ public NBTTagList getTagList(String key, int type) { try { if (this.getTagId(key) == 9) { NBTTagList nbttaglist = (NBTTagList)this.tagMap.get(key); if (!nbttaglist.hasNoTags() && nbttaglist.getTagType() != type) { return new NBTTagList(); } return nbttaglist; } } catch (ClassCastException classcastexception) { throw new ReportedException(this.createCrashReport(key, 9, classcastexception)); } return new NBTTagList(); }
public Block getBlock(final int x, final int y, final int z) { try { return this.getBlock0(x & 15, y, z & 15); } catch (ReportedException reportedexception) { CrashReportCategory crashreportcategory = reportedexception.getCrashReport().makeCategory("Block being got"); crashreportcategory.addCrashSectionCallable("Location", new Callable<String>() { public String call() throws Exception { return CrashReportCategory.getCoordinateInfo(new BlockPos(Chunk.this.xPosition * 16 + x, y, Chunk.this.zPosition * 16 + z)); } }); throw reportedexception; } }
public Block getBlock(final BlockPos pos) { try { return this.getBlock0(pos.getX() & 15, pos.getY(), pos.getZ() & 15); } catch (ReportedException reportedexception) { CrashReportCategory crashreportcategory = reportedexception.getCrashReport().makeCategory("Block being got"); crashreportcategory.addCrashSectionCallable("Location", new Callable<String>() { public String call() throws Exception { return CrashReportCategory.getCoordinateInfo(pos); } }); throw reportedexception; } }
static NBTBase readNBT(byte id, String key, DataInput input, int depth, NBTSizeTracker sizeTracker) throws IOException { NBTBase nbtbase = NBTBase.createNewByType(id); try { nbtbase.read(input, depth, sizeTracker); return nbtbase; } catch (IOException ioexception) { CrashReport crashreport = CrashReport.makeCrashReport(ioexception, "Loading NBT data"); CrashReportCategory crashreportcategory = crashreport.makeCategory("NBT Tag"); crashreportcategory.addCrashSection("Tag name", key); crashreportcategory.addCrashSection("Tag type", Byte.valueOf(id)); throw new ReportedException(crashreport); } }
/** * Retrieves a byte array using the specified key, or a zero-length array if no such key was stored. */ public byte[] getByteArray(String key) { try { if (this.hasKey(key, 7)) { return ((NBTTagByteArray)this.tagMap.get(key)).getByteArray(); } } catch (ClassCastException classcastexception) { throw new ReportedException(this.createCrashReport(key, 7, classcastexception)); } return new byte[0]; }
/** * Retrieves an int array using the specified key, or a zero-length array if no such key was stored. */ public int[] getIntArray(String key) { try { if (this.hasKey(key, 11)) { return ((NBTTagIntArray)this.tagMap.get(key)).getIntArray(); } } catch (ClassCastException classcastexception) { throw new ReportedException(this.createCrashReport(key, 11, classcastexception)); } return new int[0]; }
/** * is threadsafe, unless it throws an exception, then */ private DataWatcher.WatchableObject getWatchedObject(int id) { this.lock.readLock().lock(); DataWatcher.WatchableObject datawatcher$watchableobject; try { datawatcher$watchableobject = (DataWatcher.WatchableObject)this.watchedObjects.get(Integer.valueOf(id)); } 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(id)); throw new ReportedException(crashreport); } this.lock.readLock().unlock(); return datawatcher$watchableobject; }
public void playEvent(@Nullable EntityPlayer player, int type, BlockPos pos, int data) { try { for (int i = 0; i < this.eventListeners.size(); ++i) { ((IWorldEventListener)this.eventListeners.get(i)).playEvent(player, type, pos, data); } } catch (Throwable throwable) { CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Playing level event"); CrashReportCategory crashreportcategory = crashreport.makeCategory("Level event being played"); crashreportcategory.addCrashSection("Block coordinates", CrashReportCategory.getCoordinateInfo(pos)); crashreportcategory.addCrashSection("Event source", player); crashreportcategory.addCrashSection("Event type", Integer.valueOf(type)); crashreportcategory.addCrashSection("Event data", Integer.valueOf(data)); throw new ReportedException(crashreport); } }
/** * Returns the block corresponding to the given coordinates inside a chunk. */ private Block getBlock0(int x, int y, int z) { Block block = Blocks.air; if (y >= 0 && y >> 4 < this.storageArrays.length) { ExtendedBlockStorage extendedblockstorage = this.storageArrays[y >> 4]; if (extendedblockstorage != null) { try { block = extendedblockstorage.getBlockByExtId(x, y & 15, z); } catch (Throwable throwable) { CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Getting block"); throw new ReportedException(crashreport); } } } return block; }
public boolean renderModel(IBlockAccess blockAccessIn, IBakedModel modelIn, IBlockState blockStateIn, BlockPos blockPosIn, WorldRenderer worldRendererIn, boolean checkSides) { boolean flag = Minecraft.isAmbientOcclusionEnabled() && blockStateIn.getBlock().getLightValue() == 0 && modelIn.isAmbientOcclusion(); try { Block block = blockStateIn.getBlock(); if (Config.isTreesSmart() && blockStateIn.getBlock() instanceof BlockLeavesBase) { modelIn = SmartLeaves.getLeavesModel(modelIn); } return flag ? this.renderModelAmbientOcclusion(blockAccessIn, modelIn, block, blockStateIn, blockPosIn, worldRendererIn, checkSides) : this.renderModelStandard(blockAccessIn, modelIn, block, blockStateIn, blockPosIn, worldRendererIn, checkSides); } catch (Throwable throwable) { CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Tesselating block model"); CrashReportCategory crashreportcategory = crashreport.makeCategory("Block model being tesselated"); CrashReportCategory.addBlockInfo(crashreportcategory, blockPosIn, blockStateIn); crashreportcategory.addCrashSection("Using AO", Boolean.valueOf(flag)); throw new ReportedException(crashreport); } }
/** * Retrieves a NBTTagCompound subtag matching the specified key, or a new empty NBTTagCompound if no such key was * stored. */ public NBTTagCompound getCompoundTag(String key) { try { if (this.hasKey(key, 10)) { return (NBTTagCompound)this.tagMap.get(key); } } catch (ClassCastException classcastexception) { throw new ReportedException(this.createCrashReport(key, 10, classcastexception)); } return new NBTTagCompound(); }
/** * Gets the NBTTagList object with the given name. Args: name, NBTBase type */ public NBTTagList getTagList(String key, int type) { try { if (this.getTagId(key) != 9) { return new NBTTagList(); } else { NBTTagList nbttaglist = (NBTTagList)this.tagMap.get(key); return nbttaglist.tagCount() > 0 && nbttaglist.getTagType() != type ? new NBTTagList() : nbttaglist; } } catch (ClassCastException classcastexception) { throw new ReportedException(this.createCrashReport(key, 9, classcastexception)); } }
/** * caputres the current framebuffer */ public void captureFramebuffer(FrameBuffer p_152846_1_) { try { this.field_152873_i.captureFrameBuffer_ReadPixels(p_152846_1_); } catch (Throwable throwable) { CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Trying to submit a frame to Twitch"); CrashReportCategory crashreportcategory = crashreport.makeCategory("Broadcast State"); crashreportcategory.addCrashSection("Last reported errors", Arrays.toString(field_152862_C.func_152756_c())); crashreportcategory.addCrashSection("Buffer", p_152846_1_); crashreportcategory.addCrashSection("Free buffer count", Integer.valueOf(this.field_152875_k.size())); crashreportcategory.addCrashSection("Capture buffer count", Integer.valueOf(this.field_152874_j.size())); throw new ReportedException(crashreport); } }
public void renderTileEntityAt(TileEntity tileEntityIn, double x, double y, double z, float partialTicks, int destroyStage) { TileEntitySpecialRenderer<TileEntity> tileentityspecialrenderer = this.<TileEntity>getSpecialRenderer(tileEntityIn); if (tileentityspecialrenderer != null) { try { tileentityspecialrenderer.renderTileEntityAt(tileEntityIn, x, y, z, partialTicks, destroyStage); } catch (Throwable throwable) { CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Rendering Block Entity"); CrashReportCategory crashreportcategory = crashreport.makeCategory("Block Entity Details"); tileEntityIn.addInfoToCrashReport(crashreportcategory); throw new ReportedException(crashreport); } } }
public boolean renderModel(IBlockAccess blockAccessIn, IBakedModel modelIn, IBlockState blockStateIn, BlockPos blockPosIn, WorldRenderer worldRendererIn, boolean checkSides) { boolean flag = Minecraft.isAmbientOcclusionEnabled() && blockStateIn.getBlock().getLightValue() == 0 && modelIn.isAmbientOcclusion(); try { Block block = blockStateIn.getBlock(); return flag ? this.renderModelAmbientOcclusion(blockAccessIn, modelIn, block, blockPosIn, worldRendererIn, checkSides) : this.renderModelStandard(blockAccessIn, modelIn, block, blockPosIn, worldRendererIn, checkSides); } catch (Throwable throwable) { CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Tesselating block model"); CrashReportCategory crashreportcategory = crashreport.makeCategory("Block model being tesselated"); CrashReportCategory.addBlockInfo(crashreportcategory, blockPosIn, blockStateIn); crashreportcategory.addCrashSection("Using AO", Boolean.valueOf(flag)); throw new ReportedException(crashreport); } }
/** * Creates a crash report for the exception */ public static CrashReport makeCrashReport(Throwable causeIn, String descriptionIn) { CrashReport crashreport; if (causeIn instanceof ReportedException) { crashreport = ((ReportedException)causeIn).getCrashReport(); } else { crashreport = new CrashReport(descriptionIn, causeIn); } return crashreport; }
public ModManager() { try { for(Field field : ModManager.class.getFields()) if(field.getName().endsWith("Mod")) { Mod mod = (Mod)field.get(this); mods.put(mod.getName(), mod); mod.initSettings(); } }catch(Exception e) { throw new ReportedException( CrashReport.makeCrashReport(e, "Initializing Wurst mods")); } }
public SpfManager() { try { for(Field field : SpfManager.class.getFields()) if(field.getName().endsWith("Spf")) { Spf spf = (Spf)field.get(this); features.put(spf.getName(), spf); } }catch(Exception e) { throw new ReportedException(CrashReport.makeCrashReport(e, "Initializing other Wurst features")); } }
@SuppressWarnings("unchecked") public <T extends Event> void fire(T event) { if(!WurstClient.INSTANCE.isEnabled()) return; try { event.fire(listenerMap.get(event.getListenerType())); }catch(Throwable e) { e.printStackTrace(); CrashReport report = CrashReport.makeCrashReport(e, "Firing Wurst event"); CrashReportCategory category = report.makeCategory("Affected event"); category.setDetail("Event class", () -> event.getClass().getName()); throw new ReportedException(report); } }
@SuppressWarnings("unchecked") public <T extends EventListener> void add(Class<T> type, T listener) { try { ((ArrayList<T>)listenerMap.get(type)).add(listener); }catch(Throwable e) { e.printStackTrace(); CrashReport report = CrashReport.makeCrashReport(e, "Adding Wurst event listener"); CrashReportCategory category = report.makeCategory("Affected listener"); category.setDetail("Listener type", () -> type.getName()); category.setDetail("Listener class", () -> listener.getClass().getName()); throw new ReportedException(report); } }
public boolean renderModel(IBlockAccess blockAccessIn, IBakedModel modelIn, IBlockState blockStateIn, BlockPos blockPosIn, WorldRenderer worldRendererIn, boolean checkSides) { boolean flag = Minecraft.isAmbientOcclusionEnabled() && blockStateIn.getBlock().getLightValue() == 0 && modelIn.isAmbientOcclusion(); try { Block block = blockStateIn.getBlock(); return flag ? this.renderModelAmbientOcclusion(blockAccessIn, modelIn, block, blockStateIn, blockPosIn, worldRendererIn, checkSides) : this.renderModelStandard(blockAccessIn, modelIn, block, blockStateIn, blockPosIn, worldRendererIn, checkSides); } catch (Throwable throwable) { CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Tesselating block model"); CrashReportCategory crashreportcategory = crashreport.makeCategory("Block model being tesselated"); CrashReportCategory.addBlockInfo(crashreportcategory, blockPosIn, blockStateIn); crashreportcategory.addCrashSection("Using AO", Boolean.valueOf(flag)); throw new ReportedException(crashreport); } }
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; }
public boolean renderModel(IBlockAccess worldIn, IBakedModel modelIn, IBlockState stateIn, BlockPos posIn, VertexBuffer buffer, boolean checkSides, long rand) { boolean flag = Minecraft.isAmbientOcclusionEnabled() && stateIn.getLightValue() == 0 && modelIn.isAmbientOcclusion(); try { return flag ? this.renderModelSmooth(worldIn, modelIn, stateIn, posIn, buffer, checkSides, rand) : this.renderModelFlat(worldIn, modelIn, stateIn, posIn, buffer, checkSides, rand); } catch (Throwable throwable) { CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Tesselating block model"); CrashReportCategory crashreportcategory = crashreport.makeCategory("Block model being tesselated"); CrashReportCategory.addBlockInfo(crashreportcategory, posIn, stateIn); crashreportcategory.addCrashSection("Using AO", Boolean.valueOf(flag)); throw new ReportedException(crashreport); } }
private static IBakedModel loadModel(ModelHandle handle) { IBakedModel model = loadedModels.get(handle.getKey()); if (model != null) return model; try { IModel mod = ModelLoaderRegistry.getModel(handle.getModel()); if (handle.getTextureReplacements().size() > 0) { mod = mod.retexture(ImmutableMap.copyOf(handle.getTextureReplacements())); } if (handle.uvLocked()) { mod = mod.uvlock(true); } IModelState state = handle.getState(); if (state == null) state = mod.getDefaultState(); model = mod.bake(state, handle.getVertexFormat(), ModelLoader.defaultTextureGetter()); loadedModels.put(handle.getKey(), model); return model; } catch (Exception e) { throw new ReportedException(new CrashReport("Error loading custom model " + handle.getModel(), e)); } }
public Chunk provideChunk(int x, int z) { Chunk chunk = this.loadChunk(x, z); if (chunk == null) { long i = ChunkPos.asLong(x, z); try { chunk = this.chunkGenerator.provideChunk(x, z); } catch (Throwable throwable) { CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Exception generating new chunk"); CrashReportCategory crashreportcategory = crashreport.makeCategory("Chunk to be generated"); crashreportcategory.addCrashSection("Location", String.format("%d,%d", new Object[] {Integer.valueOf(x), Integer.valueOf(z)})); crashreportcategory.addCrashSection("Position hash", Long.valueOf(i)); crashreportcategory.addCrashSection("Generator", this.chunkGenerator); throw new ReportedException(crashreport); } this.id2ChunkMap.put(i, chunk); chunk.onChunkLoad(); chunk.populateChunk(this, this.chunkGenerator); } return chunk; }
public void initialize(WorldSettings settings) { if (!this.worldInfo.isInitialized()) { try { this.createSpawnPosition(settings); if (this.worldInfo.getTerrainType() == WorldType.DEBUG_WORLD) { this.setDebugWorldSettings(); } super.initialize(settings); } catch (Throwable throwable) { CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Exception initializing level"); try { this.addWorldInfoToCrashReport(crashreport); } catch (Throwable var5) { ; } throw new ReportedException(crashreport); } this.worldInfo.setServerInitialized(true); } }
/** * 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<BiomeGenBase> p_76940_4_) { IntCache.resetIntCache(); int i = p_76940_1_ - p_76940_3_ >> 2; int j = p_76940_2_ - p_76940_3_ >> 2; int k = p_76940_1_ + p_76940_3_ >> 2; int l = p_76940_2_ + p_76940_3_ >> 2; int i1 = k - i + 1; int j1 = l - j + 1; int[] aint = this.genBiomes.getInts(i, j, i1, j1); try { for (int k1 = 0; k1 < i1 * j1; ++k1) { BiomeGenBase biomegenbase = BiomeGenBase.getBiome(aint[k1]); if (!p_76940_4_.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.genBiomes.toString()); crashreportcategory.addCrashSection("x", Integer.valueOf(p_76940_1_)); crashreportcategory.addCrashSection("z", Integer.valueOf(p_76940_2_)); crashreportcategory.addCrashSection("radius", Integer.valueOf(p_76940_3_)); crashreportcategory.addCrashSection("allowed", p_76940_4_); throw new ReportedException(crashreport); } }
/** * Returns an array of biomes for the location input. */ public Biome[] getBiomesForGeneration(Biome[] biomes, int x, int z, int width, int height) { IntCache.resetIntCache(); if (biomes == null || biomes.length < width * height) { biomes = new Biome[width * height]; } int[] aint = this.genBiomes.getInts(x, z, width, height); try { for (int i = 0; i < width * height; ++i) { biomes[i] = Biome.getBiome(aint[i], Biomes.DEFAULT); } return biomes; } catch (Throwable throwable) { CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Invalid Biome id"); CrashReportCategory crashreportcategory = crashreport.makeCategory("RawBiomeBlock"); crashreportcategory.addCrashSection("biomes[] size", Integer.valueOf(biomes.length)); crashreportcategory.addCrashSection("x", Integer.valueOf(x)); crashreportcategory.addCrashSection("z", Integer.valueOf(z)); crashreportcategory.addCrashSection("w", Integer.valueOf(width)); crashreportcategory.addCrashSection("h", Integer.valueOf(height)); throw new ReportedException(crashreport); } }
public BiomeGenBase getBiomeGenForCoords(final BlockPos pos) { if (this.isBlockLoaded(pos)) { Chunk chunk = this.getChunkFromBlockCoords(pos); try { return chunk.getBiome(pos, this.provider.getWorldChunkManager()); } catch (Throwable throwable) { CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Getting biome"); CrashReportCategory crashreportcategory = crashreport.makeCategory("Coordinates of biome request"); crashreportcategory.addCrashSectionCallable("Location", new Callable<String>() { public String call() throws Exception { return CrashReportCategory.getCoordinateInfo(pos); } }); throw new ReportedException(crashreport); } } else { return this.provider.getWorldChunkManager().getBiomeGenerator(pos, BiomeGenBase.plains); } }
public Biome getBiomeForCoordsBody(final BlockPos pos) { if (this.isBlockLoaded(pos)) { Chunk chunk = this.getChunkFromBlockCoords(pos); try { return chunk.getBiome(pos, this.provider.getBiomeProvider()); } catch (Throwable throwable) { CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Getting biome"); CrashReportCategory crashreportcategory = crashreport.makeCategory("Coordinates of biome request"); crashreportcategory.setDetail("Location", new ICrashReportDetail<String>() { public String call() throws Exception { return CrashReportCategory.getCoordinateInfo(pos); } }); throw new ReportedException(crashreport); } } else { return this.provider.getBiomeProvider().getBiome(pos, Biomes.PLAINS); } }
/** * Retrieves an int array using the specified key, or a zero-length array if no such key was stored. */ public int[] getIntArray(String key) { try { return !this.hasKey(key, 11) ? new int[0] : ((NBTTagIntArray)this.tagMap.get(key)).getIntArray(); } catch (ClassCastException classcastexception) { throw new ReportedException(this.createCrashReport(key, 11, classcastexception)); } }
protected void doBlockCollisions() { BlockPos blockpos = new BlockPos(this.getEntityBoundingBox().minX + 0.001D, this.getEntityBoundingBox().minY + 0.001D, this.getEntityBoundingBox().minZ + 0.001D); BlockPos blockpos1 = new BlockPos(this.getEntityBoundingBox().maxX - 0.001D, this.getEntityBoundingBox().maxY - 0.001D, this.getEntityBoundingBox().maxZ - 0.001D); if (this.worldObj.isAreaLoaded(blockpos, blockpos1)) { for (int i = blockpos.getX(); i <= blockpos1.getX(); ++i) { for (int j = blockpos.getY(); j <= blockpos1.getY(); ++j) { for (int k = blockpos.getZ(); k <= blockpos1.getZ(); ++k) { BlockPos blockpos2 = new BlockPos(i, j, k); IBlockState iblockstate = this.worldObj.getBlockState(blockpos2); try { iblockstate.getBlock().onEntityCollidedWithBlock(this.worldObj, blockpos2, iblockstate, this); } catch (Throwable throwable) { CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Colliding entity with block"); CrashReportCategory crashreportcategory = crashreport.makeCategory("Block being collided with"); CrashReportCategory.addBlockInfo(crashreportcategory, blockpos2, iblockstate); throw new ReportedException(crashreport); } } } } } }
/** * Retrieves a NBTTagCompound subtag matching the specified key, or a new empty NBTTagCompound if no such key was * stored. */ public NBTTagCompound getCompoundTag(String key) { try { return !this.hasKey(key, 10) ? new NBTTagCompound() : (NBTTagCompound)this.tagMap.get(key); } catch (ClassCastException classcastexception) { throw new ReportedException(this.createCrashReport(key, 10, classcastexception)); } }