Fix crash when changing dimensions
This commit is contained in:
@@ -48,25 +48,18 @@ public abstract class MixinWorldRenderer implements IGetVoxyRenderSystem {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Unique private ClientWorld refCopy;
|
|
||||||
|
|
||||||
@Inject(method = "setWorld", at = @At("HEAD"))
|
@Inject(method = "setWorld", at = @At("HEAD"))
|
||||||
private void voxy$captureSetWorld(ClientWorld world, CallbackInfo ci) {
|
private void voxy$captureSetWorld(ClientWorld world, CallbackInfo ci) {
|
||||||
this.refCopy = this.world;
|
if (this.world != world) {
|
||||||
}
|
|
||||||
|
|
||||||
@Inject(method = "setWorld", at = @At("TAIL"))
|
|
||||||
private void voxy$setWorld(ClientWorld world, CallbackInfo ci) {
|
|
||||||
if (world == null) {
|
|
||||||
this.shutdownRenderer();
|
this.shutdownRenderer();
|
||||||
}
|
|
||||||
//Release the client world
|
if (this.world != null) {
|
||||||
if (this.refCopy != null) {
|
var engine = ((IVoxyWorldGetter)this.world).getWorldEngine();
|
||||||
var engine = ((IVoxyWorldGetter)this.refCopy).getWorldEngine();
|
|
||||||
if (engine != null) {
|
if (engine != null) {
|
||||||
VoxyCommon.getInstance().stopWorld(engine);
|
VoxyCommon.getInstance().stopWorld(engine);
|
||||||
}
|
}
|
||||||
((IVoxyWorldSetter)this.refCopy).setWorldEngine(null);
|
((IVoxyWorldSetter)this.world).setWorldEngine(null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user