Jump to content

Recommended Posts

Posted

Whenever I run my mod it crashes and points to the line of code:

 

 

EntityRegistry.addSpawn(EntityAncientzombie.class, 5, 1, 3, EnumCreatureType.monster, BiomeGenBase.biomeList);

 

 

I have added a mob to the game and this is it's spawn method

I don't know how to fix it :(

Posted

Crash Report

 

 

---- Minecraft Crash Report ----

// Oh - I know what I did wrong!

 

Time: 3/16/14 2:51 PM

Description: Initializing game

 

java.lang.NullPointerException

at cpw.mods.fml.common.registry.EntityRegistry.addSpawn(EntityRegistry.java:260)

at fieldgeneral.uz.Uz.load(Uz.java:73)

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

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:545)

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

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74)

at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)

at com.google.common.eventbus.EventBus.dispatch(EventBus.java:313)

at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296)

at com.google.common.eventbus.EventBus.post(EventBus.java:267)

at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:201)

at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:181)

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

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74)

at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)

at com.google.common.eventbus.EventBus.dispatch(EventBus.java:313)

at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296)

at com.google.common.eventbus.EventBus.post(EventBus.java:267)

at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:112)

at cpw.mods.fml.common.Loader.initializeMods(Loader.java:696)

at cpw.mods.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:249)

at net.minecraft.client.Minecraft.startGame(Minecraft.java:509)

at net.minecraft.client.Minecraft.run(Minecraft.java:808)

at net.minecraft.client.main.Main.main(Main.java:93)

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

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

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

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

 

 

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

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

 

-- Head --

Stacktrace:

at cpw.mods.fml.common.registry.EntityRegistry.addSpawn(EntityRegistry.java:260)

at fieldgeneral.uz.Uz.load(Uz.java:73)

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

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:545)

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

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74)

at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)

at com.google.common.eventbus.EventBus.dispatch(EventBus.java:313)

at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296)

at com.google.common.eventbus.EventBus.post(EventBus.java:267)

at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:201)

at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:181)

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

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74)

at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)

at com.google.common.eventbus.EventBus.dispatch(EventBus.java:313)

at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296)

at com.google.common.eventbus.EventBus.post(EventBus.java:267)

at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:112)

at cpw.mods.fml.common.Loader.initializeMods(Loader.java:696)

at cpw.mods.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:249)

at net.minecraft.client.Minecraft.startGame(Minecraft.java:509)

 

-- Initialization --

Details:

Stacktrace:

at net.minecraft.client.Minecraft.run(Minecraft.java:808)

at net.minecraft.client.main.Main.main(Main.java:93)

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

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

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

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

 

-- System Details --

Details:

Minecraft Version: 1.6.4

Operating System: Windows Vista (x86) version 6.0

Java Version: 1.7.0_51, Oracle Corporation

Java VM Version: Java HotSpot Client VM (mixed mode), Oracle Corporation

Memory: 968483600 bytes (923 MB) / 1067057152 bytes (1017 MB) up to 1067057152 bytes (1017 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: 0, tcache: 0, allocated: 0, tallocated: 0

FML: MCP v8.11 FML v6.4.31.935 Minecraft Forge 9.11.1.935 4 mods loaded, 4 mods active

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

FML{6.4.31.935} [Forge Mod Loader] (bin) Unloaded->Constructed->Pre-initialized->Initialized

Forge{9.11.1.935} [Minecraft Forge] (bin) Unloaded->Constructed->Pre-initialized->Initialized

UzModID{0.1} [useful Zombies] (bin) Unloaded->Constructed->Pre-initialized->Errored

Launched Version: 1.6

LWJGL: 2.9.0

OpenGL: GeForce 6150SE nForce 430/integrated/SSE2/3DNOW! GL version 2.1.2, NVIDIA Corporation

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

Type: Client (map_client.txt)

Resource Pack: Default

Current Language: English (US)

Profiler Position: N/A (disabled)

Vec3 Pool Size: ~~ERROR~~ NullPointerException: null

 

 

Posted

Changing 

EntityRegistry.addSpawn(EntityAncientzombie.class, 5, 1, 3, EnumCreatureType.monster, BiomeGenBase.biomelist);

to

EntityRegistry.addSpawn(EntityAncientzombie.class, 5, 1, 3, EnumCreatureType.monster, BiomeGenBase.desert);

fixes the problem, but i want it to be able to spawn in all biomes, except the nether or end

 

 

Posted

Fixed it by using

                    EntityRegistry

                .addSpawn(EntityAncientzombie.class, 5, 1, 3, EnumCreatureType.monster, BiomeGenBase.BIOMENAME);

for each biome, tedious but works

Posted

You can also use this code to make sure you really catch every biome (even modded ones)

	ArrayList<BiomeGenBase> biomes = new ArrayList<BiomeGenBase>();
	for( BiomeGenBase biome : BiomeGenBase.biomeList ) {
		if( biome != null ) {
			biomes.add(biome);
		}
	}
	EntityRegistry.addSpawn(EntityAncientzombie.class, 5, 1, 3, EnumCreatureType.monster, biomes.toArray(BiomeGenBase.biomeList));

Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! |

mah twitter

This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.

Posted

Or, for the really fancy people:

 

BiomeGenBase allBiomes = Iterators.toArray(Iterators.filter(Iterators.forArray(BiomeGenBase.biomeslist), Predicates.notNull()), BiomeGenBase.class);

 

Guava & Functional Programming ftw!

 

oh, you can use Predicates with Guava? Good to know :D

Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! |

mah twitter

This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.

Posted

If you are on 1.7.2 then here is what I do:

BiomeGenBase[] allBiomes = Iterators.toArray(Iterators.filter(Iterators.forArray(BiomeGenBase.getBiomeGenArray()),
			Predicates.notNull()), BiomeGenBase.class);

Posted

public static BiomeGenBase[] biomes = new BiomeGenBase[]{BiomeGenBase.plains, BiomeGenBase.extremeHills, BiomeGenBase.beach, BiomeGenBase.desert,

BiomeGenBase.desertHills, BiomeGenBase.extremeHillsEdge, BiomeGenBase.forest, BiomeGenBase.forestHills, BiomeGenBase.icePlains, BiomeGenBase.iceMountains, BiomeGenBase.river,

BiomeGenBase.birchForest, BiomeGenBase.birchForestHills, BiomeGenBase.coldBeach, BiomeGenBase.coldTaiga, BiomeGenBase.coldTaigaHills, BiomeGenBase.deepOcean,

BiomeGenBase.extremeHillsPlus, BiomeGenBase.jungleEdge, BiomeGenBase.megaTaiga, BiomeGenBase.megaTaigaHills, BiomeGenBase.mesa, BiomeGenBase.mesaPlateau, BiomeGenBase.mesaPlateau_F, BiomeGenBase.roofedForest, BiomeGenBase.savanna, BiomeGenBase.savannaPlateau, BiomeGenBase.stoneBeach};

 

EntityRegistry.addSpawn(mob.class, group, min, max, type, biomes);

Former developer for DivineRPG, Pixelmon and now the maker of Essence of the Gods

Posted

public static BiomeGenBase[] biomes = new BiomeGenBase[]{BiomeGenBase.plains, BiomeGenBase.extremeHills, BiomeGenBase.beach, BiomeGenBase.desert,

BiomeGenBase.desertHills, BiomeGenBase.extremeHillsEdge, BiomeGenBase.forest, BiomeGenBase.forestHills, BiomeGenBase.icePlains, BiomeGenBase.iceMountains, BiomeGenBase.river,

BiomeGenBase.birchForest, BiomeGenBase.birchForestHills, BiomeGenBase.coldBeach, BiomeGenBase.coldTaiga, BiomeGenBase.coldTaigaHills, BiomeGenBase.deepOcean,

BiomeGenBase.extremeHillsPlus, BiomeGenBase.jungleEdge, BiomeGenBase.megaTaiga, BiomeGenBase.megaTaigaHills, BiomeGenBase.mesa, BiomeGenBase.mesaPlateau, BiomeGenBase.mesaPlateau_F, BiomeGenBase.roofedForest, BiomeGenBase.savanna, BiomeGenBase.savannaPlateau, BiomeGenBase.stoneBeach};

 

EntityRegistry.addSpawn(mob.class, group, min, max, type, biomes);

 

Why?

The solution was already provided previously, what's different in your code?

Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! |

mah twitter

This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.

  • 10 months later...
Posted

Let me dig it up, since it shows in search, so someone might want to use it.

 

I'm coding for 1.7.10 and BiomeGenBase.biomesList is not availble directly, there is a method .getBiomeGenArray() that returns it.

 

Also EntityRegistry.addSpawn() wants BiomeGenBase[] as param, not ArrayList<BiomeGenBase>

 

I did it like that :

ArrayList<BiomeGenBase> all_biomesList = new ArrayList<BiomeGenBase>();
	for( BiomeGenBase biome : BiomeGenBase.getBiomeGenArray() ) {
		if( biome != null ) {
			all_biomesList.add(biome);
		}
	}
	BiomeGenBase[] all_biomes_array = new BiomeGenBase[all_biomesList.size()]; // type casting from List to array and stuff
	this.all_biomes = all_biomesList.toArray(all_biomes_array);

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.