Fix crash when running outside of dev
This commit is contained in:
parent
055721f494
commit
57773db489
|
|
@ -1,8 +1,10 @@
|
|||
package org.embeddedt.modernfix.mixin;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.nbt.CompressedStreamTools;
|
||||
import net.minecraft.world.storage.SaveFormat;
|
||||
import net.minecraftforge.fml.common.ObfuscationReflectionHelper;
|
||||
import org.embeddedt.modernfix.ModernFix;
|
||||
import org.embeddedt.modernfix.duck.ILevelSave;
|
||||
import org.embeddedt.modernfix.util.DummyServerConfiguration;
|
||||
|
|
@ -14,12 +16,11 @@ import java.nio.file.Path;
|
|||
|
||||
@Mixin(SaveFormat.LevelSave.class)
|
||||
public class LevelSaveMixin implements ILevelSave {
|
||||
@Shadow @Final private SaveFormat this$0;
|
||||
|
||||
@Shadow @Final private Path saveDir;
|
||||
|
||||
public void runWorldPersistenceHooks() {
|
||||
((SaveFormatAccessor)this.this$0).invokeReadFromLevelData(this.saveDir.toFile(), (file, dataFixer) -> {
|
||||
SaveFormat saveFormat = ObfuscationReflectionHelper.getPrivateValue(Minecraft.class, Minecraft.getInstance(), "field_71469_aa");
|
||||
((SaveFormatAccessor)saveFormat).invokeReadFromLevelData(this.saveDir.toFile(), (file, dataFixer) -> {
|
||||
try {
|
||||
CompoundNBT compoundTag = CompressedStreamTools.readCompressed(file);
|
||||
net.minecraftforge.fml.WorldPersistenceHooks.handleWorldDataLoad((SaveFormat.LevelSave)(Object)this, new DummyServerConfiguration(), compoundTag);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user