Jump to content

[1.9][SOLVED] NoSuchMethodException when trying to render and spawn customentity


Recommended Posts

Posted

[EDIT]

Swingdude helped me figure out why it wasn't rendering, and coolAlias helped me figure out why it wouldn't even spawn. Thanks all.

 

[OP]

Hello.

 

Whenever I try to place a spawn egg for an entity I created, a pig is spawned instead and the console shows a NoSuchMethodException from the entity render class RenderGolemObsidian. I basically copied and pasted the render and model classes from the vanilla Iron Golem. How do I fix this error and get my entity to spawn?

 

Log:

[20:56:33] [server thread/INFO]: [net.minecraft.entity.EntityList:createEntityByName:151]: java.lang.NoSuchMethodException: com.estebanzapata.obsidiantools.client.renderer.entity.RenderGolemObsidian.<init>(net.minecraft.world.World)
[20:56:33] [server thread/INFO]: [net.minecraft.entity.EntityList:createEntityByName:151]: 	at java.lang.Class.getConstructor0(Class.java:3082)
[20:56:33] [server thread/INFO]: [net.minecraft.entity.EntityList:createEntityByName:151]: 	at java.lang.Class.getConstructor(Class.java:1825)
[20:56:33] [server thread/INFO]: [net.minecraft.entity.EntityList:createEntityByName:151]: 	at net.minecraft.entity.EntityList.createEntityByName(EntityList.java:146)
[20:56:33] [server thread/INFO]: [net.minecraft.entity.EntityList:createEntityByName:151]: 	at net.minecraft.entity.EntityList.func_188429_b(EntityList.java:232)
[20:56:33] [server thread/INFO]: [net.minecraft.entity.EntityList:createEntityByName:151]: 	at net.minecraft.item.ItemMonsterPlacer.spawnCreature(ItemMonsterPlacer.java:218)
[20:56:33] [server thread/INFO]: [net.minecraft.entity.EntityList:createEntityByName:151]: 	at net.minecraft.item.ItemMonsterPlacer.onItemUse(ItemMonsterPlacer.java:99)
[20:56:33] [server thread/INFO]: [net.minecraft.entity.EntityList:createEntityByName:151]: 	at net.minecraftforge.common.ForgeHooks.onPlaceItemIntoWorld(ForgeHooks.java:740)
[20:56:33] [server thread/INFO]: [net.minecraft.entity.EntityList:createEntityByName:151]: 	at net.minecraft.item.ItemStack.onItemUse(ItemStack.java:155)
[20:56:33] [server thread/INFO]: [net.minecraft.entity.EntityList:createEntityByName:151]: 	at net.minecraft.server.management.PlayerInteractionManager.processRightClickBlock(PlayerInteractionManager.java:484)
[20:56:33] [server thread/INFO]: [net.minecraft.entity.EntityList:createEntityByName:151]: 	at net.minecraft.network.NetHandlerPlayServer.processRightClickBlock(NetHandlerPlayServer.java:706)
[20:56:33] [server thread/INFO]: [net.minecraft.entity.EntityList:createEntityByName:151]: 	at net.minecraft.network.play.client.CPacketPlayerTryUseItem.processPacket(CPacketPlayerTryUseItem.java:68)
[20:56:33] [server thread/INFO]: [net.minecraft.entity.EntityList:createEntityByName:151]: 	at net.minecraft.network.play.client.CPacketPlayerTryUseItem.processPacket(CPacketPlayerTryUseItem.java:13)
[20:56:33] [server thread/INFO]: [net.minecraft.entity.EntityList:createEntityByName:151]: 	at net.minecraft.network.PacketThreadUtil$1.run(PacketThreadUtil.java:15)
[20:56:33] [server thread/INFO]: [net.minecraft.entity.EntityList:createEntityByName:151]: 	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
[20:56:33] [server thread/INFO]: [net.minecraft.entity.EntityList:createEntityByName:151]: 	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[20:56:33] [server thread/INFO]: [net.minecraft.entity.EntityList:createEntityByName:151]: 	at net.minecraft.util.Util.runTask(Util.java:23)
[20:56:33] [server thread/INFO]: [net.minecraft.entity.EntityList:createEntityByName:151]: 	at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:738)
[20:56:33] [server thread/INFO]: [net.minecraft.entity.EntityList:createEntityByName:151]: 	at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:683)
[20:56:33] [server thread/INFO]: [net.minecraft.entity.EntityList:createEntityByName:151]: 	at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:155)
[20:56:33] [server thread/INFO]: [net.minecraft.entity.EntityList:createEntityByName:151]: 	at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:532)
[20:56:33] [server thread/INFO]: [net.minecraft.entity.EntityList:createEntityByName:151]: 	at java.lang.Thread.run(Thread.java:745)

 

RenderGolemObsidian (https://github.com/EstebanZapata/ObsidianTools/blob/mob/src/main/java/com/estebanzapata/obsidiantools/client/renderer/entity/RenderGolemObsidian.java)

 

public class RenderGolemObsidian extends RenderLiving<EntityGolemObsidian> {

    private static final ResourceLocation golemObsidianTextures = new ResourceLocation(Reference.RESOURCE_PREFIX + "textures/entity/golemObsidian.png");

    public RenderGolemObsidian(RenderManager rendermanagerIn) {
        super(rendermanagerIn, new ModelGolemObsidian(), 0.5F);
    }

    @Override
    protected ResourceLocation getEntityTexture(EntityGolemObsidian entity) {
        return golemObsidianTextures;
    }

    protected void rotateCorpse(EntityGolemObsidian bat, float p_77043_2_, float p_77043_3_, float partialTicks)
    {
        super.rotateCorpse(bat, p_77043_2_, p_77043_3_, partialTicks);

        if ((double)bat.limbSwingAmount >= 0.01D)
        {
            float f = 13.0F;
            float f1 = bat.limbSwing - bat.limbSwingAmount * (1.0F - partialTicks) + 6.0F;
            float f2 = (Math.abs(f1 % f - f * 0.5F) - f * 0.25F) / (f * 0.25F);
            GlStateManager.rotate(6.5F * f2, 0.0F, 0.0F, 1.0F);
        }
    }
}

 

ModelGolemObsidian is large and I don't know what the relevant piece is. Can be found here: https://github.com/EstebanZapata/ObsidianTools/blob/mob/src/main/java/com/estebanzapata/obsidiantools/client/model/ModelGolemObsidian.java

 

EntityObsidianGolem (https://github.com/EstebanZapata/ObsidianTools/blob/mob/src/main/java/com/estebanzapata/obsidiantools/entity/EntityGolemObsidian.java):

public class EntityGolemObsidian extends EntityMob {
    public EntityGolemObsidian(World worldIn) {
        super(worldIn);
    }

    @Override
    protected void applyEntityAttributes()
    {
        super.applyEntityAttributes();
        this.getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(100.0D);
        this.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).setBaseValue(0.25D);
        this.getEntityAttribute(SharedMonsterAttributes.KNOCKBACK_RESISTANCE).setBaseValue(1.0D);
        this.getEntityAttribute(SharedMonsterAttributes.FOLLOW_RANGE).setBaseValue(16.0D);

        getAttributeMap().registerAttribute(SharedMonsterAttributes.ATTACK_DAMAGE);
        getEntityAttribute(SharedMonsterAttributes.ATTACK_DAMAGE).setBaseValue(4.0D);

    }

    protected void initEntityAI() {

        this.tasks.addTask(0, new EntityAISwimming(this));
        this.tasks.addTask(1, new EntityAIAttackMelee(this, 1.0D, true));
        this.tasks.addTask(2, new EntityAIWander(this, 0.8D));
        this.tasks.addTask(3, new EntityAILookIdle(this));

        this.targetTasks.addTask(0, new EntityAINearestAttackableTarget(this, EntityPlayer.class, true));

    }

    public boolean isAIEnabled() {
        return true;
    }
}

 

ModEntities is called from CommonProxy.init()

(https://github.com/EstebanZapata/ObsidianTools/blob/mob/src/main/java/com/estebanzapata/obsidiantools/init/ModEntities.java)

public class ModEntities {

    private static int id = 0;

    public static void init() {
        registerModEntityWithEgg(RenderGolemObsidian.class, "golemObsidian", 0x3F5505, 0x4E6414);
    }

    public static void registerModEntityWithEgg(Class entityClass, String entityName, int eggColor, int eggSpotsColor) {
        EntityRegistry.registerModEntity(entityClass, entityName, id++, ObsidianTools.instance, 80, 3, false);
        EntityRegistry.registerEgg(entityClass, eggColor, eggSpotsColor);
    }
}

 

CommonProxy (https://github.com/EstebanZapata/ObsidianTools/blob/mob/src/main/java/com/estebanzapata/obsidiantools/proxy/CommonProxy.java)

public class CommonProxy implements IProxy {
    public void preInit(FMLPreInitializationEvent event) {
        ModItems.init();
        ModBlocks.init();
    }

    public void init(FMLInitializationEvent event) {
        MinecraftForge.EVENT_BUS.register(new ConfigurationHandler());
        ModRecipes.init();
        ModEntities.init();

    }

    public void postInit(FMLPostInitializationEvent event) {
        MinecraftForge.EVENT_BUS.register(new ObsidianArmorHandler());

    }
}

 

 

ClientProxy renders it (https://github.com/EstebanZapata/ObsidianTools/blob/mob/src/main/java/com/estebanzapata/obsidiantools/proxy/ClientProxy.java)

 

public class ClientProxy extends CommonProxy {
    public void preInit(FMLPreInitializationEvent event) {
        super.preInit(event);

        RenderingRegistry.registerEntityRenderingHandler(EntityGolemObsidian.class, new IRenderFactory<EntityGolemObsidian>() {
            @Override
            public Render<? super EntityGolemObsidian> createRenderFor(RenderManager manager) {
                return new RenderGolemObsidian(manager);
            }
        });
    }

 

Posted

Here is some relevant code from EntityList:

Class <? extends Entity > oclass = (Class)stringToClassMapping.get(entityName);

            if (oclass != null)
            {
                entity = (Entity)oclass.getConstructor(new Class[] {World.class}).newInstance(new Object[] {worldIn});
            }

It's looking for a constructor in your RenderObsidianGolem class that uses a world. It seems to be looking there instead of your entity class. It's looking there because you tell it to look there when you register the mob (code from ModEntities.init()):

public static void init() {
        registerModEntityWithEgg(RenderGolemObsidian.class, "golemObsidian", 0x3F5505, 0x4E6414);
    }

registerModEntityWithEgg(RenderGolemObsidian.class, "golemObsidian", 0x3F5505, 0x4E6414);

RenderGolemObsidian.class

So it is trying to initialize your render class as an entity.

Posted

Here is some relevant code from EntityList:

Class <? extends Entity > oclass = (Class)stringToClassMapping.get(entityName);

            if (oclass != null)
            {
                entity = (Entity)oclass.getConstructor(new Class[] {World.class}).newInstance(new Object[] {worldIn});
            }

It's looking for a constructor in your RenderObsidianGolem class that uses a world. It seems to be looking there instead of your entity class. It's looking there because you tell it to look there when you register the mob (code from ModEntities.init()):

public static void init() {
        registerModEntityWithEgg(RenderGolemObsidian.class, "golemObsidian", 0x3F5505, 0x4E6414);
    }

registerModEntityWithEgg(RenderGolemObsidian.class, "golemObsidian", 0x3F5505, 0x4E6414);

RenderGolemObsidian.class

So it is trying to initialize your render class as an entity.

 

Thanks, I changed it to

renderModEntityWithEgg(EntityGolemObsidian.class, "golemObsidian", ...);

 

When I tried to spawn the entity, I received another error stating that one of the attributes of the entity was already registered, referring to

getAttributeMap().registerAttribute(SharedMonsterAttributes.ATTACK_DAMAGE);

inside EntityGolemObsidian, so I removed that line.

 

I then got a ReportedException and a pig did not spawn this time. I relaunched the game to get a clean log and stack trace to post, but now the game crashes when I attempt to load the world.

 

Crash log:

---- Minecraft Crash Report ----
// I'm sorry, Dave.

Time: 4/2/16 10:00 PM
Description: Exception ticking world

io.netty.handler.codec.EncoderException: java.lang.NullPointerException
at io.netty.handler.codec.MessageToMessageEncoder.write(MessageToMessageEncoder.java:107)
at io.netty.handler.codec.MessageToMessageCodec.write(MessageToMessageCodec.java:116)
at io.netty.channel.AbstractChannelHandlerContext.invokeWrite(AbstractChannelHandlerContext.java:658)
at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:716)
at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:651)
at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:637)
at io.netty.channel.DefaultChannelPipeline.write(DefaultChannelPipeline.java:880)
at io.netty.channel.AbstractChannel.write(AbstractChannel.java:230)
at io.netty.channel.embedded.EmbeddedChannel.writeOutbound(EmbeddedChannel.java:195)
at net.minecraftforge.fml.common.network.FMLEmbeddedChannel.generatePacketFrom(FMLEmbeddedChannel.java:50)
at net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.getEntitySpawningPacket(FMLNetworkHandler.java:124)
at net.minecraft.entity.EntityTrackerEntry.createSpawnPacket(EntityTrackerEntry.java:500)
at net.minecraft.entity.EntityTrackerEntry.updatePlayerEntity(EntityTrackerEntry.java:389)
at net.minecraft.entity.EntityTracker.sendLeashedEntitiesInChunk(EntityTracker.java:389)
at net.minecraft.server.management.PlayerManager$PlayerInstance.func_187272_b(PlayerManager.java:635)
at net.minecraft.server.management.PlayerManager.updatePlayerInstances(PlayerManager.java:214)
at net.minecraft.world.WorldServer.tick(WorldServer.java:226)
at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:768)
at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:683)
at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:155)
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:532)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NullPointerException
at net.minecraftforge.fml.common.network.internal.FMLMessage$EntitySpawnMessage.toBytes(FMLMessage.java:143)
at net.minecraftforge.fml.common.network.internal.FMLRuntimeCodec.encodeInto(FMLRuntimeCodec.java:23)
at net.minecraftforge.fml.common.network.internal.FMLRuntimeCodec.encodeInto(FMLRuntimeCodec.java:13)
at net.minecraftforge.fml.common.network.FMLIndexedMessageToMessageCodec.encode(FMLIndexedMessageToMessageCodec.java:55)
at io.netty.handler.codec.MessageToMessageCodec$1.encode(MessageToMessageCodec.java:67)
at io.netty.handler.codec.MessageToMessageEncoder.write(MessageToMessageEncoder.java:89)
... 21 more


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

-- Head --
Stacktrace:
at io.netty.handler.codec.MessageToMessageEncoder.write(MessageToMessageEncoder.java:107)
at io.netty.handler.codec.MessageToMessageCodec.write(MessageToMessageCodec.java:116)
at io.netty.channel.AbstractChannelHandlerContext.invokeWrite(AbstractChannelHandlerContext.java:658)
at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:716)
at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:651)
at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:637)
at io.netty.channel.DefaultChannelPipeline.write(DefaultChannelPipeline.java:880)
at io.netty.channel.AbstractChannel.write(AbstractChannel.java:230)
at io.netty.channel.embedded.EmbeddedChannel.writeOutbound(EmbeddedChannel.java:195)
at net.minecraftforge.fml.common.network.FMLEmbeddedChannel.generatePacketFrom(FMLEmbeddedChannel.java:50)
at net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.getEntitySpawningPacket(FMLNetworkHandler.java:124)
at net.minecraft.entity.EntityTrackerEntry.createSpawnPacket(EntityTrackerEntry.java:500)
at net.minecraft.entity.EntityTrackerEntry.updatePlayerEntity(EntityTrackerEntry.java:389)
at net.minecraft.entity.EntityTracker.sendLeashedEntitiesInChunk(EntityTracker.java:389)
at net.minecraft.server.management.PlayerManager$PlayerInstance.func_187272_b(PlayerManager.java:635)
at net.minecraft.server.management.PlayerManager.updatePlayerInstances(PlayerManager.java:214)
at net.minecraft.world.WorldServer.tick(WorldServer.java:226)

-- Affected level --
Details:
Level name: Alef
All players: 1 total; [EntityPlayerMP['Player964'/337, l='Alef', x=-41.64, y=11.00, z=347.12]]
Chunk stats: ServerChunkCache: 830 Drop: 129
Level seed: 8940933286294654693
Level generator: ID 00 - default, ver 1. Features enabled: true
Level generator options: 
Level spawn location: World: (-180,64,256), Chunk: (at 12,4,0 in -12,16; contains blocks -192,0,256 to -177,255,271), Region: (-1,0; contains chunks -32,0 to -1,31, blocks -512,0,0 to -1,255,511)
Level time: 95742 game time, 92566 day time
Level dimension: 0
Level storage version: 0x04ABD - Anvil
Level weather: Rain time: 17647 (now: false), thunder time: 57400 (now: false)
Level game mode: Game mode: survival (ID 0). Hardcore: false. Cheats: true
Stacktrace:
at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:768)
at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:683)
at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:155)
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:532)
at java.lang.Thread.run(Thread.java:745)

-- System Details --
Details:
Minecraft Version: 1.9
Operating System: Windows 10 (amd64) version 10.0
Java Version: 1.8.0_73, Oracle Corporation
Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
Memory: 456938544 bytes (435 MB) / 931659776 bytes (888 MB) up to 1888485376 bytes (1801 MB)
JVM Flags: 0 total; 
IntCache: cache: 0, tcache: 0, allocated: 12, tallocated: 94
FML: MCP 9.23 Powered by Forge 12.16.0.1799 4 mods loaded, 4 mods active
States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored
UCHIJAAAA	mcp{9.19} [Minecraft Coder Pack] (minecraft.jar) 
UCHIJAAAA	FML{8.0.99.99} [Forge Mod Loader] (forgeSrc-1.9-12.16.0.1799-1.9.jar) 
UCHIJAAAA	Forge{12.16.0.1799} [Minecraft Forge] (forgeSrc-1.9-12.16.0.1799-1.9.jar) 
UCHIJAAAA	ObsidianTools{1.9-1.0} [Obsidian Tools] (ObsidianTools) 
Loaded coremods (and transformers): 
GL info: ~~ERROR~~ RuntimeException: No OpenGL context found in the current thread.
Profiler Position: N/A (disabled)
Player Count: 1 / 8; [EntityPlayerMP['Player964'/337, l='Alef', x=-41.64, y=11.00, z=347.12]]
Type: Integrated Server (map_client.txt)
Is Modded: Definitely; Client brand changed to 'fml,forge'

 

Console log:

http://pastebin.com/6jh3sWsk

Posted

Try removing all spawn eggs for your entity from your inventory, then getting new ones and trying to spawn it again. Does it still happen then?

 

As for the attribute, if the attribute is already registered, you can still change the value:

// from 1.8 - names may have changed
this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(5.0D);

Posted

If you can't load the world, then your earlier bug may have corrupted it. Delete it and start a new world to resume testing. You were using an expendable test world, right?

The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.

Posted

Try removing all spawn eggs for your entity from your inventory, then getting new ones and trying to spawn it again. Does it still happen then?

 

As for the attribute, if the attribute is already registered, you can still change the value:

// from 1.8 - names may have changed
this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(5.0D);

 

Yep, I did change the attack damage attribute value. The world I was testing in does not load. I loaded a different one, took a spawn egg from the creative inventory and spawned it. The game does not crash but nothing spawns. The console displays

[10:24:22] [server thread/ERROR]: "Silently" catching entity tracking error.
net.minecraft.util.ReportedException: Adding entity to track
at net.minecraft.entity.EntityTracker.addEntityToTracker(EntityTracker.java:249) [EntityTracker.class:?]
at net.minecraftforge.fml.common.registry.EntityRegistry.tryTrackingEntity(EntityRegistry.java:467) [EntityRegistry.class:?]
at net.minecraft.entity.EntityTracker.trackEntity(EntityTracker.java:78) [EntityTracker.class:?]
at net.minecraft.world.WorldManager.onEntityAdded(WorldManager.java:38) [WorldManager.class:?]
at net.minecraft.world.World.onEntityAdded(World.java:1221) [World.class:?]
at net.minecraft.world.WorldServer.onEntityAdded(WorldServer.java:1199) [WorldServer.class:?]
at net.minecraft.world.World.spawnEntityInWorld(World.java:1212) [World.class:?]
at net.minecraft.world.WorldServer.spawnEntityInWorld(WorldServer.java:1145) [WorldServer.class:?]
at net.minecraft.item.ItemMonsterPlacer.spawnCreature(ItemMonsterPlacer.java:227) [itemMonsterPlacer.class:?]
at net.minecraft.item.ItemMonsterPlacer.onItemUse(ItemMonsterPlacer.java:99) [itemMonsterPlacer.class:?]
at net.minecraftforge.common.ForgeHooks.onPlaceItemIntoWorld(ForgeHooks.java:740) [ForgeHooks.class:?]
at net.minecraft.item.ItemStack.onItemUse(ItemStack.java:155) [itemStack.class:?]
at net.minecraft.server.management.PlayerInteractionManager.processRightClickBlock(PlayerInteractionManager.java:477) [PlayerInteractionManager.class:?]
at net.minecraft.network.NetHandlerPlayServer.processRightClickBlock(NetHandlerPlayServer.java:706) [NetHandlerPlayServer.class:?]
at net.minecraft.network.play.client.CPacketPlayerTryUseItem.processPacket(CPacketPlayerTryUseItem.java:68) [CPacketPlayerTryUseItem.class:?]
at net.minecraft.network.play.client.CPacketPlayerTryUseItem.processPacket(CPacketPlayerTryUseItem.java:13) [CPacketPlayerTryUseItem.class:?]
at net.minecraft.network.PacketThreadUtil$1.run(PacketThreadUtil.java:15) [PacketThreadUtil$1.class:?]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_73]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_73]
at net.minecraft.util.Util.runTask(Util.java:23) [util.class:?]
at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:738) [MinecraftServer.class:?]
at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:683) [MinecraftServer.class:?]
at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:155) [integratedServer.class:?]
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:532) [MinecraftServer.class:?]
at java.lang.Thread.run(Thread.java:745) [?:1.8.0_73]
Caused by: io.netty.handler.codec.EncoderException: java.lang.NullPointerException
at io.netty.handler.codec.MessageToMessageEncoder.write(MessageToMessageEncoder.java:107) ~[MessageToMessageEncoder.class:4.0.23.Final]
at io.netty.handler.codec.MessageToMessageCodec.write(MessageToMessageCodec.java:116) ~[MessageToMessageCodec.class:4.0.23.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeWrite(AbstractChannelHandlerContext.java:658) ~[AbstractChannelHandlerContext.class:4.0.23.Final]
at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:716) ~[AbstractChannelHandlerContext.class:4.0.23.Final]
at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:651) ~[AbstractChannelHandlerContext.class:4.0.23.Final]
at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:637) ~[AbstractChannelHandlerContext.class:4.0.23.Final]
at io.netty.channel.DefaultChannelPipeline.write(DefaultChannelPipeline.java:880) ~[DefaultChannelPipeline.class:4.0.23.Final]
at io.netty.channel.AbstractChannel.write(AbstractChannel.java:230) ~[AbstractChannel.class:4.0.23.Final]
at io.netty.channel.embedded.EmbeddedChannel.writeOutbound(EmbeddedChannel.java:195) ~[EmbeddedChannel.class:4.0.23.Final]
at net.minecraftforge.fml.common.network.FMLEmbeddedChannel.generatePacketFrom(FMLEmbeddedChannel.java:50) ~[FMLEmbeddedChannel.class:?]
at net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.getEntitySpawningPacket(FMLNetworkHandler.java:124) ~[FMLNetworkHandler.class:?]
at net.minecraft.entity.EntityTrackerEntry.createSpawnPacket(EntityTrackerEntry.java:500) ~[EntityTrackerEntry.class:?]
at net.minecraft.entity.EntityTrackerEntry.updatePlayerEntity(EntityTrackerEntry.java:389) ~[EntityTrackerEntry.class:?]
at net.minecraft.entity.EntityTrackerEntry.updatePlayerEntities(EntityTrackerEntry.java:489) ~[EntityTrackerEntry.class:?]
at net.minecraft.entity.EntityTracker.addEntityToTracker(EntityTracker.java:223) ~[EntityTracker.class:?]
... 24 more
Caused by: java.lang.NullPointerException
at net.minecraftforge.fml.common.network.internal.FMLMessage$EntitySpawnMessage.toBytes(FMLMessage.java:143) ~[FMLMessage$EntitySpawnMessage.class:?]
at net.minecraftforge.fml.common.network.internal.FMLRuntimeCodec.encodeInto(FMLRuntimeCodec.java:23) ~[FMLRuntimeCodec.class:?]
at net.minecraftforge.fml.common.network.internal.FMLRuntimeCodec.encodeInto(FMLRuntimeCodec.java:13) ~[FMLRuntimeCodec.class:?]
at net.minecraftforge.fml.common.network.FMLIndexedMessageToMessageCodec.encode(FMLIndexedMessageToMessageCodec.java:55) ~[FMLIndexedMessageToMessageCodec.class:?]
at io.netty.handler.codec.MessageToMessageCodec$1.encode(MessageToMessageCodec.java:67) ~[MessageToMessageCodec$1.class:4.0.23.Final]
at io.netty.handler.codec.MessageToMessageEncoder.write(MessageToMessageEncoder.java:89) ~[MessageToMessageEncoder.class:4.0.23.Final]
at io.netty.handler.codec.MessageToMessageCodec.write(MessageToMessageCodec.java:116) ~[MessageToMessageCodec.class:4.0.23.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeWrite(AbstractChannelHandlerContext.java:658) ~[AbstractChannelHandlerContext.class:4.0.23.Final]
at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:716) ~[AbstractChannelHandlerContext.class:4.0.23.Final]
at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:651) ~[AbstractChannelHandlerContext.class:4.0.23.Final]
at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:637) ~[AbstractChannelHandlerContext.class:4.0.23.Final]
at io.netty.channel.DefaultChannelPipeline.write(DefaultChannelPipeline.java:880) ~[DefaultChannelPipeline.class:4.0.23.Final]
at io.netty.channel.AbstractChannel.write(AbstractChannel.java:230) ~[AbstractChannel.class:4.0.23.Final]
at io.netty.channel.embedded.EmbeddedChannel.writeOutbound(EmbeddedChannel.java:195) ~[EmbeddedChannel.class:4.0.23.Final]
at net.minecraftforge.fml.common.network.FMLEmbeddedChannel.generatePacketFrom(FMLEmbeddedChannel.java:50) ~[FMLEmbeddedChannel.class:?]
at net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.getEntitySpawningPacket(FMLNetworkHandler.java:124) ~[FMLNetworkHandler.class:?]
at net.minecraft.entity.EntityTrackerEntry.createSpawnPacket(EntityTrackerEntry.java:500) ~[EntityTrackerEntry.class:?]
at net.minecraft.entity.EntityTrackerEntry.updatePlayerEntity(EntityTrackerEntry.java:389) ~[EntityTrackerEntry.class:?]
at net.minecraft.entity.EntityTrackerEntry.updatePlayerEntities(EntityTrackerEntry.java:489) ~[EntityTrackerEntry.class:?]
at net.minecraft.entity.EntityTracker.addEntityToTracker(EntityTracker.java:223) ~[EntityTracker.class:?]
... 24 more

 

I quit to the main menu and loaded the world again and it let me in. I quit the game entirely and loaded the world again, and it still works. I tried spawning the entity but it still gives me the same error as above. I tried loading the previous world but the game still crashes upon load. The difference between the two is that in the world that crashes, I tried spawning the entity inside a cramped cavern, while in the other one, it is a flat world and I am on the surface. I have no idea how to fix this error.

 

 

If you can't load the world, then your earlier bug may have corrupted it. Delete it and start a new world to resume testing. You were using an expendable test world, right?

 

Of course.

Posted

Hm, your entity registration code looks correct, you're not doing anything strange in your Entity class, and you're testing in a new world so the entity name hasn't changed... those are the usual suspects when it comes to tracking entry errors, so it could be that spawn eggs in 1.9 are bugged. If my coding computer wasn't toast, I'd try it out myself to confirm it; if it is indeed a bug, you can open an issue on Forge's issue tracker (GitHub).

Posted

Hm, your entity registration code looks correct, you're not doing anything strange in your Entity class, and you're testing in a new world so the entity name hasn't changed... those are the usual suspects when it comes to tracking entry errors, so it could be that spawn eggs in 1.9 are bugged. If my coding computer wasn't toast, I'd try it out myself to confirm it; if it is indeed a bug, you can open an issue on Forge's issue tracker (GitHub).

 

I looked at the Forge issues on Github and people had already posted about my issue. Lex said that he thought it had been fixed. So I realized it might help if I updated to the latest version of Forge. Lo and behold it works. Derp. Thank you for your help, as well as all other repliers.

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.