Skip to content

Commit

Permalink
[Savestates] Fix issues after loading across dimensions
Browse files Browse the repository at this point in the history
  • Loading branch information
ScribbleTAS committed Dec 11, 2024
1 parent 0803451 commit bc5418c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.minecrafttas.tasmod.savestates;

import static com.minecrafttas.tasmod.TASmod.LOGGER;
import static com.minecrafttas.tasmod.registries.TASmodPackets.CLEAR_SCREEN;

import java.io.File;
import java.io.IOException;
Expand Down Expand Up @@ -402,6 +403,12 @@ public void loadState(int savestateIndex, boolean tickrate0, boolean changeIndex

worldHandler.sendChunksToClient();

try {
TASmod.server.sendToAll(new TASmodBufferBuilder(CLEAR_SCREEN));
} catch (Exception e) {
LOGGER.catching(e);
}

if (!tickrate0) {
TASmod.tickratechanger.pauseGame(false);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.minecrafttas.tasmod.savestates.handlers;

import static com.minecrafttas.tasmod.TASmod.LOGGER;
import static com.minecrafttas.tasmod.registries.TASmodPackets.CLEAR_SCREEN;
import static com.minecrafttas.tasmod.registries.TASmodPackets.SAVESTATE_PLAYER;
import static com.minecrafttas.tasmod.registries.TASmodPackets.SAVESTATE_REQUEST_MOTION;

Expand Down Expand Up @@ -167,7 +166,7 @@ public void loadAndSendMotionToPlayer() {
public void changeDimensionDangerously(EntityPlayerMP player, int dimensionTo) {
int dimensionFrom = player.dimension;
WorldServer worldServerFrom = this.server.getWorld(dimensionFrom);
WorldServer worldServerTo = this.server.getWorld(dimensionTo);
// WorldServer worldServerTo = this.server.getWorld(dimensionTo);

//@formatter:off
player.connection
Expand All @@ -182,16 +181,10 @@ public void changeDimensionDangerously(EntityPlayerMP player, int dimensionTo) {
//@formatter:on
worldServerFrom.removeEntityDangerously(player);
player.isDead = false;
worldServerTo.spawnEntity(player);
worldServerTo.updateEntityWithOptionalForce(player, false);
player.setWorld(worldServerTo);
player.interactionManager.setWorld(worldServerTo);

try {
TASmod.server.sendTo(player, new TASmodBufferBuilder(CLEAR_SCREEN));
} catch (Exception e) {
LOGGER.catching(e);
}
// worldServerTo.spawnEntity(player);
// worldServerTo.updateEntityWithOptionalForce(player, false);
// player.setWorld(worldServerTo);
// player.interactionManager.setWorld(worldServerTo);
}

public void clearScoreboard() {
Expand Down

0 comments on commit bc5418c

Please sign in to comment.