类net.minecraft.util.ReportedException源码实例Demo

下面列出了怎么用net.minecraft.util.ReportedException的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: TofuCraftReload   文件: GenLayerTofu.java
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);
        }
    }
}
 
源代码2 项目: litematica   文件: BlockModelRendererSchematic.java
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);
    }
}
 
源代码3 项目: TofuCraftReload   文件: BiomeProviderTofu.java
/**
 * 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);
    }
}
 
源代码4 项目: TofuCraftReload   文件: BiomeProviderTofu.java
/**
 * 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);
    }
}
 
源代码5 项目: litematica   文件: RenderGlobalSchematic.java
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);
    }
}
 
源代码6 项目: VanillaFix   文件: MixinIntegratedServer.java
/**
 * @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()));
    }
}
 
源代码7 项目: VanillaFix   文件: MixinMinecraft.java
/**
 * @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;
}
 
源代码8 项目: TickDynamic   文件: Entity.java
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);
                    }
                }
            }
        }
    }
}
 
源代码9 项目: AdvancedRocketry   文件: ChunkManagerPlanet.java
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);
	}
}
 
源代码10 项目: VanillaFix   文件: CrashUtils.java
public static void crash(CrashReport report) {
    throw new ReportedException(report);
}
 
源代码11 项目: TickDynamic   文件: Entity.java
/**
 * 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);
    }
}
 
源代码12 项目: TickDynamic   文件: Entity.java
/**
 * 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);
    }
}
 
源代码13 项目: MinecraftX-RAY   文件: MixinBlockModelRenderer.java
@Inject(method="renderModel", [email protected]("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);
        }
    }
}
 
 类所在包
 同包方法