Search in sources :

Example 46 with CrashReport

use of net.minecraft.crash.CrashReport in project OreSpawn by MinecraftModDevelopmentMods.

the class Config method saveKnownConfigs.

private static void saveKnownConfigs() {
    Gson gson = new GsonBuilder().setPrettyPrinting().create();
    Path p = FileSystems.getDefault().getPath("config", "orespawn3", "sysconf", "known-configs.json");
    if (!p.toFile().getParentFile().exists()) {
        p.toFile().mkdirs();
    }
    File in = p.toFile();
    JsonArray data = new JsonArray();
    extractedConfigs.forEach(data::add);
    try {
        FileUtils.writeStringToFile(in, gson.toJson(data), Charset.defaultCharset());
    } catch (IOException e) {
        CrashReport report = CrashReport.makeCrashReport(e, "Failed saving list of already extracted mod configs");
        report.getCategory().addCrashSection("OreSpawn Version", Constants.VERSION);
        OreSpawn.LOGGER.info(report.getCompleteReport());
    }
}
Also used : Path(java.nio.file.Path) JsonArray(com.google.gson.JsonArray) GsonBuilder(com.google.gson.GsonBuilder) CrashReport(net.minecraft.crash.CrashReport) Gson(com.google.gson.Gson) IOException(java.io.IOException) File(java.io.File)

Example 47 with CrashReport

use of net.minecraft.crash.CrashReport in project OreSpawn by MinecraftModDevelopmentMods.

the class OS3APIImpl method loadConfigFiles.

public void loadConfigFiles() {
    PathMatcher featuresFiles = FileSystems.getDefault().getPathMatcher("glob:**/features-*.json");
    PathMatcher replacementsFiles = FileSystems.getDefault().getPathMatcher("glob:**/replacements-*.json");
    PathMatcher jsonMatcher = FileSystems.getDefault().getPathMatcher("glob:**/*.json");
    try (Stream<Path> stream = Files.walk(Constants.SYSCONF, 1)) {
        stream.filter(featuresFiles::matches).map(Path::toFile).forEach(features::loadFeaturesFile);
    } catch (IOException e) {
        CrashReport report = CrashReport.makeCrashReport(e, "Failed reading configs from " + Constants.SYSCONF.toString());
        report.getCategory().addCrashSection(ORE_SPAWN_VERSION, Constants.VERSION);
        OreSpawn.LOGGER.info(report.getCompleteReport());
    }
    // have to do this twice or we have issues
    try (Stream<Path> stream = Files.walk(Constants.SYSCONF, 1)) {
        stream.filter(replacementsFiles::matches).forEach(replacements::loadFile);
    } catch (IOException e) {
        CrashReport report = CrashReport.makeCrashReport(e, "Failed reading configs from " + Constants.SYSCONF.toString());
        report.getCategory().addCrashSection(ORE_SPAWN_VERSION, Constants.VERSION);
        OreSpawn.LOGGER.info(report.getCompleteReport());
    }
    if (Constants.SYSCONF.resolve("presets-default.json").toFile().exists()) {
        presets.load(Constants.SYSCONF.resolve("presets-default.json"));
    }
    try (Stream<Path> stream = Files.walk(Constants.CONFDIR, 1)) {
        stream.filter(jsonMatcher::matches).forEach(conf -> {
            try {
                OreSpawnReader.tryReadFile(conf, this);
            } catch (MissingVersionException | NotAProperConfigException | OldVersionException | UnknownVersionException e) {
                CrashReport report = CrashReport.makeCrashReport(e, "Failed reading config " + conf.toString());
                report.getCategory().addCrashSection(ORE_SPAWN_VERSION, Constants.VERSION);
                OreSpawn.LOGGER.info(report.getCompleteReport());
            }
        });
    } catch (IOException e) {
        CrashReport report = CrashReport.makeCrashReport(e, "Failed reading configs from " + Constants.CONFDIR.toString());
        report.getCategory().addCrashSection(ORE_SPAWN_VERSION, Constants.VERSION);
        OreSpawn.LOGGER.info(report.getCompleteReport());
    }
}
Also used : Path(java.nio.file.Path) MissingVersionException(com.mcmoddev.orespawn.api.exceptions.MissingVersionException) CrashReport(net.minecraft.crash.CrashReport) IOException(java.io.IOException) NotAProperConfigException(com.mcmoddev.orespawn.api.exceptions.NotAProperConfigException) PathMatcher(java.nio.file.PathMatcher) OldVersionException(com.mcmoddev.orespawn.api.exceptions.OldVersionException) UnknownVersionException(com.mcmoddev.orespawn.api.exceptions.UnknownVersionException)

Example 48 with CrashReport

use of net.minecraft.crash.CrashReport in project takumicraft by TNTModders.

the class EntityLapisCreeper method doBlockCollisions.

@Override
protected void doBlockCollisions() {
    AxisAlignedBB axisalignedbb = this.getEntityBoundingBox();
    PooledMutableBlockPos blockpos$pooledmutableblockpos = PooledMutableBlockPos.retain(axisalignedbb.minX + 0.001D, axisalignedbb.minY + 0.001D, axisalignedbb.minZ + 0.001D);
    PooledMutableBlockPos blockpos$pooledmutableblockpos1 = PooledMutableBlockPos.retain(axisalignedbb.maxX - 0.001D, axisalignedbb.maxY - 0.001D, axisalignedbb.maxZ - 0.001D);
    PooledMutableBlockPos blockpos$pooledmutableblockpos2 = PooledMutableBlockPos.retain();
    if (this.world.isAreaLoaded(blockpos$pooledmutableblockpos, blockpos$pooledmutableblockpos1)) {
        for (int i = blockpos$pooledmutableblockpos.getX(); i <= blockpos$pooledmutableblockpos1.getX(); ++i) {
            for (int j = blockpos$pooledmutableblockpos.getY(); j <= blockpos$pooledmutableblockpos1.getY(); ++j) {
                for (int k = blockpos$pooledmutableblockpos.getZ(); k <= blockpos$pooledmutableblockpos1.getZ(); ++k) {
                    blockpos$pooledmutableblockpos2.setPos(i, j, k);
                    IBlockState iblockstate = this.world.getBlockState(blockpos$pooledmutableblockpos2);
                    try {
                        iblockstate.getBlock().onEntityCollidedWithBlock(this.world, blockpos$pooledmutableblockpos2, iblockstate, this);
                        this.onInsideBlock(iblockstate);
                    } catch (Throwable throwable) {
                        CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Colliding entity with block");
                        CrashReportCategory crashreportcategory = crashreport.makeCategory("Block being collided with");
                        CrashReportCategory.addBlockInfo(crashreportcategory, blockpos$pooledmutableblockpos2, iblockstate);
                        throw new ReportedException(crashreport);
                    }
                }
            }
        }
    }
    blockpos$pooledmutableblockpos.release();
    blockpos$pooledmutableblockpos1.release();
    blockpos$pooledmutableblockpos2.release();
}
Also used : AxisAlignedBB(net.minecraft.util.math.AxisAlignedBB) PooledMutableBlockPos(net.minecraft.util.math.BlockPos.PooledMutableBlockPos) IBlockState(net.minecraft.block.state.IBlockState) CrashReport(net.minecraft.crash.CrashReport) CrashReportCategory(net.minecraft.crash.CrashReportCategory) ReportedException(net.minecraft.util.ReportedException)

Example 49 with CrashReport

use of net.minecraft.crash.CrashReport in project Random-Things by lumien231.

the class AsmHandler method renderBlock.

@SideOnly(Side.CLIENT)
public static int renderBlock(BlockRendererDispatcher dispatcher, IBlockState state, BlockPos pos, IBlockAccess blockAccess, BufferBuilder worldRendererIn) {
    synchronized (TileEntityLightRedirector.redirectorSet) {
        if (!TileEntityLightRedirector.redirectorSet.isEmpty()) {
            blockAccess = Minecraft.getMinecraft().world;
            BlockPos changedPos = getSwitchedPosition(blockAccess, pos);
            posSet.clear();
            if (!changedPos.equals(pos)) {
                state = blockAccess.getBlockState(changedPos);
                try {
                    EnumBlockRenderType enumblockrendertype = state.getRenderType();
                    if (enumblockrendertype == EnumBlockRenderType.INVISIBLE) {
                    } else {
                        if (blockAccess.getWorldType() != WorldType.DEBUG_ALL_BLOCK_STATES) {
                            try {
                                state = state.getActualState(blockAccess, changedPos);
                            } catch (Exception var8) {
                                ;
                            }
                        }
                        switch(enumblockrendertype) {
                            case MODEL:
                                IBakedModel model = dispatcher.getModelForState(state);
                                state = state.getBlock().getExtendedState(state, blockAccess, changedPos);
                                return dispatcher.getBlockModelRenderer().renderModel(blockAccess, model, state, pos, worldRendererIn, true) ? 1 : 0;
                            case ENTITYBLOCK_ANIMATED:
                                return 0;
                            case LIQUID:
                                return 2;
                            default:
                                return 0;
                        }
                    }
                } 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);
                }
                return 0;
            }
        }
        return 2;
    }
}
Also used : CrashReport(net.minecraft.crash.CrashReport) BlockPos(net.minecraft.util.math.BlockPos) IBakedModel(net.minecraft.client.renderer.block.model.IBakedModel) ReportedException(net.minecraft.util.ReportedException) CrashReportCategory(net.minecraft.crash.CrashReportCategory) EnumBlockRenderType(net.minecraft.util.EnumBlockRenderType) ReportedException(net.minecraft.util.ReportedException) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 50 with CrashReport

use of net.minecraft.crash.CrashReport in project takumicraft by TNTModders.

the class TakumiBiomeProvider method getBiomesForGeneration.

/**
 * 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], Biomes.DEFAULT);
        }
        return biomes;
    } catch (Throwable throwable) {
        CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Invalid Biome id");
        CrashReportCategory crashreportcategory = crashreport.makeCategory("RawBiomeBlock");
        crashreportcategory.addCrashSection("biomes[] size", biomes.length);
        crashreportcategory.addCrashSection("x", x);
        crashreportcategory.addCrashSection("z", z);
        crashreportcategory.addCrashSection("w", width);
        crashreportcategory.addCrashSection("h", height);
        throw new ReportedException(crashreport);
    }
}
Also used : CrashReport(net.minecraft.crash.CrashReport) CrashReportCategory(net.minecraft.crash.CrashReportCategory) ReportedException(net.minecraft.util.ReportedException)

Aggregations

CrashReport (net.minecraft.crash.CrashReport)55 CrashReportCategory (net.minecraft.crash.CrashReportCategory)37 ReportedException (net.minecraft.util.ReportedException)37 IOException (java.io.IOException)15 BlockPos (net.minecraft.util.math.BlockPos)11 IBlockState (net.minecraft.block.state.IBlockState)7 Chunk (net.minecraft.world.chunk.Chunk)7 JsonArray (com.google.gson.JsonArray)6 JsonElement (com.google.gson.JsonElement)6 JsonObject (com.google.gson.JsonObject)6 JsonParser (com.google.gson.JsonParser)6 ResourceLocation (net.minecraft.util.ResourceLocation)6 World (net.minecraft.world.World)5 Gson (com.google.gson.Gson)4 GsonBuilder (com.google.gson.GsonBuilder)4 Path (java.nio.file.Path)4 Block (net.minecraft.block.Block)4 Overwrite (org.spongepowered.asm.mixin.Overwrite)4 BufferedWriter (java.io.BufferedWriter)3 JsonIOException (com.google.gson.JsonIOException)2