Jump to content

[1.6.4] RESOLVED Java.lang.OutOfMemoryError after registering a custom block


DiabolusNeil

Recommended Posts

This is starting to get really annoying. I'm working on my mod which adds custom blocks, and after launching the game for about the 100th time, every time I try and enter a world (new or old) I keep getting this error message.

 

 

 

2014-02-01 20:27:14 [iNFO] [sTDERR] java.lang.OutOfMemoryError: Java heap space

2014-02-01 20:27:19 [iNFO] [sTDERR] at java.util.ArrayList.<init>(ArrayList.java:112)

2014-02-01 20:27:24 [iNFO] [sTDERR] at java.util.ArrayList.<init>(ArrayList.java:119)

2014-02-01 20:27:31 [iNFO] [sTDERR] at net.minecraft.world.World.getEntitiesWithinAABBExcludingEntity(World.java:3619)

2014-02-01 20:27:40 [iNFO] [sTDERR] at net.minecraft.world.World.getEntitiesWithinAABBExcludingEntity(World.java:3614)

2014-02-01 20:27:43 [iNFO] [sTDERR] at net.minecraft.world.World.getCollidingBoundingBoxes(World.java:1692)

2014-02-01 20:27:50 [iNFO] [sTDERR] at net.minecraft.entity.player.EntityPlayerMP.<init>(EntityPlayerMP.java:187)

2014-02-01 20:28:00 [iNFO] [sTDERR] at net.minecraft.server.management.ServerConfigurationManager.createPlayerForUser(ServerConfigurationManager.java:389)

2014-02-01 20:28:24 [iNFO] [sTDERR] at net.minecraft.server.integrated.IntegratedServerListenThread.networkTick(IntegratedServerListenThread.java:91)

2014-02-01 20:28:26 [iNFO] [sTDERR] at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:691)

2014-02-01 20:28:28 [iNFO] [sTDERR] at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:587)

2014-02-01 20:28:30 [iNFO] [sTDERR] at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:129)

2014-02-01 20:28:36 [sEVERE] [ForgeModLoader] Unable to launch

java.lang.reflect.InvocationTargetException

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:597)

at net.minecraft.launchwrapper.Launch.launch(Launch.java:131)

at net.minecraft.launchwrapper.Launch.main(Launch.java:27)

Caused by: java.lang.OutOfMemoryError: Java heap space

2014-02-01 20:28:39 [iNFO] [sTDERR] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:484)

2014-02-01 20:28:41 [iNFO] [sTDERR] at net.minecraft.server.ThreadMinecraftServer.run(ThreadMinecraftServer.java:16)

2014-02-01 20:28:44 [iNFO] [sTDERR] Exception in thread "Poller SunPKCS11-Darwin" java.lang.OutOfMemoryError: Java heap space

2014-02-01 20:28:44 [iNFO] [sTDERR] at sun.security.pkcs11.wrapper.PKCS11.C_GetSlotInfo(Native Method)

2014-02-01 20:28:44 [iNFO] [sTDERR] at sun.security.pkcs11.SunPKCS11.initToken(SunPKCS11.java:767)

2014-02-01 20:28:44 [iNFO] [sTDERR] at sun.security.pkcs11.SunPKCS11.access$100(SunPKCS11.java:42)

2014-02-01 20:28:41 [sEVERE] [Minecraft-Server] Encountered an unexpected exception OutOfMemoryError

java.lang.OutOfMemoryError: Java heap space

at java.util.ArrayList.<init>(ArrayList.java:112)

at java.util.ArrayList.<init>(ArrayList.java:119)

at net.minecraft.world.World.getEntitiesWithinAABBExcludingEntity(World.java:3619)

at net.minecraft.world.World.getEntitiesWithinAABBExcludingEntity(World.java:3614)

at net.minecraft.world.World.getCollidingBoundingBoxes(World.java:1692)

at net.minecraft.entity.player.EntityPlayerMP.<init>(EntityPlayerMP.java:187)

at net.minecraft.server.management.ServerConfigurationManager.createPlayerForUser(ServerConfigurationManager.java:389)

at net.minecraft.server.integrated.IntegratedServerListenThread.networkTick(IntegratedServerListenThread.java:91)

at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:691)

at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:587)

at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:129)

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

at net.minecraft.server.ThreadMinecraftServer.run(ThreadMinecraftServer.java:16)

2014-02-01 20:28:50 [iNFO] [sTDERR] at sun.security.pkcs11.SunPKCS11$TokenPoller.run(SunPKCS11.java:700)

2014-02-01 20:28:50 [iNFO] [sTDERR] at java.lang.Thread.run(Thread.java:695)

2014-02-01 20:29:10 [sEVERE] [Minecraft-Server] This crash report has been saved to: /Users/theboys/Desktop/development/forge/mcp/jars/./crash-reports/crash-2014-02-01_20.29.04-server.txt

2014-02-01 20:29:12 [iNFO] [Minecraft-Server] Stopping server

2014-02-01 20:29:12 [iNFO] [Minecraft-Server] Saving players

2014-02-01 20:29:12 [iNFO] [Minecraft-Server] Saving worlds

2014-02-01 20:29:12 [iNFO] [Minecraft-Server] Saving chunks for level 'New World'/Overworld

2014-02-01 20:29:24 [iNFO] [sTDERR] java.lang.OutOfMemoryError: Java heap space

2014-02-01 20:29:27 [iNFO] [ForgeModLoader] The state engine was in incorrect state SERVER_STOPPING and forced into state SERVER_STOPPED. Errors may have been discarded.

2014-02-01 20:29:47 [iNFO] [sTDERR] Exception in thread "Server thread" java.lang.NoClassDefFoundError: cpw/mods/fml/common/ObfuscationReflectionHelper

2014-02-01 20:29:47 [iNFO] [sTDERR] at cpw.mods.fml.common.FMLCommonHandler.handleServerStopped(FMLCommonHandler.java:472)

2014-02-01 20:29:47 [iNFO] [sTDERR] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:546)

2014-02-01 20:29:51 [iNFO] [sTDERR] at net.minecraft.server.ThreadMinecraftServer.run(ThreadMinecraftServer.java:16)

2014-02-01 20:29:51 [iNFO] [sTDERR] Caused by: java.lang.ClassNotFoundException: cpw.mods.fml.common.ObfuscationReflectionHelper

2014-02-01 20:29:49 [iNFO] [sTDERR] at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:186)

2014-02-01 20:29:49 [iNFO] [sTDERR] at java.lang.ClassLoader.loadClass(ClassLoader.java:306)

2014-02-01 20:29:49 [iNFO] [sTDERR] at java.lang.ClassLoader.loadClass(ClassLoader.java:247)

2014-02-01 20:29:51 [iNFO] [sTDERR] ... 3 more

2014-02-01 20:29:51 [iNFO] [sTDERR] Caused by: java.lang.OutOfMemoryError: Java heap space

 

 

 

The error message ends after that. I'm just trying to do a normal GameRegistery.registerBlock(), I'm using a Mac OSX 1.6.8, Eclipse SDK with Java 6 for the decompiler, and Forge 9.11.1.965. Commenting out the register method ends up in Minecraft launching just fine. If you need me to post the code, I will do so.

 

I actually did a coding timelapse a few hours before I had this issue arise. I will post it so you can see that I wasn't having this problem earlier: http://www.youtube.com/watch?v=35FQ9a_QADA

if (user.hasKnowledgeOfJava) {

    if (user.question.hasCode) {

        return interpetHelpfulResponse(user.getQuestion());

    } else {

        return "Could you post your code please?";

    }

} else {

    return "Learn some freaking Java!";

}

Link to comment
Share on other sites

[me=Draco18s]sees no code.  Shrugs and leaves.[/me]

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

Okay then. Here's the code registering the blocks, which is being called in the mod class.

 

 

 

public void initBlocks() {

GameRegistry.registerBlock(BlockCompoundOre.oreIronCoal, "iron_coal_ore");

GameRegistry.registerBlock(BlockCompoundOre.oreIronLapis, "iron_lapis_ore");

GameRegistry.registerBlock(BlockCompoundOre.oreLapisCoal, "lapis_coal_ore");

GameRegistry.registerBlock(BlockCompoundOre.oreLapisIron, "lapis_iron_ore");

GameRegistry.registerBlock(BlockCompoundOre.oreGoldCoal, "gold_coal_ore");

GameRegistry.registerBlock(BlockCompoundOre.oreGoldIron, "gold_iron_ore");

GameRegistry.registerBlock(BlockCompoundOre.oreGoldLapis, "gold_lapis_ore");

GameRegistry.registerBlock(BlockCompoundOre.oreGoldRedstone, "gold_redstone_ore");

GameRegistry.registerBlock(BlockCompoundOre.oreGoldDiamond, "gold_diamond_ore");

GameRegistry.registerBlock(BlockCompoundOre.oreGoldEmerald, "gold_emerald_ore");

}

 

 

 

The code inside BlockCompoundOre.

 

 

 

public class BlockCompoundOre extends Block {

 

protected static Random rand = new Random();

 

public BlockCompoundOre(int id) {

super(id, Material.rock);

setCreativeTab(CompoundOres.tabCompoundOres);

}

 

@Override

@SideOnly(Side.CLIENT)

public Icon getIcon(int par1, int par2) {

return this.blockIcon;

}

 

public static final BlockCompoundOre oreIronCoal = (BlockCompoundOre) new BlockIronCoalOre(ModIds.IRON_COAL);

public static final BlockCompoundOre oreIronLapis = (BlockCompoundOre) new BlockIronLapisOre(ModIds.IRON_LAPIS);

public static final BlockCompoundOre oreLapisCoal = (BlockCompoundOre) new BlockLapisCoalOre(ModIds.LAPIS_COAL);

public static final BlockCompoundOre oreLapisIron = (BlockCompoundOre) new BlockLapisIronOre(ModIds.LAPIS_IRON);

public static final BlockCompoundOre oreGoldCoal = (BlockCompoundOre) new BlockGoldCoalOre(ModIds.GOLD_COAL);

public static final BlockCompoundOre oreGoldIron = (BlockCompoundOre) new BlockGoldIronOre(ModIds.GOLD_IRON);

public static final BlockCompoundOre oreGoldLapis = (BlockCompoundOre) new BlockGoldLapisOre(ModIds.GOLD_LAPIS);

public static final BlockCompoundOre oreGoldRedstone = (BlockCompoundOre) new BlockGoldRedstoneOre(ModIds.GOLD_REDSTONE);

public static final BlockCompoundOre oreGoldDiamond = (BlockCompoundOre) new BlockGoldDiamondOre(ModIds.GOLD_DIAMOND);

public static final BlockCompoundOre oreGoldEmerald = (BlockCompoundOre) new BlockGoldEmeraldOre(ModIds.GOLD_EMERALD);

}

 

 

 

Code from BlockIronCoalOre

 

 

 

public class BlockIronCoalOre extends BlockCompoundOre {

 

protected Random rand = new Random();

 

public BlockIronCoalOre(int id) {

super(id);

setHardness(3.0f);

setResistance(5.0f);

}

 

@Override

@SideOnly(Side.CLIENT)

public void registerIcons(IconRegister register) {

this.blockIcon = register.registerIcon(ModStrings.RESOURCES_LOCATION + "iron_coal_ore");

}

 

@Override

public ArrayList<ItemStack> getBlockDropped(World world, int x, int y, int z, int metadata, int fortune) {

ArrayList<ItemStack> ret = new ArrayList<ItemStack>();

ret.add(new ItemStack(Block.oreIron));

ret.add(new ItemStack(Item.coal, (rand.nextInt(2) * fortune) + 1));

return ret;

}

}

 

 

if (user.hasKnowledgeOfJava) {

    if (user.question.hasCode) {

        return interpetHelpfulResponse(user.getQuestion());

    } else {

        return "Could you post your code please?";

    }

} else {

    return "Learn some freaking Java!";

}

Link to comment
Share on other sites

Ok so I see multiple problems here first don't extend blockcompoundores in your block file just instead extend block and in your block compound ore don't extend anything. As your not trying to make blockcompoundore a block I assume just a subsection for all your ores. Then you don't need all the blocks you register in the blockcompoundores to be public static blockcompoundores instead do public static block and it should work.

Link to comment
Share on other sites

I already stated that I was doing the old method earlier, and didn't have any problems. Now when I try and do the exact same thing that I was doing hours ago, I get that error. Look at the coding timelapse, you'll see.

if (user.hasKnowledgeOfJava) {

    if (user.question.hasCode) {

        return interpetHelpfulResponse(user.getQuestion());

    } else {

        return "Could you post your code please?";

    }

} else {

    return "Learn some freaking Java!";

}

Link to comment
Share on other sites

I did call the code. It just randomly stopped working. I'll explain a bit more: I was registering blocks, same as always, it was working perfectly fine. I added two more blocks, I then started to get the error. I then commented out the lines of code where I registered the two new blocks. Same thing happens. It might be my system. I'll test later.

if (user.hasKnowledgeOfJava) {

    if (user.question.hasCode) {

        return interpetHelpfulResponse(user.getQuestion());

    } else {

        return "Could you post your code please?";

    }

} else {

    return "Learn some freaking Java!";

}

Link to comment
Share on other sites

Are the block IDs the same for the blocks? Are the IDs even get from the config file?

 

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Link to comment
Share on other sites

I'm facedesking myself right now. I didn't have a proper ID for the Gold-Emerald ore. Now everything works. Everyone makes mistakes, I guess.

if (user.hasKnowledgeOfJava) {

    if (user.question.hasCode) {

        return interpetHelpfulResponse(user.getQuestion());

    } else {

        return "Could you post your code please?";

    }

} else {

    return "Learn some freaking Java!";

}

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.

Announcements



×
×
  • Create New...

Important Information

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