Posted December 14, 201311 yr I've been watching a tutorial on youtube on how to make a mob. The code I made seems to have no errors, but when I try to use the new spawn egg I get an error. Game does not close. 2013-12-14 14:43:19 [WARNING] [Minecraft-Server] Skipping Entity with id 301 2013-12-14 14:43:20 [iNFO] [sTDERR] java.lang.reflect.InvocationTargetException 2013-12-14 14:43:20 [iNFO] [sTDERR] at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) 2013-12-14 14:43:20 [iNFO] [sTDERR] at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) 2013-12-14 14:43:20 [iNFO] [sTDERR] at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) 2013-12-14 14:43:20 [iNFO] [sTDERR] at java.lang.reflect.Constructor.newInstance(Constructor.java:513) 2013-12-14 14:43:20 [iNFO] [sTDERR] at net.minecraft.entity.EntityList.createEntityByID(EntityList.java:205) 2013-12-14 14:43:20 [iNFO] [sTDERR] at net.minecraft.item.ItemMonsterPlacer.spawnCreature(ItemMonsterPlacer.java:175) 2013-12-14 14:43:20 [iNFO] [sTDERR] at net.minecraft.item.ItemMonsterPlacer.onItemUse(ItemMonsterPlacer.java:81) 2013-12-14 14:43:20 [iNFO] [sTDERR] at net.minecraft.item.ItemStack.tryPlaceItemIntoWorld(ItemStack.java:153) 2013-12-14 14:43:20 [iNFO] [sTDERR] at net.minecraft.item.ItemInWorldManager.activateBlockOrUseItem(ItemInWorldManager.java:434) 2013-12-14 14:43:20 [iNFO] [sTDERR] at net.minecraft.network.NetServerHandler.handlePlace(NetServerHandler.java:556) 2013-12-14 14:43:20 [iNFO] [sTDERR] at net.minecraft.network.packet.Packet15Place.processPacket(Packet15Place.java:79) 2013-12-14 14:43:20 [iNFO] [sTDERR] at net.minecraft.network.MemoryConnection.processReadPackets(MemoryConnection.java:89) 2013-12-14 14:43:20 [iNFO] [sTDERR] at net.minecraft.network.NetServerHandler.networkTick(NetServerHandler.java:141) 2013-12-14 14:43:20 [iNFO] [sTDERR] at net.minecraft.network.NetworkListenThread.networkTick(NetworkListenThread.java:54) 2013-12-14 14:43:20 [iNFO] [sTDERR] at net.minecraft.server.integrated.IntegratedServerListenThread.networkTick(IntegratedServerListenThread.java:109) 2013-12-14 14:43:20 [iNFO] [sTDERR] at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:691) 2013-12-14 14:43:20 [iNFO] [sTDERR] at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:587) 2013-12-14 14:43:20 [iNFO] [sTDERR] at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:129) 2013-12-14 14:43:20 [iNFO] [sTDERR] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:484) 2013-12-14 14:43:20 [iNFO] [sTDERR] at net.minecraft.server.ThreadMinecraftServer.run(ThreadMinecraftServer.java:16) 2013-12-14 14:43:20 [iNFO] [sTDERR] Caused by: java.lang.NullPointerException 2013-12-14 14:43:20 [iNFO] [sTDERR] at mods.danilafe.frozenworld.mob.MobNecromancer.applyEntityAttributes(MobNecromancer.java:19) 2013-12-14 14:43:20 [iNFO] [sTDERR] at net.minecraft.entity.EntityLivingBase.<init>(EntityLivingBase.java:193) 2013-12-14 14:43:20 [iNFO] [sTDERR] at net.minecraft.entity.EntityLiving.<init>(EntityLiving.java:85) 2013-12-14 14:43:20 [iNFO] [sTDERR] at net.minecraft.entity.EntityCreature.<init>(EntityCreature.java:40) 2013-12-14 14:43:20 [iNFO] [sTDERR] at net.minecraft.entity.monster.EntityMob.<init>(EntityMob.java:19) 2013-12-14 14:43:20 [iNFO] [sTDERR] at mods.danilafe.frozenworld.mob.MobNecromancer.<init>(MobNecromancer.java:12) 2013-12-14 14:43:20 [iNFO] [sTDERR] ... 20 more According to this, the game crashes because my main mob class (MobNecromancer) needs something passes down to it, a world. It is nowhere in the tutorial and nothing in his video crashes. What am I doing wrong? “Since when did you start modding?” “Last night"
December 14, 201311 yr Hi Show us your MobNecromancer? Something in your MobNecromancer.applyEntityAttributes is probably attempting to use an object that hasn't been initialised yet. -TGG
December 15, 201311 yr Author package mods.danilafe.frozenworld.mob; import mods.danilafe.frozenworld.FrozenWorld; import net.minecraft.entity.EnumCreatureAttribute; import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.monster.EntityMob; import net.minecraft.world.World; public class MobNecromancer extends EntityMob{ public MobNecromancer(World par1World) { super(par1World); this.experienceValue = 0; } protected boolean isAIEnabled(){ return true; } public void applyEntityAttributes(){ super.applyEntityAttributes(); this.getEntityAttribute(SharedMonsterAttributes.followRange).setAttribute(40.0D); this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setAttribute(0.70D); this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setAttribute(1.0D); this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setAttribute(40.0D); } protected void entityInit(){ this.getDataWatcher().addObject(12,Byte.valueOf((byte)0)); this.getDataWatcher().addObject(13,Byte.valueOf((byte)0)); this.getDataWatcher().addObject(14,Byte.valueOf((byte)0)); } protected void dropRareDrop(int par1){ switch(this.rand.nextInt(3)){ case 0: this.dropItem(FrozenWorld.WinterPlant.itemID, 1); } } public EnumCreatureAttribute getCreatureAttribute(){ return EnumCreatureAttribute.UNDEFINED; } public void onLivingUpdate(){ super.onLivingUpdate(); } } The thing is, in the stacktrace, when you click the java:12 ( the very LAST thing) it jumps me to " super(par1World);" Apparently all of the .setAttribute lines cause a crash EDIT WAIT I forgot to add the super. Noticed it myself. It still crashes; java.lang.reflect.InvocationTargetException 2013-12-14 16:39:32 [iNFO] [sTDERR] at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) 2013-12-14 16:39:32 [iNFO] [sTDERR] at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) 2013-12-14 16:39:32 [iNFO] [sTDERR] at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) 2013-12-14 16:39:32 [iNFO] [sTDERR] at java.lang.reflect.Constructor.newInstance(Constructor.java:513) 2013-12-14 16:39:32 [iNFO] [sTDERR] at net.minecraft.entity.EntityList.createEntityByID(EntityList.java:205) 2013-12-14 16:39:32 [iNFO] [sTDERR] at net.minecraft.item.ItemMonsterPlacer.spawnCreature(ItemMonsterPlacer.java:175) 2013-12-14 16:39:32 [iNFO] [sTDERR] at net.minecraft.item.ItemMonsterPlacer.onItemUse(ItemMonsterPlacer.java:81) 2013-12-14 16:39:32 [iNFO] [sTDERR] at net.minecraft.item.ItemStack.tryPlaceItemIntoWorld(ItemStack.java:153) 2013-12-14 16:39:32 [iNFO] [sTDERR] at net.minecraft.item.ItemInWorldManager.activateBlockOrUseItem(ItemInWorldManager.java:434) 2013-12-14 16:39:32 [iNFO] [sTDERR] at net.minecraft.network.NetServerHandler.handlePlace(NetServerHandler.java:556) 2013-12-14 16:39:32 [iNFO] [sTDERR] at net.minecraft.network.packet.Packet15Place.processPacket(Packet15Place.java:79) 2013-12-14 16:39:32 [iNFO] [sTDERR] at net.minecraft.network.MemoryConnection.processReadPackets(MemoryConnection.java:89) 2013-12-14 16:39:32 [iNFO] [sTDERR] at net.minecraft.network.NetServerHandler.networkTick(NetServerHandler.java:141) 2013-12-14 16:39:32 [iNFO] [sTDERR] at net.minecraft.network.NetworkListenThread.networkTick(NetworkListenThread.java:54) 2013-12-14 16:39:32 [iNFO] [sTDERR] at net.minecraft.server.integrated.IntegratedServerListenThread.networkTick(IntegratedServerListenThread.java:109) 2013-12-14 16:39:32 [iNFO] [sTDERR] at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:691) 2013-12-14 16:39:32 [iNFO] [sTDERR] at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:587) 2013-12-14 16:39:32 [iNFO] [sTDERR] at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:129) 2013-12-14 16:39:32 [iNFO] [sTDERR] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:484) 2013-12-14 16:39:32 [iNFO] [sTDERR] at net.minecraft.server.ThreadMinecraftServer.run(ThreadMinecraftServer.java:16) 2013-12-14 16:39:32 [iNFO] [sTDERR] Caused by: java.lang.NullPointerException 2013-12-14 16:39:32 [iNFO] [sTDERR] at net.minecraft.entity.DataWatcher.updateObject(DataWatcher.java:148) 2013-12-14 16:39:32 [iNFO] [sTDERR] at net.minecraft.entity.EntityLivingBase.setHealth(EntityLivingBase.java:829) 2013-12-14 16:39:32 [iNFO] [sTDERR] at net.minecraft.entity.EntityLivingBase.<init>(EntityLivingBase.java:194) 2013-12-14 16:39:32 [iNFO] [sTDERR] at net.minecraft.entity.EntityLiving.<init>(EntityLiving.java:85) 2013-12-14 16:39:32 [iNFO] [sTDERR] at net.minecraft.entity.EntityCreature.<init>(EntityCreature.java:40) 2013-12-14 16:39:32 [iNFO] [sTDERR] at net.minecraft.entity.monster.EntityMob.<init>(EntityMob.java:19) 2013-12-14 16:39:32 [iNFO] [sTDERR] at mods.danilafe.frozenworld.mob.MobNecromancer.<init>(MobNecromancer.java:12) 2013-12-14 16:39:32 [iNFO] [sTDERR] ... 20 more “Since when did you start modding?” “Last night"
December 15, 201311 yr Hmmmm beats me what's going on. If it were me, I'd place a breakpoint in your constructor public MobNecromancer(World par1World) { super(par1World); this.experienceValue = 0; } and then trace into super, EntityLivingBase.setHealth etc until I could figure out which vble is null (and hopefully - why) If there's an obvious error, I'm not seeing it. -TGG
December 16, 201311 yr Author Yeah, i went throught looking for missing “super”s and found that out. Thanks! “Since when did you start modding?” “Last night"
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.