Posted March 13, 20196 yr I have a strange problem where a capability that otherwise works perfectly well doesn't work after changing dimensions, such as going to the nether or back to overworld. I did some debugging and found where the error is but I don't understand why it exists. When an entity is removed (such as when changing dimensions), it's invalidateCaps() method is called, so its valid field becomes false. This means when player.getCapability is called for whichever capability, it returns LazyOptional.empty(): public <T> LazyOptional<T> getCapability(@Nonnull Capability<T> cap, @Nullable EnumFacing side) { final CapabilityDispatcher disp = getCapabilities(); return !valid || disp == null ? LazyOptional.empty() : disp.getCapability(cap, side); } Entity is also removed when it dies, but upon respawning the AttachCapabilitiesEvent is called again both on the client and the server threads, and the capability works fine. However, when the entity changes dimensions, the AttachCapabilitiesEvent is only called on the client thread. I don't know if this has anything to do with the problem. If anyone knows how to deal with this problem, I would appreciate the help.
March 13, 20196 yr There's an issue on this matter already. We're just waiting for someone to make a PR for it. It will probably take some time since it needs quite a bit of patches. Edited March 13, 20196 yr by Terrails
March 14, 20196 yr Author Damn, I spent a lot of time for no reason then. I should learn to check the github issues and not just count on google searches.
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.