[Fix] Crash when Spawn-Point was changed (#23)

This commit is contained in:
Frank 2022-07-01 00:59:28 +02:00
parent cda391ac07
commit 41d3fc8e17

View file

@ -17,9 +17,11 @@ public class LevelMixin {
@Inject(method = "getSharedSpawnPos", at = @At("HEAD"), cancellable = true)
private void be_getSharedSpawnPos(CallbackInfoReturnable<BlockPos> info) {
if (GeneratorOptions.changeSpawn()) {
if (ServerLevel.class.cast(this).dimension() == Level.END) {
BlockPos pos = GeneratorOptions.getSpawn();
info.setReturnValue(pos);
if ((Object) this instanceof ServerLevel server) {
if (server.dimension() == Level.END) {
BlockPos pos = GeneratorOptions.getSpawn();
info.setReturnValue(pos);
}
}
}
}