Jump to content

[solved]registering entities for mc-server


Torojima

Recommended Posts

my mod, dealing mainly with a new entity, is producing the following exception when a server is trying to produce a new world. Is there a special way to register entities so they can work for the server or does anybody know what else this exception is all about?

 

The first line of code I can examine regarding this error is the SpawnerAnimal class, where at line 293 it tries to get the constructor of the entity classes ... since my entities work fine in the SSP version, I believe there is something wrong with registering the entities for the server side ...

 

var21 = (EntityLiving)var8.entityClass.getConstructor(new Class[] {World.class}).newInstance(new Object[] {par0World});

 

 

 

java.lang.NoClassDefFoundError: apn

at java.lang.Class.getDeclaredConstructors0(Native Method)

at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)

at java.lang.Class.getConstructor0(Class.java:2699)

at java.lang.Class.getConstructor(Class.java:1657)

at vc.a(SpawnerAnimals.java:293)

at xn.a(SourceFile:454)

at gq.a(ChunkProviderServer.java:225)

at wl.a(Chunk.java:1193)

at gq.c(ChunkProviderServer.java:125)

at net.minecraft.server.MinecraftServer.d(MinecraftServer.java:282)

at net.minecraft.server.MinecraftServer.a(MinecraftServer.java:248)

at ft.b(DedicatedServer.java:153)

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

at ep.run(SourceFile:539)

Caused by: java.lang.ClassNotFoundException: apn

at cpw.mods.fml.relauncher.RelaunchClassLoader.findClass(RelaunchClassLoader.java:126)

at java.lang.ClassLoader.loadClass(ClassLoader.java:306)

at java.lang.ClassLoader.loadClass(ClassLoader.java:247)

... 14 more

Caused by: java.lang.NullPointerException

 

 

running minecraft on Mac OS X - Sierra --- creating code since 1986 ... --- मेरा दिल भारतवासी है!

width=289 height=100http://www.arno-saxena.de/pictures/chococraft/banner_signature.png[/img]

Link to comment
Share on other sites

ok, didn't see that one coming...

 

I do have a call of a GuiScreen (Class derived from GuiScreen that is) in my entity class. I thought putting it after a check for the client side would be sufficient, but of course the GuiScreen class has to be imported ... I have created a class designated for starting gui's and moved the Gui starting method and the respective import of the needed GuiScreen Class into it. So now my entity class is free of any GuiScreen imports :)

 

Thanks :)

 

Yes, the mod is no longer crashing the server and a world can be created.

running minecraft on Mac OS X - Sierra --- creating code since 1986 ... --- मेरा दिल भारतवासी है!

width=289 height=100http://www.arno-saxena.de/pictures/chococraft/banner_signature.png[/img]

Link to comment
Share on other sites

but I still can not mark this topic as solved.

 

The server is running, but no entities are spawning (spawn eggs do not work). Below is what I'm doing for spawning one of my entities. Do I miss anything I should do to wile spawning?

 

here the code, please tell me if other parts are needed:

 

 

private void registerChocoboEntityClass(Class <? extends Entity> entityClass, String entityName,
         int eggColor, int eggDotsColor, String visibleName)
{
   int entityID = EntityRegistry.findGlobalUniqueEntityId();
   LanguageRegistry.instance().addStringLocalization("entity." + entityName  + ".name", "en_US", visibleName);
   EntityRegistry.registerGlobalEntityID(entityClass, entityName, entityID, eggColor, eggDotsColor);
   EntityRegistry.registerModEntity(entityClass, entityName, entityID, instance, 128, 1, true);
}

 

and for the spawn registry:

 

private void addChocoboSpawns()
{
   EntityRegistry.addSpawn(EntityChocoboYellow.class, Constants.DEFAULT_CHOCOBO_SPAWN_RATE,
            Constants.DEFAULT_CHOCOBO_SPAWN_MIN, Constants.DEFAULT_CHOCOBO_SPAWN_MAX,
            EnumCreatureType.creature, chocoboYellowSpawnBiomes);
}

 

public static BiomeGenBase[] chocoboYellowSpawnBiomes = {
   BiomeGenBase.beach, 
   BiomeGenBase.desert,
   BiomeGenBase.desertHills, 
   BiomeGenBase.extremeHills,
   BiomeGenBase.extremeHillsEdge,
   BiomeGenBase.forest,
   BiomeGenBase.forestHills,
   BiomeGenBase.jungle,
   BiomeGenBase.jungleHills,
   BiomeGenBase.mushroomIslandShore,
   BiomeGenBase.plains,
   BiomeGenBase.river,
   BiomeGenBase.swampland,
   BiomeGenBase.taiga,
   BiomeGenBase.taigaHills
};

 

 

 

both methods called in the main mod class in the @Init method (spawning after the registering obviously :D), not limited to a special side.

 

I've read about an EntityTracker, is this a direction I would have to pursue and seek more information?

 

btw, the Entities are working well in the SSP version

 

Edit:

had been connected to my networking of communication Packet. I had created new Packet classes derived from Packet250CustomPayload, which minecraft has not recognised and thus prevented the communication and thus the spawning... Now I use the Packet250CustomPayload Packet itself for communication and all works well...

running minecraft on Mac OS X - Sierra --- creating code since 1986 ... --- मेरा दिल भारतवासी है!

width=289 height=100http://www.arno-saxena.de/pictures/chococraft/banner_signature.png[/img]

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.