Posted June 15, 201312 yr Hey all, I am having a little trouble (okay, a lot of trouble). I just finished coding for a new ore I want to add with my mod, got it so that I could test and everything, and then I get his error. ---- Minecraft Crash Report ---- // Daisy, daisy... Time: 6/15/13 1:38 PM Description: Exception getting block type in world java.lang.NullPointerException at ceepCraft.CeepWorldGeneration.generateSurface(CeepWorldGeneration.java:44) at ceepCraft.CeepWorldGeneration.generate(CeepWorldGeneration.java:21) at cpw.mods.fml.common.registry.GameRegistry.generateWorld(GameRegistry.java:102) at net.minecraft.world.gen.ChunkProviderServer.populate(ChunkProviderServer.java:259) at net.minecraft.world.chunk.Chunk.populateChunk(Chunk.java:1234) at net.minecraft.world.gen.ChunkProviderServer.loadChunk(ChunkProviderServer.java:153) at net.minecraft.world.gen.ChunkProviderServer.provideChunk(ChunkProviderServer.java:166) at net.minecraft.world.World.getChunkFromChunkCoords(World.java:525) at net.minecraft.world.World.getBlockId(World.java:410) at net.minecraft.world.World.isAirBlock(World.java:434) at net.minecraft.world.World.getFirstUncoveredBlock(World.java:381) at net.minecraft.world.WorldProvider.canCoordinateBeSpawn(WorldProvider.java:100) at net.minecraft.world.WorldServer.createSpawnPosition(WorldServer.java:837) at net.minecraft.world.WorldServer.initialize(WorldServer.java:801) at net.minecraft.world.World.<init>(World.java:294) at net.minecraft.world.WorldServer.<init>(WorldServer.java:107) at net.minecraft.server.integrated.IntegratedServer.loadAllWorlds(IntegratedServer.java:72) at net.minecraft.server.integrated.IntegratedServer.startServer(IntegratedServer.java:105) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:430) at net.minecraft.server.ThreadMinecraftServer.run(ThreadMinecraftServer.java:16) A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- Head -- Stacktrace: at ceepCraft.CeepWorldGeneration.generateSurface(CeepWorldGeneration.java:44) at ceepCraft.CeepWorldGeneration.generate(CeepWorldGeneration.java:21) at cpw.mods.fml.common.registry.GameRegistry.generateWorld(GameRegistry.java:102) at net.minecraft.world.gen.ChunkProviderServer.populate(ChunkProviderServer.java:259) at net.minecraft.world.chunk.Chunk.populateChunk(Chunk.java:1234) at net.minecraft.world.gen.ChunkProviderServer.loadChunk(ChunkProviderServer.java:153) at net.minecraft.world.gen.ChunkProviderServer.provideChunk(ChunkProviderServer.java:166) at net.minecraft.world.World.getChunkFromChunkCoords(World.java:525) -- Requested block coordinates -- Details: Found chunk: true Location: World: (-198,64,-354), Chunk: (at 10,4,14 in -13,-23; contains blocks -208,0,-368 to -193,255,-353), Region: (-1,-1; contains chunks -32,-32 to -1,-1, blocks -512,0,-512 to -1,255,-1) Stacktrace: at net.minecraft.world.World.getBlockId(World.java:410) at net.minecraft.world.World.isAirBlock(World.java:434) at net.minecraft.world.World.getFirstUncoveredBlock(World.java:381) at net.minecraft.world.WorldProvider.canCoordinateBeSpawn(WorldProvider.java:100) at net.minecraft.world.WorldServer.createSpawnPosition(WorldServer.java:837) at net.minecraft.world.WorldServer.initialize(WorldServer.java:801) -- Affected level -- Details: Level name: New World All players: 0 total; [] Chunk stats: ServerChunkCache: 76 Drop: 0 Level seed: 4695239151734553395 Level generator: ID 00 - default, ver 1. Features enabled: true Level generator options: Level spawn location: World: (0,0,0), Chunk: (at 0,0,0 in 0,0; contains blocks 0,0,0 to 15,255,15), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,0,0 to 511,255,511) Level time: 0 game time, 0 day time Level dimension: 0 Level storage version: 0x04ABD - Anvil Level weather: Rain time: 0 (now: false), thunder time: 0 (now: false) Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: true Stacktrace: at net.minecraft.world.World.<init>(World.java:294) at net.minecraft.world.WorldServer.<init>(WorldServer.java:107) at net.minecraft.server.integrated.IntegratedServer.loadAllWorlds(IntegratedServer.java:72) at net.minecraft.server.integrated.IntegratedServer.startServer(IntegratedServer.java:105) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:430) at net.minecraft.server.ThreadMinecraftServer.run(ThreadMinecraftServer.java:16) -- System Details -- Details: Minecraft Version: 1.5.2 Operating System: Windows 7 (x86) version 6.1 Java Version: 1.7.0_13, Oracle Corporation Java VM Version: Java HotSpot Client VM (mixed mode), Oracle Corporation Memory: 938180304 bytes (894 MB) / 1046937600 bytes (998 MB) up to 1046937600 bytes (998 MB) JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used Suspicious classes: FML and Forge are installed IntCache: cache: 2, tcache: 0, allocated: 1, tallocated: 63 FML: MCP v7.51 FML v5.2.2.684 Minecraft Forge 7.8.0.684 4 mods loaded, 4 mods active mcp{7.44} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available FML{5.2.2.684} [Forge Mod Loader] (coremods) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available Forge{7.8.0.684} [Minecraft Forge] (coremods) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available CeepCraft{1.0.0} [Ceepcraft] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available Profiler Position: N/A (disabled) Player Count: 0 / 8; [] Type: Integrated Server (map_client.txt) Is Modded: Definitely; Client brand changed to 'fml,forge' Now, when I take out this line of code the game loads, but no ore is generated. GameRegistry.registerWorldGenerator(new CeepWorldGeneration()); Any help is really appreciated.
June 15, 201312 yr Howza 'bout your CeepWorldGeneration class. BEWARE OF GOD --- Co-author of Pentachoron Labs' SBFP Tech.
June 15, 201312 yr Author Here you go. package ceepCraft; import java.util.Random; import net.minecraft.world.World; import net.minecraft.world.chunk.IChunkProvider; import net.minecraft.world.gen.feature.WorldGenMinable; import cpw.mods.fml.common.IWorldGenerator; public class CeepWorldGeneration implements IWorldGenerator{ @Override public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) { // TODO Auto-generated method stub switch(world.provider.dimensionId){ case -1: generateNether(world, random, chunkX * 16, chunkZ * 16); break; case 0: generateSurface(world, random, chunkX * 16, chunkZ * 16); break; case 1: generateEnd(world, random, chunkX * 16, chunkZ * 16); break; } } private void generateEnd(World world, Random random, int chunkX, int chunkZ) { // TODO Auto-generated method stub } private void generateSurface(World world, Random random, int chunkX, int chunkZ) { // TODO Auto-generated method stub for(int c = 0; c<16; c++){ int x = chunkX + random.nextInt(16); int y = random.nextInt(60); int z = chunkZ + random.nextInt(16); (new WorldGenMinable(Ceepe.JorganOre.blockID, 10)).generate(world, random, x, y, z); } } private void generateNether(World world, Random random, int chunkX, int chunkZ) { // TODO Auto-generated method stub } } And, when I add in a second block, it names them both the same thing, here is my updated Ceepe code. package ceepCraft; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.world.gen.feature.WorldGenMinable; import net.minecraftforge.common.MinecraftForge; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.Init; import cpw.mods.fml.common.Mod.Instance; import cpw.mods.fml.common.Mod.PostInit; import cpw.mods.fml.common.Mod.PreInit; import cpw.mods.fml.common.SidedProxy; import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLPostInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.network.NetworkMod; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.common.registry.LanguageRegistry; @Mod(modid="CeepCraft", name="Ceepcraft", version="1.0.0") @NetworkMod(clientSideRequired=true, serverSideRequired=false) public class Ceepe { @Instance("Ceepcraft") public static Ceepe instance; @SidedProxy(clientSide="ceepCraft.Ceep.client.ClientProxy",serverSide="ceepCraft.Ceep.CommonProxy") public static CommonProxy proxy; public static String modid; @PreInit public void preInit(FMLPreInitializationEvent event) { } public final static Block JorganOre = new JorganOre(501,1, Material.iron);; public static Block CeeygOre= new CeeygOre(502, 2, Material.iron); @Init public void load(FMLInitializationEvent event) { LanguageRegistry.addName(CeeygOre, "Ceeyg Ore"); MinecraftForge.setBlockHarvestLevel(CeeygOre, "pickaxe", 3); GameRegistry.registerBlock(CeeygOre, "ceeygore"); LanguageRegistry.addName(JorganOre, "Jorgan Ore"); MinecraftForge.setBlockHarvestLevel(JorganOre, "pickaxe", 3); GameRegistry.registerBlock(JorganOre, "jorganore"); proxy.registerRenderThings(); } @PostInit public void postInit(FMLPostInitializationEvent event) { // Stub Method } }
June 16, 201312 yr You waited two hours. I'm not on all day. Be patient. Anyway, I have a feeling that your Ceepe.JorganOre might not be initialized. That's the only thing that would be causing an NPE. BEWARE OF GOD --- Co-author of Pentachoron Labs' SBFP Tech.
June 16, 201312 yr Author I wasn't referring to just you, I understand, I was just hoping that someone else might be able to help. Anyways, I fixed them both, it turns out the tutorial I had based everything off of was using old forge code, it was simply a matter of me adjusting to the new. Thank though.
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.