Merge branch 1.8-dev into 1.8.9-dev
1c888aaAdd minVersion to mixin configs and bump bundled mixin version10ce71eFix mapwriter crash when opening replay for <MC1.12 (fixes #96)5fb1cf3Fix half-despawned player entities (see #93) when the entity is moved greater distancesadfe6a2Fix NPE when spectated non-player entity despawns (fixes #94)b27af27Fix player entities being half-despawned after jumping in time (fixes #93)
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
package com.replaymod.compat.mapwriter.mixin;
|
||||
|
||||
import com.replaymod.replay.ReplayModReplay;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.multiplayer.ServerData;
|
||||
import net.minecraftforge.fml.common.Loader;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
/**
|
||||
* Approximately this for <1.12: https://github.com/Vectron/mapwriter/commit/68234520c7a3a0ae8201a085d7e66369900586ac
|
||||
*/
|
||||
@Mixin(Minecraft.class)
|
||||
public abstract class MixinMinecraft {
|
||||
|
||||
@Shadow
|
||||
private ServerData currentServerData;
|
||||
|
||||
@Inject(method = "getCurrentServerData", cancellable = true, at = @At("HEAD"))
|
||||
private void replayModCompat_fixBug96(CallbackInfoReturnable<ServerData> ci) {
|
||||
if (currentServerData == null
|
||||
&& (Loader.isModLoaded("mapwriter") || Loader.isModLoaded("MapWriter"))
|
||||
&& ReplayModReplay.instance.getReplayHandler() != null) {
|
||||
for (StackTraceElement elem : Thread.currentThread().getStackTrace()) {
|
||||
if ("mapwriter.util.Utils".equals(elem.getClassName()) && "getWorldName".equals(elem.getMethodName())) {
|
||||
ci.setReturnValue(new ServerData(null, "replay", false));
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user