net.minecraft.util.ReportedException Java Examples

The following examples show how to use net.minecraft.util.ReportedException. 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: 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 #3
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 #4
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 #5
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 #6
Source File: MixinIntegratedServer.java    From VanillaFix with MIT License 5 votes vote down vote up
/**
 * @reason Checks if an integrated server crash was scheduled for this tick by the
 * client, if Alt + F3 + C was pressed.
 */
@Inject(method = "tick", at = @At("HEAD"))
private void beforeTick(CallbackInfo ci) {
    if (((IPatchedMinecraft) mc).shouldCrashIntegratedServerNextTick()) {
        throw new ReportedException(new CrashReport("Manually triggered server-side debug crash", new Throwable()));
    }
}
 
Example #7
Source File: MixinMinecraft.java    From VanillaFix with MIT License 5 votes vote down vote up
/**
 * @reason Replaces the vanilla F3 + C logic to immediately crash rather than requiring
 * that the buttons are pressed for 6 seconds and add more crash types:
 * F3 + C - Client crash
 * Alt + F3 + C - Integrated server crash
 * Shift + F3 + C - Scheduled client task exception
 * Alt + Shift + F3 + C - Scheduled server task exception
 * <p>
 * Note: Left Shift + F3 + C doesn't work on most keyboards, see http://keyboardchecker.com/
 * Use the right shift instead.
 * <p>
 * TODO: Make this work outside the game too (for example on the main menu).
 */
@Redirect(method = "runTickKeyboard", at = @At(value = "FIELD", target = "Lnet/minecraft/client/Minecraft;debugCrashKeyPressTime:J", ordinal = 0))
private long checkForF3C(Minecraft mc) {
    // Fix: Check if keys are down before checking time pressed
    if (Keyboard.isKeyDown(Keyboard.KEY_F3) && Keyboard.isKeyDown(Keyboard.KEY_C)) {
        debugCrashKeyPressTime = getSystemTime();
        actionKeyF3 = true;
    } else {
        debugCrashKeyPressTime = -1L;
    }

    if (debugCrashKeyPressTime > 0L) {
        if (getSystemTime() - debugCrashKeyPressTime >= 0) {
            if (GuiScreen.isShiftKeyDown()) {
                if (GuiScreen.isAltKeyDown()) {
                    if (integratedServerIsRunning) integratedServer.addScheduledTask(() -> {
                        throw new ReportedException(new CrashReport("Manually triggered server-side scheduled task exception", new Throwable()));
                    });
                } else {
                    scheduledTasks.add(ListenableFutureTask.create(() -> {
                        throw new ReportedException(new CrashReport("Manually triggered client-side scheduled task exception", new Throwable()));
                    }));
                }
            } else {
                if (GuiScreen.isAltKeyDown()) {
                    if (integratedServerIsRunning) crashIntegratedServerNextTick = true;
                } else {
                    throw new ReportedException(new CrashReport("Manually triggered client-side debug crash", new Throwable()));
                }
            }
        }
    }
    return -1;
}
 
Example #8
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 #9
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 #10
Source File: CrashUtils.java    From VanillaFix with MIT License 4 votes vote down vote up
public static void crash(CrashReport report) {
    throw new ReportedException(report);
}
 
Example #11
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 #12
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 #13
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);
        }
    }
}