Posted October 16, 20222 yr So, I have a capability storing some data, so I want to keep the data when the player dies (if resetOnDeath is false) or when he comes back from the end dimension. Here's my code: @SubscribeEvent public void onPlayerClone(PlayerEvent.@NotNull Clone event) { if (!event.isWasDeath() || !ServerConfig.resetOnDeath.get()) { Player original = event.getOriginal(); original.reviveCaps(); original.getCapability(PlayerCapabilityProvider.PLAYER_CAP).ifPresent(oldCap -> { event.getEntity().getCapability(PlayerCapabilityProvider.PLAYER_CAP).ifPresent(newCap -> { newCap.setNBTData(oldCap.getNBTData()); }); }); original.invalidateCaps(); } } Event is registered though the Forge EventBus, registration is located at FMLCommonSetupEvent. When testing in a singleplayer world, everything seems to be perfectly working. When I join a server however and die, the respawn button does nothing. Any ideas? PS: I'm using latest Forge version 43.1.43 for 1.19.2. Edited October 16, 20222 yr by Darkorg69 PS
October 17, 20222 yr 7 hours ago, Darkorg69 said: PlayerEvent.@NotNull Clone This is badly formatted. 7 hours ago, Darkorg69 said: When I join a server however and die, the respawn button does nothing. Do you mean the respawn button doesn't work? Or that the data isn't copied?
October 17, 20222 yr Author I mean the respawn button doesn't work at all. Nothing happens when I press it.
October 18, 20222 yr Can you check your debug.log to see if there is any error occurring when you press the button? Nothing in the method provided immediately jumps out to me with an error.
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.