Jump to content

Help? Game crashes? [Resolved]


XMan3

Recommended Posts

I have been dealing with this problem now for a while, and I still think how can I make this work. I know what is the error (or I think... at least...) But when I try to fix it, It crashes my game.

 

My main class:

package net.surpriseoremod.mod;

 

import net.minecraft.creativetab.CreativeTabs;

import net.minecraft.init.Blocks;

import net.minecraft.item.Item;

import net.surpriseoremod.mod.blocks.BlocksSO;

import net.surpriseoremod.mod.worldgen.SOWorldGen;

import cpw.mods.fml.common.Mod;

import cpw.mods.fml.common.Mod.EventHandler;

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.registry.GameRegistry;

import cpw.mods.fml.relauncher.Side;

import cpw.mods.fml.relauncher.SideOnly;

 

@Mod(modid="surpriseoremod",version="1.0",name = "Suprise Ore Mod")

public class Main {

 

// Setup the CreativeTabs to SOM

public static CreativeTabs tabSOM = new CreativeTabs("SurpriseOre") {

@SideOnly(Side.CLIENT)

public Item getTabIconItem() {

// Get the block to use in the CT

return Item.getItemFromBlock(BlocksSO.blockOres);

}

};

 

SOWorldGen eventWorldGen = new SOWorldGen();

 

// PreInit,Init,PostInit

@EventHandler

public void preInit(FMLPreInitializationEvent preEvent)

{

System.out.println("[surpiseOreMod] Loading...");

BlocksSO.init();

GameRegistry.registerWorldGenerator(eventWorldGen, 1);

}

 

@EventHandler

public void init(FMLInitializationEvent event)

{

// Nothing in here.

}

 

@EventHandler

public void PostInit(FMLPostInitializationEvent postEvent)

{

System.out.println("[surpiseOreMod] Done loading!");

}

}

 

My BlockDecSO:

package net.surpriseoremod.mod.blocks;

 

import net.minecraft.block.Block;

 

public class BlockDecSO {

public static Block blockOres;

}

 

BlockOres:

package net.surpriseoremod.mod.blocks;

 

import java.util.List;

import java.util.Random;

 

import net.minecraft.block.Block;

import net.minecraft.block.material.Material;

import net.minecraft.client.renderer.texture.IIconRegister;

import net.minecraft.creativetab.CreativeTabs;

import net.minecraft.item.Item;

import net.minecraft.item.ItemStack;

import net.minecraft.util.IIcon;

import net.surpriseoremod.mod.Main;

import cpw.mods.fml.relauncher.Side;

import cpw.mods.fml.relauncher.SideOnly;

 

public class BlockOres extends Block {

 

public static String dropitem;

int drop=0; // Unused... for now...

 

@SideOnly(Side.CLIENT)

private IIcon[] texture;

 

public final static String[] subBlocks = new String[] {"Surprise Ore"};

protected BlockOres() {

super(Material.glass);

this.setHardness(3.0F);

this.setResistance(5.0F);

this.setCreativeTab(Main.tabSOM);

this.setHarvestLevel("pickaxe",2);

Random random = new Random();

getItemDropped(0,random,1);

}

 

@SideOnly(Side.CLIENT)

public void registerBlockIcons(IIconRegister iconRegister) {

texture = new IIcon[subBlocks.length];

 

for(int i = 0; i < subBlocks.length; i++)

{

texture = iconRegister.registerIcon("surpriseoremod:"+subBlocks + "Ore");

}

}

 

@SideOnly(Side.CLIENT)

public void getSubBlocks(Item block, CreativeTabs creativeTabs, List list) {

for(int i = 0; i < subBlocks.length; i++) {

list.add(new ItemStack(block, 1, i));

}

}

 

@SideOnly(Side.CLIENT)

public IIcon getIcon(int side,int meta) {

return texture[meta];

}

 

public int damageDropped(int meta) {

return meta;

}

 

@Override

    public Item getItemDropped(int metadata, Random random, int fortune) {

drop = random.nextInt(100) + 1;

    System.out.println(drop);

    if(drop >= 0 && drop <= 50)

    {

    dropitem = "264";

    return Item.getItemById(264);

    }

    if(drop >= 51 && drop <= 70)

    {

    dropitem = "351";

    return Item.getItemById(351);

    }

    if(drop >= 71 && drop <= 90)

    {

    dropitem = "331";

    return Item.getItemById(331);

    }

    if(drop >= 91 && drop <= 95)

    {

    dropitem = "266";

    return Item.getItemById(266);

    }

    if(drop >= 96 && drop <= 101)

    {

    dropitem = "388";

    return Item.getItemById(388);

    }

   

    return null;

    }

}

 

BlockSO [------ I think the error is here -------]

package net.surpriseoremod.mod.blocks;

 

import static net.surpriseoremod.mod.blocks.BlockDecSO.blockOres;

import net.minecraft.block.Block;

import net.surpriseoremod.mod.itemblocks.ItemBlockOres;

import cpw.mods.fml.common.registry.GameRegistry;

public class BlocksSO {

 

public static Block blockOres; // <----- This is the error causing line... It is supposed to be "null", until I execute the script labeled with NULLOFF

 

public static void init() {

registerBlocks();

}

 

public static void registerBlocks() {

blockOres = new BlockOres().setBlockName("surpriseore"); // <---- NULLOFF

GameRegistry.registerBlock(blockOres, ItemBlockOres.class, "blockOres");

}

}

 

ItemBlockOres:

package net.surpriseoremod.mod.itemblocks;

 

import net.minecraft.block.Block;

import net.minecraft.item.ItemBlock;

import net.minecraft.item.ItemStack;

 

public class ItemBlockOres extends ItemBlock {

 

final static String[] subBlocks = new String[] {"Surprise Ore"};

 

public ItemBlockOres(Block block) {

super(block);

this.setHasSubtypes(true);

}

 

public String getUnlocalizedName(ItemStack itemstack) {

int i = itemstack.getItemDamage();

if(i < 0 || i >= subBlocks.length) {

i = 0;

}

 

return super.getUnlocalizedName() + "." + subBlocks + "Ore";

}

 

public int getMetadata(int meta) {

return meta;

}

}

 

SOWorldGen:

package net.surpriseoremod.mod.worldgen;

 

import java.util.Random;

 

import net.minecraft.block.Block;

import net.minecraft.init.Blocks;

import net.minecraft.world.World;

import net.minecraft.world.chunk.IChunkProvider;

import net.minecraft.world.gen.feature.WorldGenMinable;

import net.surpriseoremod.mod.blocks.BlockDecSO;

import cpw.mods.fml.common.IWorldGenerator;

 

public class SOWorldGen implements IWorldGenerator {

 

@Override

public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) {

switch(world.provider.dimensionId) {

 

case 0: // Overworld

generateSurface(world, random, chunkX*16, chunkZ*16);

}

}

 

private void generateSurface(World world, Random random, int x, int z) {

 

this.addOreSpawn(BlockDecSO.blockOres, 0,  world, random, x, z, 16, 16, 4, 25, 38, 100); //For release: Change the 100 to 32, set the height to 1-32...

 

}

 

private void addOreSpawn(Block block, int meta, World world, Random random, int blockXPos, int blockZPos, int maxX, int maxZ, int maxVeinSize, int chanceToSpawn, int minY, int maxY) {

 

for(int i = 0; i < chanceToSpawn; i++) {

int posX = blockXPos + random.nextInt(maxX);

int posY = minY + random.nextInt(maxY - minY);

int posZ = blockZPos + random.nextInt(maxZ);

(new WorldGenMinable(block, meta, maxVeinSize, Blocks.stone)).generate(world, random, posX, posY, posZ);

}

 

}

 

}

 

Eclipse doesn't seem to detect error(s) for this code?!

 

Error:

... Blah blah blah...

[21:11:15] [server thread/INFO] [FML]: Injecting existing block and item data into this server instance

[21:11:15] [server thread/INFO] [FML]: Applying holder lookups

[21:11:15] [server thread/INFO] [FML]: Holder lookups applied

[21:11:17] [server thread/INFO] [FML]: Loading dimension 0 (New World) (net.minecraft.server.integrated.IntegratedServer@34c9f128)

[21:11:17] [server thread/INFO] [FML]: Loading dimension 1 (New World) (net.minecraft.server.integrated.IntegratedServer@34c9f128)

[21:11:17] [server thread/INFO] [FML]: Loading dimension -1 (New World) (net.minecraft.server.integrated.IntegratedServer@34c9f128)

[21:11:17] [server thread/INFO]: Preparing start region for level 0

[21:11:18] [server thread/ERROR]: Encountered an unexpected exception

java.lang.NullPointerException

at net.minecraft.world.chunk.storage.ExtendedBlockStorage.func_150818_a(ExtendedBlockStorage.java:86) ~[ExtendedBlockStorage.class:?]

at net.minecraft.world.chunk.Chunk.func_150807_a(Chunk.java:653) ~[Chunk.class:?]

at net.minecraft.world.World.setBlock(World.java:519) ~[World.class:?]

at net.minecraft.world.gen.feature.WorldGenMinable.generate(WorldGenMinable.java:79) ~[WorldGenMinable.class:?]

at net.surpriseoremod.mod.worldgen.SOWorldGen.addOreSpawn(SOWorldGen.java:36) ~[sOWorldGen.class:?]

at net.surpriseoremod.mod.worldgen.SOWorldGen.generateSurface(SOWorldGen.java:26) ~[sOWorldGen.class:?]

at net.surpriseoremod.mod.worldgen.SOWorldGen.generate(SOWorldGen.java:20) ~[sOWorldGen.class:?]

at cpw.mods.fml.common.registry.GameRegistry.generateWorld(GameRegistry.java:106) ~[GameRegistry.class:?]

at net.minecraft.world.gen.ChunkProviderServer.populate(ChunkProviderServer.java:314) ~[ChunkProviderServer.class:?]

at net.minecraft.world.chunk.Chunk.populateChunk(Chunk.java:1157) ~[Chunk.class:?]

at net.minecraft.world.gen.ChunkProviderServer.originalLoadChunk(ChunkProviderServer.java:208) ~[ChunkProviderServer.class:?]

at net.minecraft.world.gen.ChunkProviderServer.loadChunk(ChunkProviderServer.java:149) ~[ChunkProviderServer.class:?]

at net.minecraft.world.gen.ChunkProviderServer.loadChunk(ChunkProviderServer.java:119) ~[ChunkProviderServer.class:?]

at net.minecraft.server.MinecraftServer.initialWorldChunkLoad(MinecraftServer.java:305) ~[MinecraftServer.class:?]

at net.minecraft.server.integrated.IntegratedServer.loadAllWorlds(IntegratedServer.java:79) ~[integratedServer.class:?]

at net.minecraft.server.integrated.IntegratedServer.startServer(IntegratedServer.java:96) ~[integratedServer.class:?]

at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:445) [MinecraftServer.class:?]

at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:752) [MinecraftServer$2.class:?]

[21:11:18] [server thread/ERROR]: This crash report has been saved to: C:\Users\Mikko\Desktop\SupOreMod\eclipse\.\crash-reports\crash-2015-01-03_21.11.18-server.txt

[21:11:18] [server thread/INFO] [FML]: Applying holder lookups

[21:11:18] [server thread/INFO] [FML]: Holder lookups applied

[21:11:18] [server thread/INFO] [FML]: The state engine was in incorrect state SERVER_STARTING and forced into state SERVER_STOPPED. Errors may have been discarded.

[21:11:19] [Client thread/INFO] [sTDOUT]: [net.minecraft.client.Minecraft:displayCrashReport:388]: ---- Minecraft Crash Report ----

// I just don't know what went wrong :(

 

Time: 3.1.2015 21:11

Description: Exception in server tick loop

 

java.lang.NullPointerException: Exception in server tick loop

at net.minecraft.world.chunk.storage.ExtendedBlockStorage.func_150818_a(ExtendedBlockStorage.java:86)

at net.minecraft.world.chunk.Chunk.func_150807_a(Chunk.java:653)

at net.minecraft.world.World.setBlock(World.java:519)

at net.minecraft.world.gen.feature.WorldGenMinable.generate(WorldGenMinable.java:79)

at net.surpriseoremod.mod.worldgen.SOWorldGen.addOreSpawn(SOWorldGen.java:36)

at net.surpriseoremod.mod.worldgen.SOWorldGen.generateSurface(SOWorldGen.java:26)

at net.surpriseoremod.mod.worldgen.SOWorldGen.generate(SOWorldGen.java:20)

at cpw.mods.fml.common.registry.GameRegistry.generateWorld(GameRegistry.java:106)

at net.minecraft.world.gen.ChunkProviderServer.populate(ChunkProviderServer.java:314)

at net.minecraft.world.chunk.Chunk.populateChunk(Chunk.java:1157)

at net.minecraft.world.gen.ChunkProviderServer.originalLoadChunk(ChunkProviderServer.java:208)

at net.minecraft.world.gen.ChunkProviderServer.loadChunk(ChunkProviderServer.java:149)

at net.minecraft.world.gen.ChunkProviderServer.loadChunk(ChunkProviderServer.java:119)

at net.minecraft.server.MinecraftServer.initialWorldChunkLoad(MinecraftServer.java:305)

at net.minecraft.server.integrated.IntegratedServer.loadAllWorlds(IntegratedServer.java:79)

at net.minecraft.server.integrated.IntegratedServer.startServer(IntegratedServer.java:96)

at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:445)

at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:752)

 

 

A detailed walkthrough of the error, its code path and all known details is as follows:

---------------------------------------------------------------------------------------

 

-- System Details --

Details:

Minecraft Version: 1.7.10

Operating System: Windows 7 (amd64) version 6.1

Java Version: 1.7.0_67, Oracle Corporation

Java VM Version: Java HotSpot 64-Bit Server VM (mixed mode), Oracle Corporation

Memory: 855972672 bytes (816 MB) / 1037959168 bytes (989 MB) up to 1037959168 bytes (989 MB)

JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M

AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used

IntCache: cache: 0, tcache: 0, allocated: 13, tallocated: 95

FML: MCP v9.05 FML v7.10.85.1230 Minecraft Forge 10.13.2.1230 4 mods loaded, 4 mods active

mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available

FML{7.10.85.1230} [Forge Mod Loader] (forgeSrc-1.7.10-10.13.2.1230.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available

Forge{10.13.2.1230} [Minecraft Forge] (forgeSrc-1.7.10-10.13.2.1230.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available

surpriseoremod{1.0} [suprise Ore Mod] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available

Profiler Position: N/A (disabled)

Vec3 Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used

Player Count: 0 / 8; []

Type: Integrated Server (map_client.txt)

Is Modded: Definitely; Client brand changed to 'fml,forge'

[21:11:19] [Client thread/INFO] [sTDOUT]: [net.minecraft.client.Minecraft:displayCrashReport:393]: #@!@# Game crashed! Crash report saved to: #@!@# .\crash-reports\crash-2015-01-03_21.11.18-server.txt

AL lib: (EE) alc_cleanup: 1 device not closed

 

- XMan3, The lonely nerd.

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.