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

[1.21.3] forceTicks in addRegionTicket isn't working correctly #1702

Closed
thexaero opened this issue Nov 25, 2024 · 1 comment · Fixed by #1738
Closed

[1.21.3] forceTicks in addRegionTicket isn't working correctly #1702

thexaero opened this issue Nov 25, 2024 · 1 comment · Fixed by #1738
Labels
1.21.3 Targeted at Minecraft 1.21.3 1.21.4 Targeted at Minecraft 1.21.4 bug A bug or error regression Worked previously but doesn't anymore triage Needs triaging and confirmation

Comments

@thexaero
Copy link

thexaero commented Nov 25, 2024

Minecraft Version: 1.21.3

NeoForge Version: tested on 21.3.31-beta

Logs: (This crash is not the only problem, so please read the description below!) Crash on world join from the lack of a null check in ServerChunkCache.collectTickingChunks. The shouldForceTicks call returning true bypasses the vanilla null check.

java.lang.NullPointerException: Cannot invoke "net.minecraft.world.level.chunk.LevelChunk.getPos()" because "levelchunk" is null
	at TRANSFORMER/[email protected]/net.minecraft.server.level.ServerChunkCache.tickChunks(ServerChunkCache.java:417) ~[neoforge-21.3.31-beta.jar%23215!/:?] {re:classloading,pl:accesstransformer:B}
	at TRANSFORMER/[email protected]/net.minecraft.server.level.ServerChunkCache.tickChunks(ServerChunkCache.java:363) ~[neoforge-21.3.31-beta.jar%23215!/:?] {re:classloading,pl:accesstransformer:B}
	at TRANSFORMER/[email protected]/net.minecraft.server.level.ServerChunkCache.tick(ServerChunkCache.java:338) ~[neoforge-21.3.31-beta.jar%23215!/:?] {re:classloading,pl:accesstransformer:B}
	at TRANSFORMER/[email protected]/net.minecraft.server.level.ServerLevel.tick(ServerLevel.java:373) ~[neoforge-21.3.31-beta.jar%23215!/:?] {re:classloading,pl:accesstransformer:B,xf:fml:openpartiesandclaims:xaero_pac_serverlevel_tick,xf:fml:openpartiesandclaims:xaero_pac_serverlevel_ispositionentityticking}
	at TRANSFORMER/[email protected]/net.minecraft.server.MinecraftServer.tickChildren(MinecraftServer.java:1090) ~[neoforge-21.3.31-beta.jar%23215!/:?] {re:classloading,pl:accesstransformer:B,xf:fml:openpartiesandclaims:xaero_pac_minecraftserverclass}
	at TRANSFORMER/[email protected]/net.minecraft.server.MinecraftServer.tickServer(MinecraftServer.java:963) ~[neoforge-21.3.31-beta.jar%23215!/:?] {re:classloading,pl:accesstransformer:B,xf:fml:openpartiesandclaims:xaero_pac_minecraftserverclass}
	at TRANSFORMER/[email protected]/net.minecraft.client.server.IntegratedServer.tickServer(IntegratedServer.java:108) ~[neoforge-21.3.31-beta.jar%23215!/:?] {re:classloading,xf:fml:openpartiesandclaims:xaero_pac_integratedserver_tickpaused,pl:runtimedistcleaner:A}
	at TRANSFORMER/[email protected]/net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:723) ~[neoforge-21.3.31-beta.jar%23215!/:?] {re:classloading,pl:accesstransformer:B,xf:fml:openpartiesandclaims:xaero_pac_minecraftserverclass}
	at TRANSFORMER/[email protected]/net.minecraft.server.MinecraftServer.lambda$spin$2(MinecraftServer.java:278) ~[neoforge-21.3.31-beta.jar%23215!/:?]

Steps to Reproduce:

  1. Add a ticket with ServerChunkCache.addRegionTicket(TicketType<T> p_8388_, ChunkPos p_8389_, int p_8390_, T p_8391_, boolean forceTicks) with forceTicks set to true.
  2. Plant some wheat seeds in the forceloaded chunk.
  3. Fly far away and set random tick speed to 3000, then wait for 30 seconds.
  4. Set random tick speed back to 3.
  5. Return to the forceloaded chunk.
  6. (First issue) The wheat has not grown.
  7. Relog.
  8. (Second issue) If the ticket persists, so it's readded on world join, you'll crash with a NPE. Not sure if it's guaranteed but seems to happen every time for me when standing in the forceloaded chunk.

Description of issue:

Forceload tickets with forceTicks set to true don't force random block ticks and cause a crash when joining a world.

@thexaero thexaero added the triage Needs triaging and confirmation label Nov 25, 2024
Matyrobbrt added a commit to Matyrobbrt/NeoForge that referenced this issue Dec 4, 2024
@sciwhiz12 sciwhiz12 added bug A bug or error regression Worked previously but doesn't anymore 1.21.3 Targeted at Minecraft 1.21.3 1.21.4 Targeted at Minecraft 1.21.4 labels Dec 10, 2024
@neoforged-releases
Copy link

🚀 This issue has been resolved in NeoForge version 21.4.23-beta, as part of #1738.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.21.3 Targeted at Minecraft 1.21.3 1.21.4 Targeted at Minecraft 1.21.4 bug A bug or error regression Worked previously but doesn't anymore triage Needs triaging and confirmation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants