Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accessing world too early in attachment deserialization #4389

Closed
Phoupraw opened this issue Jan 20, 2025 · 1 comment · Fixed by #4390
Closed

Accessing world too early in attachment deserialization #4389

Phoupraw opened this issue Jan 20, 2025 · 1 comment · Fixed by #4390
Labels
bug Something isn't working priority:high High priority PRs that need review and work now. Review these first.

Comments

@Phoupraw
Copy link
Contributor

[Server thread/ERROR] (Minecraft) Failed to load data for block entity minecraft:jukebox
 java.lang.NullPointerException: Cannot invoke "net.minecraft.world.World.getRegistryManager()" because "this.world" is null
	at knot/net.minecraft.block.entity.BlockEntity.fabric_getDynamicRegistryManager(BlockEntity.java:1176) ~[minecraft-merged-228b57201f-1.21.1-net.fabricmc.yarn.1_21_1.1.21.1+build.3-v2.jar:?]
	at knot/net.minecraft.block.entity.BlockEntity.acknowledgeSynced(BlockEntity.java:695) ~[minecraft-merged-228b57201f-1.21.1-net.fabricmc.yarn.1_21_1.1.21.1+build.3-v2.jar:?]
	at knot/net.minecraft.block.entity.BlockEntity.md0ab4de$fabric-data-attachment-api-v1$lambda$fabric_readAttachmentsFromNbt$0$0(BlockEntity.java:677) ~[minecraft-merged-228b57201f-1.21.1-net.fabricmc.yarn.1_21_1.1.21.1+build.3-v2.jar:?]
	at java.base/java.util.IdentityHashMap.forEach(IdentityHashMap.java:1375) ~[?:?]
	at knot/net.minecraft.block.entity.BlockEntity.fabric_readAttachmentsFromNbt(BlockEntity.java:675) ~[minecraft-merged-228b57201f-1.21.1-net.fabricmc.yarn.1_21_1.1.21.1+build.3-v2.jar:?]
	at knot/net.minecraft.block.entity.BlockEntity.handler$zef000$fabric-data-attachment-api-v1$readBlockEntityAttachments(BlockEntity.java:1137) ~[minecraft-merged-228b57201f-1.21.1-net.fabricmc.yarn.1_21_1.1.21.1+build.3-v2.jar:?]
	at knot/net.minecraft.block.entity.BlockEntity.read(BlockEntity.java:156) ~[minecraft-merged-228b57201f-1.21.1-net.fabricmc.yarn.1_21_1.1.21.1+build.3-v2.jar:?]

fabric-api 0.114.0+1.21.1
latest.log

@modmuss50
Copy link
Member

Humm, I can see why this is happening but im not 100% sure on the solution. The acknowledgeSynced might need to wait until after the world has been set in the BlockEntity.

@modmuss50 modmuss50 added bug Something isn't working priority:high High priority PRs that need review and work now. Review these first. labels Jan 21, 2025
modmuss50 added a commit to modmuss50/fabric that referenced this issue Jan 21, 2025
@modmuss50 modmuss50 linked a pull request Jan 21, 2025 that will close this issue
modmuss50 added a commit that referenced this issue Jan 21, 2025
* Fix syncing block entity attachments on load.

Closes #4389

* Return success
modmuss50 added a commit that referenced this issue Jan 21, 2025
* Fix syncing block entity attachments on load.

Closes #4389

* Return success

(cherry picked from commit 7e31339)

(cherry picked from commit 8212661)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working priority:high High priority PRs that need review and work now. Review these first.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants