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());
}
}
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());
}
}
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();
}
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;
}
}
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);
}
}
Aggregations