MinecraftTAS / TASmod

Minecraft Tool-Assisted Speedrun (TAS) Tools with input playback
https://discord.gg/jGhNxpd
GNU General Public License v3.0
30 stars 5 forks source link

Pressure Plates won't update after savestate #136

Closed ScribbleTAS closed 2 years ago

ScribbleTAS commented 2 years ago

Seems like my old friend #58 since I can place blocks inside of me

ScribbleTAS commented 2 years ago

58 wasn't the main issue, it was a different bug that I fixed too

How pressure plates work

Pressing a pressure plate schedules a "nextticklistentry" in WorldServer. And it updates again when world.getWorldTotalTime() is bigger than the scheduled time. The scheduled time is the current world time + a specified delay. So pretty simple: If the scheduled time is reached, it updates the pressure plate. If nobody is on the plate it unpresses.

The problem

When loading a savestate, the world total time is loaded from the savestate and is way smaller than the previous world time, making the pressure plate unpress after a longer time.

Solution

Update the schedule time to the current world time. This makes all pressure plates jump up immediately, but maybe I should store this information somewhere to make it compatible with savestates