Jump to content

[SOLVED]Ticking Entity Error when disconnecting from server


D4RSORC

Recommended Posts

I'm trynig to make client-side mod which disconnects player when getting damage. However everytime this error occurs:

[23:03:01] [main/FATAL] [net.minecraft.client.Minecraft]: Reported exception thrown!
net.minecraft.util.ReportedException: Ticking entity
	at net.minecraft.world.World.updateEntities(World.java:1942) ~[World.class:?]
	at net.minecraft.client.Minecraft.runTick(Minecraft.java:1972) ~[Minecraft.class:?]
	at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1186) ~[Minecraft.class:?]
	at net.minecraft.client.Minecraft.run(Minecraft.java:441) [Minecraft.class:?]
	at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_102]
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_102]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_102]
	at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_102]
	at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?]
	at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_102]
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_102]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_102]
	at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_102]
	at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?]
	at GradleStart.main(GradleStart.java:25) [start/:?]
Caused by: java.lang.NullPointerException
	at net.minecraft.client.multiplayer.WorldClient.playSound(WorldClient.java:508) ~[WorldClient.class:?]
	at net.minecraft.client.entity.EntityPlayerSP.playSound(EntityPlayerSP.java:696) ~[EntityPlayerSP.class:?]
	at net.minecraft.entity.EntityLivingBase.fall(EntityLivingBase.java:1471) ~[EntityLivingBase.class:?]
	at net.minecraft.entity.player.EntityPlayer.fall(EntityPlayer.java:2104) ~[EntityPlayer.class:?]
	at net.minecraft.block.Block.onFallenUpon(Block.java:1041) ~[Block.class:?]
	at net.minecraft.entity.Entity.updateFallState(Entity.java:1250) ~[Entity.class:?]
	at net.minecraft.entity.EntityLivingBase.updateFallState(EntityLivingBase.java:263) ~[EntityLivingBase.class:?]
	at net.minecraft.entity.Entity.move(Entity.java:1002) ~[Entity.class:?]
	at net.minecraft.client.entity.EntityPlayerSP.move(EntityPlayerSP.java:1189) ~[EntityPlayerSP.class:?]
	at net.minecraft.entity.EntityLivingBase.travel(EntityLivingBase.java:2163) ~[EntityLivingBase.class:?]
	at net.minecraft.entity.player.EntityPlayer.travel(EntityPlayer.java:1976) ~[EntityPlayer.class:?]
	at net.minecraft.entity.EntityLivingBase.onLivingUpdate(EntityLivingBase.java:2614) ~[EntityLivingBase.class:?]
	at net.minecraft.entity.player.EntityPlayer.onLivingUpdate(EntityPlayer.java:577) ~[EntityPlayer.class:?]
	at net.minecraft.client.entity.EntityPlayerSP.onLivingUpdate(EntityPlayerSP.java:1136) ~[EntityPlayerSP.class:?]
	at net.minecraft.entity.EntityLivingBase.onUpdate(EntityLivingBase.java:2396) ~[EntityLivingBase.class:?]
	at net.minecraft.entity.player.EntityPlayer.onUpdate(EntityPlayer.java:272) ~[EntityPlayer.class:?]
	at net.minecraft.client.entity.EntityPlayerSP.onUpdate(EntityPlayerSP.java:230) ~[EntityPlayerSP.class:?]
	at net.minecraft.world.World.updateEntityWithOptionalForce(World.java:2168) ~[World.class:?]
	at net.minecraft.world.World.updateEntity(World.java:2127) ~[World.class:?]
	at net.minecraft.world.World.updateEntities(World.java:1928) ~[World.class:?]
	... 16 more
[23:03:01] [main/INFO] [STDOUT]: [net.minecraft.init.Bootstrap:printToSYSOUT:629]: ---- Minecraft Crash Report ----
// But it works on my machine.

Time: 9/22/18 11:03 PM
Description: Ticking entity

java.lang.NullPointerException: Ticking entity
	at net.minecraft.client.multiplayer.WorldClient.playSound(WorldClient.java:508)
	at net.minecraft.client.entity.EntityPlayerSP.playSound(EntityPlayerSP.java:696)
	at net.minecraft.entity.EntityLivingBase.fall(EntityLivingBase.java:1471)
	at net.minecraft.entity.player.EntityPlayer.fall(EntityPlayer.java:2104)
	at net.minecraft.block.Block.onFallenUpon(Block.java:1041)
	at net.minecraft.entity.Entity.updateFallState(Entity.java:1250)
	at net.minecraft.entity.EntityLivingBase.updateFallState(EntityLivingBase.java:263)
	at net.minecraft.entity.Entity.move(Entity.java:1002)
	at net.minecraft.client.entity.EntityPlayerSP.move(EntityPlayerSP.java:1189)
	at net.minecraft.entity.EntityLivingBase.travel(EntityLivingBase.java:2163)
	at net.minecraft.entity.player.EntityPlayer.travel(EntityPlayer.java:1976)
	at net.minecraft.entity.EntityLivingBase.onLivingUpdate(EntityLivingBase.java:2614)
	at net.minecraft.entity.player.EntityPlayer.onLivingUpdate(EntityPlayer.java:577)
	at net.minecraft.client.entity.EntityPlayerSP.onLivingUpdate(EntityPlayerSP.java:1136)
	at net.minecraft.entity.EntityLivingBase.onUpdate(EntityLivingBase.java:2396)
	at net.minecraft.entity.player.EntityPlayer.onUpdate(EntityPlayer.java:272)
	at net.minecraft.client.entity.EntityPlayerSP.onUpdate(EntityPlayerSP.java:230)
	at net.minecraft.world.World.updateEntityWithOptionalForce(World.java:2168)
	at net.minecraft.world.World.updateEntity(World.java:2127)
	at net.minecraft.world.World.updateEntities(World.java:1928)
	at net.minecraft.client.Minecraft.runTick(Minecraft.java:1972)
	at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1186)
	at net.minecraft.client.Minecraft.run(Minecraft.java:441)
	at net.minecraft.client.main.Main.main(Main.java:118)
	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:135)
	at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
	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.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97)
	at GradleStart.main(GradleStart.java:25)


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

-- Head --
Thread: Client thread
Stacktrace:
	at net.minecraft.client.multiplayer.WorldClient.playSound(WorldClient.java:508)
	at net.minecraft.client.entity.EntityPlayerSP.playSound(EntityPlayerSP.java:696)
	at net.minecraft.entity.EntityLivingBase.fall(EntityLivingBase.java:1471)
	at net.minecraft.entity.player.EntityPlayer.fall(EntityPlayer.java:2104)
	at net.minecraft.block.Block.onFallenUpon(Block.java:1041)
	at net.minecraft.entity.Entity.updateFallState(Entity.java:1250)
	at net.minecraft.entity.EntityLivingBase.updateFallState(EntityLivingBase.java:263)
	at net.minecraft.entity.Entity.move(Entity.java:1002)
	at net.minecraft.client.entity.EntityPlayerSP.move(EntityPlayerSP.java:1189)
	at net.minecraft.entity.EntityLivingBase.travel(EntityLivingBase.java:2163)
	at net.minecraft.entity.player.EntityPlayer.travel(EntityPlayer.java:1976)
	at net.minecraft.entity.EntityLivingBase.onLivingUpdate(EntityLivingBase.java:2614)
	at net.minecraft.entity.player.EntityPlayer.onLivingUpdate(EntityPlayer.java:577)
	at net.minecraft.client.entity.EntityPlayerSP.onLivingUpdate(EntityPlayerSP.java:1136)
	at net.minecraft.entity.EntityLivingBase.onUpdate(EntityLivingBase.java:2396)
	at net.minecraft.entity.player.EntityPlayer.onUpdate(EntityPlayer.java:272)
	at net.minecraft.client.entity.EntityPlayerSP.onUpdate(EntityPlayerSP.java:230)
	at net.minecraft.world.World.updateEntityWithOptionalForce(World.java:2168)
	at net.minecraft.world.World.updateEntity(World.java:2127)

-- Entity being ticked --
Details:
	Entity Type: null (net.minecraft.client.entity.EntityPlayerSP)
	Entity ID: 11969
	Entity Name: Player208
	Entity's Exact location: 218.41, 63.00, 247.39
	Entity's Block location: World: (218,63,247), Chunk: (at 10,3,7 in 13,15; contains blocks 208,0,240 to 223,255,255), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,0,0 to 511,255,511)
	Entity's Momentum: -0.12, -0.96, 0.24
	Entity's Passengers: []
	Entity's Vehicle: ~~ERROR~~ NullPointerException: null
Stacktrace:
	at net.minecraft.world.World.updateEntities(World.java:1928)
	at net.minecraft.client.Minecraft.runTick(Minecraft.java:1972)
	at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1186)
	at net.minecraft.client.Minecraft.run(Minecraft.java:441)
	at net.minecraft.client.main.Main.main(Main.java:118)
	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:135)
	at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
	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.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97)
	at GradleStart.main(GradleStart.java:25)

 

Code I'm using for disconnecting player:

@SubscribeEvent
	public void onDamage(final LivingAttackEvent event){
		if(ConfigAntiAFK.onDamage && event.getEntity() == Minecraft.getMinecraft().player) {
			disconnect((EntityPlayer)event.getEntityLiving());
		}
	}	
	
	private void disconnect(EntityPlayer entity){
		boolean flag = Minecraft.getMinecraft().isIntegratedServerRunning();
        boolean flag1 = Minecraft.getMinecraft().isConnectedToRealms();
        entity.world.sendQuittingDisconnectingPacket();
        Minecraft.getMinecraft().loadWorld((WorldClient)null);

        if (flag)
        {
        	Minecraft.getMinecraft().displayGuiScreen(new GuiMainMenu());
        }
        else if (flag1)
        {
            RealmsBridge realmsbridge = new RealmsBridge();
            realmsbridge.switchToRealms(new GuiMainMenu());
        }
        else
        {
        	Minecraft.getMinecraft().displayGuiScreen(new GuiMultiplayer(new GuiMainMenu()));
        }
	}

 

Please help.

Edited by D4RSORC
problem solved
Link to comment
Share on other sites

I solved this problem :) and it was rather simple. It looks like LivingAttackEvent is firing during client tick, so when you disconnect you get ticking entities. What I did is I subscribed to ClientTickEvent and checked if tick phase is END (END tick phase fires after tick) so that Player will disconnect after tick.

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.