Jump to content

1.11 - Custom Mob - NullPointerException: Ticking entity


Eria8

Recommended Posts

I don't understand what's causing this.

The crash log only references vanilla code, so I can't figure out what on earth is null.

And it happens very randomly. Both times it happened was a second or two after killing my custom mob.

However, I've tried killing my mob the same exact way (just whacking it with a diamond sword in a superflat world) about a dozen other times without causing a crash or error, and it hasn't happened with any vanilla entities.

I don't know how to find the problem when it just happens at random.

 

This is the crash:

Spoiler

[18:21:04] [Server thread/ERROR]: Encountered an unexpected exception
net.minecraft.util.ReportedException: Ticking entity
    at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:800) ~[MinecraftServer.class:?]
    at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:698) ~[MinecraftServer.class:?]
    at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:156) ~[IntegratedServer.class:?]
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:547) [MinecraftServer.class:?]
    at java.lang.Thread.run(Unknown Source) [?:1.8.0_111]
Caused by: java.lang.NullPointerException
    at net.minecraft.pathfinding.PathNavigate.getPathSearchRange(PathNavigate.java:65) ~[PathNavigate.class:?]
    at net.minecraft.pathfinding.PathNavigate.getPathToPos(PathNavigate.java:121) ~[PathNavigate.class:?]
    at net.minecraft.pathfinding.PathNavigateGround.getPathToPos(PathNavigateGround.java:83) ~[PathNavigateGround.class:?]
    at net.minecraft.pathfinding.PathNavigate.getPathToXYZ(PathNavigate.java:101) ~[PathNavigate.class:?]
    at net.minecraft.pathfinding.PathNavigate.tryMoveToXYZ(PathNavigate.java:170) ~[PathNavigate.class:?]
    at net.minecraft.entity.ai.EntityAIWander.startExecuting(EntityAIWander.java:83) ~[EntityAIWander.class:?]
    at net.minecraft.entity.ai.EntityAITasks.onUpdateTasks(EntityAITasks.java:82) ~[EntityAITasks.class:?]
    at net.minecraft.entity.EntityLiving.updateEntityActionState(EntityLiving.java:845) ~[EntityLiving.class:?]
    at net.minecraft.entity.EntityLivingBase.onLivingUpdate(EntityLivingBase.java:2468) ~[EntityLivingBase.class:?]
    at net.minecraft.entity.EntityLiving.onLivingUpdate(EntityLiving.java:639) ~[EntityLiving.class:?]
    at net.minecraft.entity.monster.EntityMob.onLivingUpdate(EntityMob.java:49) ~[EntityMob.class:?]
    at net.minecraft.entity.EntityLivingBase.onUpdate(EntityLivingBase.java:2294) ~[EntityLivingBase.class:?]
    at net.minecraft.entity.EntityLiving.onUpdate(EntityLiving.java:343) ~[EntityLiving.class:?]
    at net.minecraft.entity.monster.EntityMob.onUpdate(EntityMob.java:57) ~[EntityMob.class:?]
    at net.minecraft.world.World.updateEntityWithOptionalForce(World.java:2134) ~[World.class:?]
    at net.minecraft.world.WorldServer.updateEntityWithOptionalForce(WorldServer.java:875) ~[WorldServer.class:?]
    at net.minecraft.world.World.updateEntity(World.java:2101) ~[World.class:?]
    at net.minecraft.world.World.updateEntities(World.java:1914) ~[World.class:?]
    at net.minecraft.world.WorldServer.updateEntities(WorldServer.java:647) ~[WorldServer.class:?]
    at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:794) ~[MinecraftServer.class:?]
    ... 4 more
[18:21:04] [Server thread/ERROR]: This crash report has been saved to: C:\Users\Eria\Documents\My Games\Minecraft\mods\Bloodborne 1.11\run\.\crash-reports\crash-2017-02-11_18.21.04-server.txt
[18:21:04] [Server thread/INFO]: Stopping server
[18:21:04] [Server thread/INFO]: Saving players
[18:21:04] [Client thread/INFO] [STDOUT]: [net.minecraft.init.Bootstrap:printToSYSOUT:600]: ---- Minecraft Crash Report ----
// Why is it breaking :(

Time: 11/02/17 18:21
Description: Ticking entity

java.lang.NullPointerException: Ticking entity
    at net.minecraft.pathfinding.PathNavigate.getPathSearchRange(PathNavigate.java:65)
    at net.minecraft.pathfinding.PathNavigate.getPathToPos(PathNavigate.java:121)
    at net.minecraft.pathfinding.PathNavigateGround.getPathToPos(PathNavigateGround.java:83)
    at net.minecraft.pathfinding.PathNavigate.getPathToXYZ(PathNavigate.java:101)
    at net.minecraft.pathfinding.PathNavigate.tryMoveToXYZ(PathNavigate.java:170)
    at net.minecraft.entity.ai.EntityAIWander.startExecuting(EntityAIWander.java:83)
    at net.minecraft.entity.ai.EntityAITasks.onUpdateTasks(EntityAITasks.java:82)
    at net.minecraft.entity.EntityLiving.updateEntityActionState(EntityLiving.java:845)
    at net.minecraft.entity.EntityLivingBase.onLivingUpdate(EntityLivingBase.java:2468)
    at net.minecraft.entity.EntityLiving.onLivingUpdate(EntityLiving.java:639)
    at net.minecraft.entity.monster.EntityMob.onLivingUpdate(EntityMob.java:49)
    at net.minecraft.entity.EntityLivingBase.onUpdate(EntityLivingBase.java:2294)
    at net.minecraft.entity.EntityLiving.onUpdate(EntityLiving.java:343)
    at net.minecraft.entity.monster.EntityMob.onUpdate(EntityMob.java:57)
    at net.minecraft.world.World.updateEntityWithOptionalForce(World.java:2134)
    at net.minecraft.world.WorldServer.updateEntityWithOptionalForce(WorldServer.java:875)
    at net.minecraft.world.World.updateEntity(World.java:2101)
    at net.minecraft.world.World.updateEntities(World.java:1914)
    at net.minecraft.world.WorldServer.updateEntities(WorldServer.java:647)
    at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:794)
    at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:698)
    at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:156)
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:547)
    at java.lang.Thread.run(Unknown Source)


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

-- Head --
Thread: Client thread
Stacktrace:
    at net.minecraft.pathfinding.PathNavigate.getPathSearchRange(PathNavigate.java:65)
    at net.minecraft.pathfinding.PathNavigate.getPathToPos(PathNavigate.java:121)
    at net.minecraft.pathfinding.PathNavigateGround.getPathToPos(PathNavigateGround.java:83)
    at net.minecraft.pathfinding.PathNavigate.getPathToXYZ(PathNavigate.java:101)
    at net.minecraft.pathfinding.PathNavigate.tryMoveToXYZ(PathNavigate.java:170)
    at net.minecraft.entity.ai.EntityAIWander.startExecuting(EntityAIWander.java:83)
    at net.minecraft.entity.ai.EntityAITasks.onUpdateTasks(EntityAITasks.java:82)
    at net.minecraft.entity.EntityLiving.updateEntityActionState(EntityLiving.java:845)
    at net.minecraft.entity.EntityLivingBase.onLivingUpdate(EntityLivingBase.java:2468)
    at net.minecraft.entity.EntityLiving.onLivingUpdate(EntityLiving.java:639)
    at net.minecraft.entity.monster.EntityMob.onLivingUpdate(EntityMob.java:49)
    at net.minecraft.entity.EntityLivingBase.onUpdate(EntityLivingBase.java:2294)
    at net.minecraft.entity.EntityLiving.onUpdate(EntityLiving.java:343)
    at net.minecraft.entity.monster.EntityMob.onUpdate(EntityMob.java:57)
    at net.minecraft.world.World.updateEntityWithOptionalForce(World.java:2134)
    at net.minecraft.world.WorldServer.updateEntityWithOptionalForce(WorldServer.java:875)
    at net.minecraft.world.World.updateEntity(World.java:2101)

-- Entity being ticked --
Details:
    Entity Type: minecraft:hunter (eria.bloodborne.entity.Hunter)
    Entity ID: 78489
    Entity Name: entity.hunter.name
    Entity's Exact location: 501.66, 4.00, 144.07
    Entity's Block location: World: (501,4,144), Chunk: (at 5,0,0 in 31,9; contains blocks 496,0,144 to 511,255,159), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,0,0 to 511,255,511)
    Entity's Momentum: 0.00, -0.08, 0.00
    Entity's Passengers: []
    Entity's Vehicle: ~~ERROR~~ NullPointerException: null
Stacktrace:
    at net.minecraft.world.World.updateEntities(World.java:1914)
    at net.minecraft.world.WorldServer.updateEntities(WorldServer.java:647)

-- Affected level --
Details:
    Level name: New World
    All players: 1 total; [EntityPlayerMP['Eria8'/120, l='New World', x=505.94, y=4.00, z=144.74]]
    Chunk stats: ServerChunkCache: 256 Drop: 0
    Level seed: -7064839849284747383
    Level generator: ID 01 - flat, ver 0. Features enabled: true
    Level generator options: 
    Level spawn location: World: (532,4,126), Chunk: (at 4,0,14 in 33,7; contains blocks 528,0,112 to 543,255,127), Region: (1,0; contains chunks 32,0 to 63,31, blocks 512,0,0 to 1023,255,511)
    Level time: 55508 game time, 55508 day time
    Level dimension: 0
    Level storage version: 0x04ABD - Anvil
    Level weather: Rain time: 110389 (now: false), thunder time: 96835 (now: false)
    Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: true
Stacktrace:
    at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:794)
    at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:698)
    at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:156)
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:547)
    at java.lang.Thread.run(Unknown Source)

-- System Details --
Details:
    Minecraft Version: 1.11
    Operating System: Windows 10 (amd64) version 10.0
    Java Version: 1.8.0_111, Oracle Corporation
    Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
    Memory: 583762616 bytes (556 MB) / 1038876672 bytes (990 MB) up to 1038876672 bytes (990 MB)
    JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M
    IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
    FML: MCP 9.35 Powered by Forge 13.19.1.2189 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.11-13.19.1.2189.jar) 
    UCHIJAAAA    forge{13.19.1.2189} [Minecraft Forge] (forgeSrc-1.11-13.19.1.2189.jar) 
    UCHIJAAAA    bloodborne{1.0} [Bloodborne] (bin) 
    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['Eria8'/120, l='New World', x=505.94, y=4.00, z=144.74]]
    Type: Integrated Server (map_client.txt)
    Is Modded: Definitely; Client brand changed to 'fml,forge'

 

And this is the entity:

 

public class Hunter extends EntityMob implements IBBMob
{

	public Hunter(World worldIn)
	{
		super(worldIn);
		this.experienceValue = 30;
		this.setSize(0.6F, 1.95F);
	}

	@Override
	protected void applyEntityAttributes()
	{
		this.getAttributeMap().registerAttribute(SharedMonsterAttributes.ATTACK_DAMAGE).setBaseValue(4);
		this.getAttributeMap().registerAttribute(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(50);
		this.getAttributeMap().registerAttribute(SharedMonsterAttributes.KNOCKBACK_RESISTANCE).setBaseValue(0.01);
		this.getAttributeMap().registerAttribute(SharedMonsterAttributes.MOVEMENT_SPEED);
		this.getAttributeMap().registerAttribute(SharedMonsterAttributes.ARMOR);
		this.getAttributeMap().registerAttribute(SharedMonsterAttributes.ARMOR_TOUGHNESS);
	}

	protected void initEntityAI()
	{
		this.tasks.addTask(0, new EntityAISwimming(this));
		this.tasks.addTask(5, new EntityAIMoveTowardsRestriction(this, 1.0D));
		this.tasks.addTask(7, new EntityAIWanderAvoidWater(this, 1.0D));
		this.tasks.addTask(8, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F));
		this.tasks.addTask(8, new EntityAILookIdle(this));
		this.tasks.addTask(6, new EntityAIMoveThroughVillage(this, 1.0D, false));
		this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, true, new Class[]
		{
				Hunter.class
		}));
		this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityPlayer.class, true));
	}

	protected boolean canEquipItem(ItemStack stack)
	{
		return stack.getItem() instanceof ItemSword || stack.getItem() instanceof MeleeWeapon;
	}

	@Nullable
	public IEntityLivingData onInitialSpawn(DifficultyInstance difficulty, @Nullable IEntityLivingData livingdata)
	{
		setEquipment();
		return livingdata;
	}

	protected void setEquipment()
	{
		int i = this.rand.nextInt(5);

		switch (i)
		{
			case 0:
				this.setItemStackToSlot(EntityEquipmentSlot.MAINHAND, new ItemStack(Items.IRON_SWORD));
				break;
			case 1:
				this.setItemStackToSlot(EntityEquipmentSlot.MAINHAND, new ItemStack(Registry.hunterAxe));
				break;
			case 2:
				this.setItemStackToSlot(EntityEquipmentSlot.MAINHAND, new ItemStack(Registry.threadedCane));
				break;
			case 3:
				this.setItemStackToSlot(EntityEquipmentSlot.MAINHAND, new ItemStack(Registry.sawCleaver));
				break;
			case 4:
				this.setItemStackToSlot(EntityEquipmentSlot.MAINHAND, new ItemStack(Registry.kirkHammer));
				break;
		}
	}

	public float getEyeHeight()
	{
		return 1.74F;
	}

	protected boolean isValidLightLevel()
	{
		return true;
	}

	@Override
	public int getEchoes()
	{
		return 100;
	}

	@Override
	public ItemStack getCommonDrop()
	{
		int i = rand.nextInt(100);
		int amount = i % 3 == 0 ? 1 : i % 6 == 0 ? 2 : 0;
		return new ItemStack(Registry.bloodVial, rand.nextInt(2));
	}

	@Override
	public ItemStack getRareDrop()
	{
		int i = rand.nextInt(100);
		Item item = i % 4 == 0 ? Registry.bloodStoneShard
				: i % 6 == 0 ? Registry.twinBloodStoneShards
						: i % 10 == 0 ? Registry.madmansKnowledge : Registry.coldbloodDew;
		return new ItemStack(item);
	}

}

 

Link to comment
Share on other sites

Look at PathNavigate.java line 65.  It's likely referencing something in the Entity class that your class conveniently forgot to ever give a value to, so it's null.

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

Set a breakpoint on the offending line, run in the debugger, and then examine everything there when you hit it

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.

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.