1.18.2 Multiplayer - Monitor turns blank, will not display anymore unless computer connecting block replaced after chunk unloads
Sirian142 opened this issue · 5 comments
Minecraft Version
1.18.x
Version
1.100.9
Details
Info
Minecraft Java 1.18.2
Forge 40.1.68
CC Tweaked: 1.100.9
client: latest.log
server: debug.log
Issue
On a server, when moving far from the chunk or leaving the game (unloading the chunk), the monitor connected to the computer will be blank and no longer display anything. The program will continue running as normal with no errors. (Likely not realated to #692 because the chunk loader makes a difference.) With further testing, placing a chunk loader in the chunk will prevent this issue from occuring.
Restarting the computer, clearing the monitor and restarting the program, or breaking one block of the monitor will not fix the monitor. However, breaking the monitor block connected to the computer and replacing it will fix the monitor. This block HAS to be the one connected to the computer, otherwise it will make no difference.
This issue does not occur in singleplayer. I was unable to test this issue with the server only running CC Tweaked.
Screenshot of monitor as described above. Computer is running monitor-related code successfully.
Screenshot of monitor working as intended.
Reproduction Steps
- Join a server with the mods (as listed in lastest.txt, or listed below) (if you want to you can test on my server).
- Set up a computer with a monitor running a related program.
- Leave the game (or area) and reconnect.
- The monitor will now be broken as described above.
Mods List
1.18.2, Forge 40.1.68
3D Skinlayers - 1.4.6
Appleskin - 2.4.0
Applied Energistics2 - 11.1.4
Aqua Culture - 2.3.7
Ars Nouveau - 2.7.1
Bad Packets - 0.1.2
Balm - 3.1.0
BigBrain - 1.5.3
Biomes O Plenty - 16.0.0.109 Universal
Carry On - 1.17.0.8
CC Tweaked - 1.100.9
Crayfish Furniture - 7.0.0
Chisels Bits - 1.2.113 Universal
Cloth Config - 6.2.62
Comforts - 5.0.0.4
Create - 0.5.0c
Curios - 5.0.7.1
Ding - 1.3.0
Fabric API - 0.57.0
Farmers Delight - 1.1.2
Flywheel - 0.6.4
Forbidden Arcanus - 2.0.0
Geckolib - 3.0.28
Guard Villagers - 1.4.3
ImmersiveFX+ - 1.0.0gm
JEI - 9.7.0.209
JourneyMap - 5.8.5
JustEnoughResources - 0.13.1.141
Mantle - 1.9.27
Mekanism - 10.2.5.465
MekanismAdditions - 10.2.5.465
MekanismGenerators - 10.2.5.465
MekanismTools - 10.2.5.465
Neat - 1.8-31
Patchouil - 71.1
Polymorph - 0.44
Selene - 1.17.9
StorageDrawers - 10.2.1
Supplementaries - 1.4.8
Tinkers Construct - 3.5.1.31
TerraBlender - 1.1.0.102
Tombstone - 7.4.10
Valhesia Core - 0.4.0
Waystones - 10.1.0
WTHIT - 4.11.0
Thanks to several people's help on the SwitchCraft issue, we've been able to reliably reproduce this. The main trick seems to be having the render distance lower than the simulation distance.
When moving away from the monitor, the chunk can get put into a weird state where it is not loaded (i.e. Level.isLoaded(blockPos)
returns false
), but not actually removed from the world (the block entities remain in memory, and setRemoved
is not called). MinecraftForge/MinecraftForge#8909 and mekanism/Mekanism#7560 go in to a bit more detail on this.
This has several side effects:
- Computers continue to execute for a few more seconds, until their keep alive expires. This was actually the root cause of computers sometimes not turning on again when unloaded (dan200/ComputerCraft#457).
- The monitor is then drawn to and an update scheduled.
TickScheduler.tick
then checks if the block is loaded. It's not, and so do not actually update the monitor. This is fine, and as expected.- However, when the monitor is then loaded again, it still thinks it's in a state where it's about to be ticked. This means it doesn't reschedule another tick when the monitor next changes.
This is actually pretty easy to fix — we can just patch this line to schedule a monitor update on every change, not just the first one.
- if (!changed.getAndSet(true)) TickScheduler.schedule(origin.tickToken);
+ changed.set(true);
+ TickScheduler.schedule(origin.tickToken);
However, this fix isn't really correct in the general case. I think something more appropriate would be to detect when chunks become loaded again, and call clearRemoved
(or equivalent) on our block entities.
Can you try to narrow down what mods are required to reproduce this? It's entirely possible that this is a mod interaction issue and it'll help the maintainers if the list of mods to check is as small as possible.
Sorry, all I can do myself is crosscheck modlist provided above with the one I have and list the mods that are in both:
Appleskin 2.4.1
Applied Energistics 2 11.1.7
Aquaculture 2 2.3.8
Ars Nouveau 2.7.7
Balm 3.2.0
CC Tweaked 1.100.9
Cloth config v4 API 6.2.62
Comforts 5.0.0.4
Create 0.5.0.d
Curios API 5.0.7.1
Farmer's delight 1.1.2
Flywheel 0.6.5
Forbidden arcanus 2.1.0-beta3
GeckoLib 3.0.34
JEI 9.7.2.259
Journeymap 5.9.0beta2
Just enough resources 0.14.1.171
Mantle 1.9.27
Mekanism 10.2.5
Mekanism generators 10.2.5
Mekanism tools 10.2.5
Patchouil 71.9
Polymorph 0.44
Selene 1.17.9
Supplementaries 1.4.12
Tinkers' construct 3.5.1.31
TerraBlender 1.1.0.102
Valhesia core 0.3.1
Waystones 10.1.0
I will continue to do some testing, and if I find something of significance, I'll post here
Got the same happening in All of Fabric 5 2.0.5, either screen stays blank or is frozen in an older state. The program runs fine tho.
The breaking the monitor block above the Computer also not always helps, i even tried reattaching mid-loop, and it doesnt come back.
Restarting the program leaves the screen blank for a short amount of time, then comes back with the same old frozen state.