Prevent SOE when replaying sessions recorded on faster machines
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
package eu.crushedpixel.replaymod.replay;
|
package eu.crushedpixel.replaymod.replay;
|
||||||
|
|
||||||
import com.google.common.base.Preconditions;
|
import com.google.common.base.Preconditions;
|
||||||
|
import com.google.common.util.concurrent.ListenableFutureTask;
|
||||||
import eu.crushedpixel.replaymod.ReplayMod;
|
import eu.crushedpixel.replaymod.ReplayMod;
|
||||||
import eu.crushedpixel.replaymod.entities.CameraEntity;
|
import eu.crushedpixel.replaymod.entities.CameraEntity;
|
||||||
import eu.crushedpixel.replaymod.events.RecordingHandler;
|
import eu.crushedpixel.replaymod.events.RecordingHandler;
|
||||||
@@ -30,6 +31,7 @@ import java.io.IOException;
|
|||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.concurrent.Callable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sends replay packets to netty channels.
|
* Sends replay packets to netty channels.
|
||||||
@@ -302,13 +304,15 @@ public class ReplaySender extends ChannelInboundHandlerAdapter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mc.addScheduledTask(new Runnable() {
|
new Callable<Void>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
@SuppressWarnings("unchecked")
|
||||||
if (mc.theWorld == null) {
|
public Void call() {
|
||||||
mc.addScheduledTask(this);
|
if (mc.theWorld == null || !mc.isCallingFromMinecraftThread()) {
|
||||||
return;
|
synchronized(mc.scheduledTasks) {
|
||||||
|
mc.scheduledTasks.add(ListenableFutureTask.create(this));
|
||||||
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
CameraEntity cent = ReplayHandler.getCameraEntity();
|
CameraEntity cent = ReplayHandler.getCameraEntity();
|
||||||
@@ -318,8 +322,9 @@ public class ReplaySender extends ChannelInboundHandlerAdapter {
|
|||||||
}
|
}
|
||||||
cent.moveAbsolute(ppl.func_148932_c(), ppl.func_148928_d(), ppl.func_148933_e());
|
cent.moveAbsolute(ppl.func_148932_c(), ppl.func_148928_d(), ppl.func_148933_e());
|
||||||
ReplayHandler.setCameraEntity(cent);
|
ReplayHandler.setCameraEntity(cent);
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
});
|
}.call();
|
||||||
}
|
}
|
||||||
|
|
||||||
return asyncMode ? processPacketAsync(p) : processPacketSync(p);
|
return asyncMode ? processPacketAsync(p) : processPacketSync(p);
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ public net.minecraft.client.Minecraft field_71467_ac # rightClickDelayTimer
|
|||||||
public net.minecraft.client.Minecraft field_71423_H # systemTime
|
public net.minecraft.client.Minecraft field_71423_H # systemTime
|
||||||
public net.minecraft.client.Minecraft field_71429_W # leftClickCounter
|
public net.minecraft.client.Minecraft field_71429_W # leftClickCounter
|
||||||
public net.minecraft.client.Minecraft field_71445_n # isGamePaused
|
public net.minecraft.client.Minecraft field_71445_n # isGamePaused
|
||||||
|
public net.minecraft.client.Minecraft field_152351_aB # scheduledTasks
|
||||||
|
|
||||||
public net.minecraft.client.Minecraft func_71386_F()L # getSystemTime
|
public net.minecraft.client.Minecraft func_71386_F()L # getSystemTime
|
||||||
public net.minecraft.client.Minecraft func_71383_b(I)V # updateDebugProfilerName
|
public net.minecraft.client.Minecraft func_71383_b(I)V # updateDebugProfilerName
|
||||||
|
|||||||
Reference in New Issue
Block a user