Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[1.15.1] client capability is not present after death


Recommended Posts

I am trying to update a capability on player death. I use PlayerEvent.Clone and check if isWasDeath() to send a packet to the client to update that capability. My Clone event handler first copies the original PlayerEntity's capability values to the PlayerEntity in the logical server and then sends a packet to the client, which uses Minecraft#player. The server-side capability is updated without issues, but it is not even present in the client. Both sides use LazyOptional<X>#ifPresent.

links: Clone event handler, client packet

Why does this occur?

 

edit: reconnecting to a server results in the capabilty being properly synchronized

Spoiler

[18:03:12] [Server thread/INFO] [adventureitems/]: both capabilities are present on the server side
[18:03:12] [Render thread/FATAL] [minecraft/ThreadTaskExecutor]: Error executing task on Client
java.lang.IllegalStateException: capability does not exist
	at transfarmer.adventureitems.network.ClientWeaponData.lambda$clientHandle$2(ClientWeaponData.java:60) ~[main/:?] {re:classloading}
	at net.minecraftforge.common.util.LazyOptional.orElseThrow(LazyOptional.java:261) ~[forge-1.15.1-30.0.41_mapped_snapshot_20200115-1.14.3.jar:?] {re:classloading}
	at transfarmer.adventureitems.network.ClientWeaponData.clientHandle(ClientWeaponData.java:60) ~[main/:?] {re:classloading}
	at net.minecraftforge.fml.DistExecutor.runWhenOn(DistExecutor.java:56) ~[forge-1.15.1-30.0.41_mapped_snapshot_20200115-1.14.3.jar:?] {re:classloading}
	at transfarmer.adventureitems.network.ClientWeaponData.handle(ClientWeaponData.java:43) ~[main/:?] {re:classloading}
	at net.minecraftforge.fml.network.simple.IndexedMessageCodec.lambda$tryDecode$3(IndexedMessageCodec.java:124) ~[forge-1.15.1-30.0.41_mapped_snapshot_20200115-1.14.3.jar:?] {re:classloading}
	at java.util.Optional.ifPresent(Optional.java:159) ~[?:1.8.0_232] {}
	at net.minecraftforge.fml.network.simple.IndexedMessageCodec.tryDecode(IndexedMessageCodec.java:124) ~[forge-1.15.1-30.0.41_mapped_snapshot_20200115-1.14.3.jar:?] {re:classloading}
	at net.minecraftforge.fml.network.simple.IndexedMessageCodec.consume(IndexedMessageCodec.java:157) ~[forge-1.15.1-30.0.41_mapped_snapshot_20200115-1.14.3.jar:?] {re:classloading}
	at net.minecraftforge.fml.network.simple.SimpleChannel.networkEventListener(SimpleChannel.java:79) ~[forge-1.15.1-30.0.41_mapped_snapshot_20200115-1.14.3.jar:?] {re:classloading}
	at net.minecraftforge.eventbus.EventBus.doCastFilter(EventBus.java:212) ~[eventbus-2.0.0-milestone.1-service.jar:?] {}
	at net.minecraftforge.eventbus.EventBus.lambda$addListener$11(EventBus.java:204) ~[eventbus-2.0.0-milestone.1-service.jar:?] {}
	at net.minecraftforge.eventbus.EventBus.post(EventBus.java:258) ~[eventbus-2.0.0-milestone.1-service.jar:?] {}
	at net.minecraftforge.fml.network.NetworkInstance.dispatch(NetworkInstance.java:84) ~[forge-1.15.1-30.0.41_mapped_snapshot_20200115-1.14.3.jar:?] {re:classloading}
	at net.minecraftforge.fml.network.NetworkHooks.lambda$onCustomPayload$0(NetworkHooks.java:74) ~[forge-1.15.1-30.0.41_mapped_snapshot_20200115-1.14.3.jar:?] {re:classloading}
	at java.util.Optional.map(Optional.java:215) ~[?:1.8.0_232] {}
	at net.minecraftforge.fml.network.NetworkHooks.onCustomPayload(NetworkHooks.java:74) ~[forge-1.15.1-30.0.41_mapped_snapshot_20200115-1.14.3.jar:?] {re:classloading}
	at net.minecraft.client.network.play.ClientPlayNetHandler.handleCustomPayload(ClientPlayNetHandler.java:1868) ~[forge-1.15.1-30.0.41_mapped_snapshot_20200115-1.14.3.jar:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.network.play.server.SCustomPayloadPlayPacket.processPacket(SCustomPayloadPlayPacket.java:59) ~[forge-1.15.1-30.0.41_mapped_snapshot_20200115-1.14.3.jar:?] {re:classloading}
	at net.minecraft.network.play.server.SCustomPayloadPlayPacket.processPacket(SCustomPayloadPlayPacket.java:11) ~[forge-1.15.1-30.0.41_mapped_snapshot_20200115-1.14.3.jar:?] {re:classloading}
	at net.minecraft.network.PacketThreadUtil.func_225383_a(SourceFile:21) ~[forge-1.15.1-30.0.41_mapped_snapshot_20200115-1.14.3.jar:?] {re:classloading}
	at net.minecraft.util.concurrent.ThreadTaskExecutor.run(SourceFile:144) ~[forge-1.15.1-30.0.41_mapped_snapshot_20200115-1.14.3.jar:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.util.concurrent.RecursiveEventLoop.run(SourceFile:23) ~[forge-1.15.1-30.0.41_mapped_snapshot_20200115-1.14.3.jar:?] {re:classloading}
	at net.minecraft.util.concurrent.ThreadTaskExecutor.driveOne(SourceFile:118) ~[forge-1.15.1-30.0.41_mapped_snapshot_20200115-1.14.3.jar:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.util.concurrent.ThreadTaskExecutor.drainTasks(SourceFile:103) ~[forge-1.15.1-30.0.41_mapped_snapshot_20200115-1.14.3.jar:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:855) ~[forge-1.15.1-30.0.41_mapped_snapshot_20200115-1.14.3.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.Minecraft.run(Minecraft.java:520) ~[forge-1.15.1-30.0.41_mapped_snapshot_20200115-1.14.3.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.main.Main.main(SourceFile:202) ~[forge-1.15.1-30.0.41_mapped_snapshot_20200115-1.14.3.jar:?] {re:classloading,pl:runtimedistcleaner:A}
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_232] {}
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_232] {}
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_232] {}
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_232] {}
	at net.minecraftforge.userdev.FMLUserdevClientLaunchProvider.lambda$launchService$0(FMLUserdevClientLaunchProvider.java:55) ~[forge-1.15.1-30.0.41_mapped_snapshot_20200115-1.14.3.jar:?] {}
	at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-5.0.0-milestone.4.jar:?] {}
	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:54) [modlauncher-5.0.0-milestone.4.jar:?] {}
	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:72) [modlauncher-5.0.0-milestone.4.jar:?] {}
	at cpw.mods.modlauncher.Launcher.run(Launcher.java:81) [modlauncher-5.0.0-milestone.4.jar:?] {}
	at cpw.mods.modlauncher.Launcher.main(Launcher.java:65) [modlauncher-5.0.0-milestone.4.jar:?] {}
	at net.minecraftforge.userdev.LaunchTesting.main(LaunchTesting.java:101) [forge-1.15.1-30.0.41_mapped_snapshot_20200115-1.14.3.jar:?] {}

 

 

Edited by transfarmer
Link to post
Share on other sites
9 minutes ago, transfarmer said:

I am trying to update a capability on player death. I use PlayerEvent.Clone and check if isWasDeath() to send a packet to the client to update that capability. My Clone event handler first copies the original PlayerEntity's capability values to the PlayerEntity in the logical server and then sends a packet to the client, which uses Minecraft#player.

You cannot send packets in PlayerEvent.Clone. The event's only purpose is to copy the capability data.

 

To keep the client side properly synchronized you need to send the data in PlayerLoggedInEvent, PlayerRespawnEvent and PlayerChangedDimensionEvent.

  • Thanks 1
Link to post
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.

Guest
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 Privacy Policy.