net.minecraft.crash.CrashReportCategory Java Examples

The following examples show how to use net.minecraft.crash.CrashReportCategory. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GenLayerTofu.java    From TofuCraftReload with MIT License 6 votes vote down vote up
protected static boolean compareBiomesById(final int p_151616_0_, final int p_151616_1_)
{
    if (p_151616_0_ == p_151616_1_)
    {
        return true;
    }
    else
    {
        try
        {
            return BiomeTofu.getBiome(p_151616_0_) != null && BiomeTofu.getBiome(p_151616_1_) != null ? isEqualTo(BiomeTofu.getBiome(p_151616_0_), BiomeTofu.getBiome(p_151616_1_)) : false;
        }
        catch (Throwable throwable)
        {
            CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Comparing biomes");
            CrashReportCategory crashreportcategory = crashreport.makeCategory("Biomes being compared");
            crashreportcategory.addCrashSection("Biome A ID", Integer.valueOf(p_151616_0_));
            crashreportcategory.addCrashSection("Biome B ID", Integer.valueOf(p_151616_1_));
            throw new ReportedException(crashreport);
        }
    }
}
 
Example #2
Source File: Entity.java    From TickDynamic with MIT License 6 votes vote down vote up
public void addEntityCrashInfo(CrashReportCategory p_85029_1_)
{
    p_85029_1_.addCrashSectionCallable("Entity Type", new Callable()
    {
        private static final String __OBFID = "CL_00001534";
        public String call()
        {
            return EntityList.getEntityString(Entity.this) + " (" + Entity.this.getClass().getCanonicalName() + ")";
        }
    });
    p_85029_1_.addCrashSection("Entity ID", Integer.valueOf(this.entityId));
    p_85029_1_.addCrashSectionCallable("Entity Name", new Callable()
    {
        private static final String __OBFID = "CL_00001535";
        public String call()
        {
            return Entity.this.getCommandSenderName();
        }
    });
    p_85029_1_.addCrashSection("Entity\'s Exact location", String.format("%.2f, %.2f, %.2f", new Object[] {Double.valueOf(this.posX), Double.valueOf(this.posY), Double.valueOf(this.posZ)}));
    p_85029_1_.addCrashSection("Entity\'s Block location", CrashReportCategory.getLocationInfo(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY), MathHelper.floor_double(this.posZ)));
    p_85029_1_.addCrashSection("Entity\'s Momentum", String.format("%.2f, %.2f, %.2f", new Object[] {Double.valueOf(this.motionX), Double.valueOf(this.motionY), Double.valueOf(this.motionZ)}));
}
 
Example #3
Source File: BlockModelRendererSchematic.java    From litematica with GNU Lesser General Public License v3.0 6 votes vote down vote up
public boolean renderModel(IBlockAccess worldIn, IBakedModel modelIn, IBlockState stateIn, BlockPos posIn, BufferBuilder buffer)
{
    boolean ao = Minecraft.isAmbientOcclusionEnabled() && stateIn.getLightValue() == 0 && modelIn.isAmbientOcclusion();
    long rand = MathHelper.getPositionRandom(posIn);

    try
    {
        if (ao)
        {
            return this.renderModelSmooth(worldIn, modelIn, stateIn, posIn, buffer, rand);
        }
        else
        {
            return this.renderModelFlat(worldIn, modelIn, stateIn, posIn, buffer, 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(ao));
        throw new ReportedException(crashreport);
    }
}
 
Example #4
Source File: BiomeProviderTofu.java    From TofuCraftReload with MIT License 5 votes vote down vote up
/**
 * Returns an array of biomes for the location input.
 */
@Override
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], TofuBiomes.TOFU_RIVER);
        }

        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);
    }
}
 
Example #5
Source File: ChunkManagerPlanet.java    From AdvancedRocketry with MIT License 5 votes vote down vote up
public Biome[] getBiomesForGeneration(Biome[] biomes, int x, int z, int width, int height)
{
	GenLayerBiomePlanet.setupBiomesForUse(this.biomes);
	//return super.getBiomesForGeneration(p_76937_1_, p_76937_2_, p_76937_3_, p_76937_4_, p_76937_5_);

	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 i1 = 0; i1 < width * height; ++i1)
		{
			biomes[i1] = Biome.getBiome(aint[i1], Biomes.OCEAN);//AdvancedRocketryBiomes.instance.getBiomeById(aint[i1]);
		}

		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);
	}
}
 
Example #6
Source File: Entity.java    From TickDynamic with MIT License 5 votes vote down vote up
protected void func_145775_I()
{
    int i = MathHelper.floor_double(this.boundingBox.minX + 0.001D);
    int j = MathHelper.floor_double(this.boundingBox.minY + 0.001D);
    int k = MathHelper.floor_double(this.boundingBox.minZ + 0.001D);
    int l = MathHelper.floor_double(this.boundingBox.maxX - 0.001D);
    int i1 = MathHelper.floor_double(this.boundingBox.maxY - 0.001D);
    int j1 = MathHelper.floor_double(this.boundingBox.maxZ - 0.001D);

    if (this.worldObj.checkChunksExist(i, j, k, l, i1, j1))
    {
        for (int k1 = i; k1 <= l; ++k1)
        {
            for (int l1 = j; l1 <= i1; ++l1)
            {
                for (int i2 = k; i2 <= j1; ++i2)
                {
                    Block block = this.worldObj.getBlock(k1, l1, i2);

                    try
                    {
                        block.onEntityCollidedWithBlock(this.worldObj, k1, l1, i2, this);
                    }
                    catch (Throwable throwable)
                    {
                        CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Colliding entity with block");
                        CrashReportCategory crashreportcategory = crashreport.makeCategory("Block being collided with");
                        CrashReportCategory.func_147153_a(crashreportcategory, k1, l1, i2, block, this.worldObj.getBlockMetadata(k1, l1, i2));
                        throw new ReportedException(crashreport);
                    }
                }
            }
        }
    }
}
 
Example #7
Source File: MixinTileEntity.java    From VanillaFix with MIT License 5 votes vote down vote up
@Inject(method = "addInfoToCrashReport", at = @At("TAIL"))
private void onAddEntityCrashInfo(CrashReportCategory category, CallbackInfo ci) {
    if (!noNBT) {
        noNBT = true;
        // "Block Entity" to stay consistent with vanilla strings
        category.addDetail("Block Entity NBT", () -> ((TileEntity) (Object) this).writeToNBT(new NBTTagCompound()).toString());
        noNBT = false;
    }
}
 
Example #8
Source File: MixinCrashReport.java    From VanillaFix with MIT License 5 votes vote down vote up
/** @reason Improve report formatting, add VanillaFix comment */
@Overwrite
public void getSectionsInStringBuilder(StringBuilder builder) {
    for (CrashReportCategory crashreportcategory : crashReportSections) {
        crashreportcategory.appendToStringBuilder(builder);
        builder.append("\n");
    }

    systemDetailsCategory.appendToStringBuilder(builder);
}
 
Example #9
Source File: MixinEntity.java    From VanillaFix with MIT License 5 votes vote down vote up
@Inject(method = "addEntityCrashInfo", at = @At("TAIL"))
private void onAddEntityCrashInfo(CrashReportCategory category, CallbackInfo ci) {
    if (!noNBT) {
        noNBT = true;
        category.addDetail("Entity NBT", () -> ((Entity) (Object) this).writeToNBT(new NBTTagCompound()).toString());
        noNBT = false;
    }
}
 
Example #10
Source File: MixinCrashReportCategory.java    From VanillaFix with MIT License 5 votes vote down vote up
/** @reason Improve crash report formatting **/
@Overwrite
public void appendToStringBuilder(StringBuilder builder) {
    builder.append("-- ").append(name).append(" --\n");
    for (CrashReportCategory.Entry entry : children) {
        String sectionIndent = "  ";

        builder.append(sectionIndent)
               .append(entry.getKey())
               .append(": ");

        StringBuilder indent = new StringBuilder(sectionIndent + "  ");
        for (char ignored : entry.getKey().toCharArray()) {
            indent.append(" ");
        }

        boolean first = true;
        for (String line : entry.getValue().trim().split("\n")) {
            if (!first) builder.append("\n").append(indent);
            first = false;
            if (line.startsWith("\t")) line = line.substring(1);
            builder.append(line.replace("\t", ""));
        }

        builder.append("\n");
    }
}
 
Example #11
Source File: RenderGlobalSchematic.java    From litematica with GNU Lesser General Public License v3.0 5 votes vote down vote up
public boolean renderBlock(IBlockState state, BlockPos pos, IBlockAccess blockAccess, BufferBuilder bufferBuilderIn)
{
    try
    {
        EnumBlockRenderType renderType = state.getRenderType();

        if (renderType == EnumBlockRenderType.INVISIBLE)
        {
            return false;
        }
        else
        {
            switch (renderType)
            {
                case MODEL:
                    return this.blockModelRenderer.renderModel(blockAccess, this.getModelForState(state), state, pos, bufferBuilderIn);
                case ENTITYBLOCK_ANIMATED:
                    return false;
                case LIQUID:
                    return this.fluidRenderer.renderFluid(blockAccess, state, pos, bufferBuilderIn);
                default:
                    return false;
            }
        }
    }
    catch (Throwable throwable)
    {
        CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Tesselating block in world");
        CrashReportCategory crashreportcategory = crashreport.makeCategory("Block being tesselated");
        CrashReportCategory.addBlockInfo(crashreportcategory, pos, state.getBlock(), state.getBlock().getMetaFromState(state));
        throw new ReportedException(crashreport);
    }
}
 
Example #12
Source File: BiomeProviderTofu.java    From TofuCraftReload with MIT License 5 votes vote down vote up
/**
 * checks given Chunk's Biomes against List of allowed ones
 */
@Override
public boolean areBiomesViable(int x, int z, int radius, List<Biome> allowed) {
    IntCache.resetIntCache();
    int i = x - radius >> 2;
    int j = z - radius >> 2;
    int k = x + radius >> 2;
    int l = z + radius >> 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)
        {
            Biome biome = Biome.getBiome(aint[k1]);

            if (!allowed.contains(biome))
            {
                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(x));
        crashreportcategory.addCrashSection("z", Integer.valueOf(z));
        crashreportcategory.addCrashSection("radius", Integer.valueOf(radius));
        crashreportcategory.addCrashSection("allowed", allowed);
        throw new ReportedException(crashreport);
    }
}
 
Example #13
Source File: HyperiumCrashReport.java    From Hyperium with GNU Lesser General Public License v3.0 4 votes vote down vote up
public void add() {
    CrashReportCategory category = parent.makeCategoryDepth("Affected level", 1);
    category.addCrashSection("Hyperium Version", Metadata.getVersion() + " (" + Metadata.getVersionID() + ")");
    category.addCrashSection("Everything else", CommandDebug.get());
}
 
Example #14
Source File: MixinEntity.java    From LiquidBounce with GNU General Public License v3.0 4 votes vote down vote up
@Shadow
public abstract void addEntityCrashInfo(CrashReportCategory category);
 
Example #15
Source File: Entity.java    From TickDynamic with MIT License 4 votes vote down vote up
/**
 * Save the entity to NBT (calls an abstract helper method to write extra data)
 */
public void writeToNBT(NBTTagCompound p_70109_1_)
{
    try
    {
        p_70109_1_.setTag("Pos", this.newDoubleNBTList(new double[] {this.posX, this.posY + (double)this.ySize, this.posZ}));
        p_70109_1_.setTag("Motion", this.newDoubleNBTList(new double[] {this.motionX, this.motionY, this.motionZ}));
        p_70109_1_.setTag("Rotation", this.newFloatNBTList(new float[] {this.rotationYaw, this.rotationPitch}));
        p_70109_1_.setFloat("FallDistance", this.fallDistance);
        p_70109_1_.setShort("Fire", (short)this.fire);
        p_70109_1_.setShort("Air", (short)this.getAir());
        p_70109_1_.setBoolean("OnGround", this.onGround);
        p_70109_1_.setInteger("Dimension", this.dimension);
        p_70109_1_.setBoolean("Invulnerable", this.invulnerable);
        p_70109_1_.setInteger("PortalCooldown", this.timeUntilPortal);
        p_70109_1_.setLong("UUIDMost", this.getUniqueID().getMostSignificantBits());
        p_70109_1_.setLong("UUIDLeast", this.getUniqueID().getLeastSignificantBits());
        if (customEntityData != null)
        {
            p_70109_1_.setTag("ForgeData", customEntityData);
        }

       for (String identifier : this.extendedProperties.keySet())
       {
            try
            {
                IExtendedEntityProperties props = this.extendedProperties.get(identifier);
                props.saveNBTData(p_70109_1_);
            }
            catch (Throwable t)
            {
                FMLLog.severe("Failed to save extended properties for %s.  This is a mod issue.", identifier);
                t.printStackTrace();
            }
        }

       this.writeEntityToNBT(p_70109_1_);

        if (this.ridingEntity != null)
        {
            NBTTagCompound nbttagcompound1 = new NBTTagCompound();

            if (this.ridingEntity.writeMountToNBT(nbttagcompound1))
            {
                p_70109_1_.setTag("Riding", nbttagcompound1);
            }
        }
    }
    catch (Throwable throwable)
    {
        CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Saving entity NBT");
        CrashReportCategory crashreportcategory = crashreport.makeCategory("Entity being saved");
        this.addEntityCrashInfo(crashreportcategory);
        throw new ReportedException(crashreport);
    }
}
 
Example #16
Source File: Entity.java    From TickDynamic with MIT License 4 votes vote down vote up
/**
 * Reads the entity from NBT (calls an abstract helper method to read specialized data)
 */
public void readFromNBT(NBTTagCompound p_70020_1_)
{
    try
    {
        NBTTagList nbttaglist = p_70020_1_.getTagList("Pos", 6);
        NBTTagList nbttaglist1 = p_70020_1_.getTagList("Motion", 6);
        NBTTagList nbttaglist2 = p_70020_1_.getTagList("Rotation", 5);
        this.motionX = nbttaglist1.func_150309_d(0);
        this.motionY = nbttaglist1.func_150309_d(1);
        this.motionZ = nbttaglist1.func_150309_d(2);

        if (Math.abs(this.motionX) > 10.0D)
        {
            this.motionX = 0.0D;
        }

        if (Math.abs(this.motionY) > 10.0D)
        {
            this.motionY = 0.0D;
        }

        if (Math.abs(this.motionZ) > 10.0D)
        {
            this.motionZ = 0.0D;
        }

        this.prevPosX = this.lastTickPosX = this.posX = nbttaglist.func_150309_d(0);
        this.prevPosY = this.lastTickPosY = this.posY = nbttaglist.func_150309_d(1);
        this.prevPosZ = this.lastTickPosZ = this.posZ = nbttaglist.func_150309_d(2);
        this.prevRotationYaw = this.rotationYaw = nbttaglist2.func_150308_e(0);
        this.prevRotationPitch = this.rotationPitch = nbttaglist2.func_150308_e(1);
        this.fallDistance = p_70020_1_.getFloat("FallDistance");
        this.fire = p_70020_1_.getShort("Fire");
        this.setAir(p_70020_1_.getShort("Air"));
        this.onGround = p_70020_1_.getBoolean("OnGround");
        this.dimension = p_70020_1_.getInteger("Dimension");
        this.invulnerable = p_70020_1_.getBoolean("Invulnerable");
        this.timeUntilPortal = p_70020_1_.getInteger("PortalCooldown");

        if (p_70020_1_.hasKey("UUIDMost", 4) && p_70020_1_.hasKey("UUIDLeast", 4))
        {
            this.entityUniqueID = new UUID(p_70020_1_.getLong("UUIDMost"), p_70020_1_.getLong("UUIDLeast"));
        }

        this.setPosition(this.posX, this.posY, this.posZ);
        this.setRotation(this.rotationYaw, this.rotationPitch);
        if (p_70020_1_.hasKey("ForgeData"))
        {
            customEntityData = p_70020_1_.getCompoundTag("ForgeData");
        }

        for (String identifier : this.extendedProperties.keySet())
        {
            try
            {
                IExtendedEntityProperties props = this.extendedProperties.get(identifier);
                props.loadNBTData(p_70020_1_);
            }
            catch (Throwable t)
            {
                FMLLog.severe("Failed to load extended properties for %s.  This is a mod issue.", identifier);
                t.printStackTrace();
            }
        }

        //Rawr, legacy code, Vanilla added a UUID, keep this so older maps will convert properly
        if (p_70020_1_.hasKey("PersistentIDMSB") && p_70020_1_.hasKey("PersistentIDLSB"))
        {
            this.entityUniqueID = new UUID(p_70020_1_.getLong("PersistentIDMSB"), p_70020_1_.getLong("PersistentIDLSB"));
        }
        this.readEntityFromNBT(p_70020_1_);

        if (this.shouldSetPosAfterLoading())
        {
            this.setPosition(this.posX, this.posY, this.posZ);
        }
    }
    catch (Throwable throwable)
    {
        CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Loading entity NBT");
        CrashReportCategory crashreportcategory = crashreport.makeCategory("Entity being loaded");
        this.addEntityCrashInfo(crashreportcategory);
        throw new ReportedException(crashreport);
    }
}
 
Example #17
Source File: MixinEntity.java    From LiquidBounce with GNU General Public License v3.0 4 votes vote down vote up
@Shadow
public abstract void addEntityCrashInfo(CrashReportCategory category);
 
Example #18
Source File: MixinBlockModelRenderer.java    From MinecraftX-RAY with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Inject(method="renderModel", at=@At("HEAD"), cancellable=true)
private void onRenderModel(IBlockAccess worldIn, IBakedModel modelIn, IBlockState stateIn, BlockPos posIn, WorldRenderer buffer, boolean checkSides, CallbackInfoReturnable<Boolean> ci) {
    if (UyjuliansXrayModMain.xrayEnabled()) {
        Block blockIn = stateIn.getBlock();
        if (!UyjuliansXrayModMain.checkBlockList(blockIn)) {
            try {
                boolean flag = false;
                BitSet bitset = new BitSet(3);

                for (EnumFacing enumfacing : EnumFacing.values())
                {
                    List<BakedQuad> list = modelIn.func_177551_a(enumfacing);

                    if (!list.isEmpty())
                    {
                        BlockPos blockpos = posIn.offset(enumfacing);

                        if (!checkSides || UyjuliansXrayModMain.checkBlockList(worldIn.getBlockState(posIn.offset(enumfacing)).getBlock()))
                        {
                            int i = 15 << 20 | 15 << 4;
                            this.func_178260_a(worldIn, blockIn, posIn, enumfacing, i, false, buffer, list, bitset);
                            flag = true;
                        }
                    }
                }

                List<BakedQuad> list1 = modelIn.func_177550_a();

                if (list1.size() > 0)
                {
                    this.func_178260_a(worldIn, blockIn, posIn, null, -1, true, buffer, list1, bitset);
                    flag = true;
                }

                ci.setReturnValue(flag);
            } catch (Throwable throwable) {
                CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Tesselating block model while using uyjulian's X-ray mod");
                CrashReportCategory crashreportcategory = crashreport.makeCategory("Block model being tesselated");
                CrashReportCategory.addBlockInfo(crashreportcategory, posIn, stateIn);
                throw new ReportedException(crashreport);
            }
        }
        else {
            ci.setReturnValue(false);
        }
    }
}