mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-06-24 21:51:24 +00:00
improve CraftWorldInfo creation
This commit is contained in:
@@ -4,6 +4,7 @@ import com.google.common.collect.ImmutableList;
|
||||
import com.mojang.serialization.Lifecycle;
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.core.nms.IMemoryWorld;
|
||||
import com.volmit.iris.util.reflect.Reflect;
|
||||
import com.volmit.iris.util.scheduling.J;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Registry;
|
||||
@@ -104,21 +105,9 @@ public class MemoryWorld implements IMemoryWorld {
|
||||
worldInfo = new CraftWorldInfo(worldData, access, creator.environment(), levelStem.typeHolder().value());
|
||||
} catch (Throwable e) {
|
||||
try {
|
||||
var c = CraftWorldInfo.class.getDeclaredConstructor(
|
||||
ServerLevelData.class,
|
||||
LevelStorageSource.LevelStorageAccess.class,
|
||||
World.Environment.class,
|
||||
DimensionType.class,
|
||||
net.minecraft.world.level.chunk.ChunkGenerator.class,
|
||||
RegistryAccess.Frozen.class);
|
||||
|
||||
worldInfo = c.newInstance(worldData, access, creator.environment(), levelStem.typeHolder().value(), levelStem.generator(), server.registryAccess());
|
||||
} catch (NoSuchMethodException | InvocationTargetException | InstantiationException |
|
||||
IllegalAccessException ex) {
|
||||
var constructors = Arrays.stream(CraftWorldInfo.class.getDeclaredConstructors())
|
||||
.map(Constructor::toGenericString)
|
||||
.collect(Collectors.joining("\n"));
|
||||
throw new IOException("Failed to find CraftWorldInfo constructor found: " + constructors, ex);
|
||||
worldInfo = Reflect.newInstance(CraftWorldInfo.class, worldData, access, creator.environment(), levelStem.typeHolder().value(), levelStem.generator(), server.registryAccess());
|
||||
} catch (NoSuchMethodException | InvocationTargetException ex) {
|
||||
throw new IOException("Failed to create CraftWorldInfo", ex);
|
||||
}
|
||||
}
|
||||
if (biomeProvider == null && generator != null) {
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.google.common.collect.ImmutableList;
|
||||
import com.mojang.serialization.Lifecycle;
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.core.nms.IMemoryWorld;
|
||||
import com.volmit.iris.util.reflect.Reflect;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.RegistryAccess;
|
||||
import net.minecraft.core.registries.Registries;
|
||||
@@ -110,21 +111,9 @@ public class MemoryWorld implements IMemoryWorld {
|
||||
worldInfo = new CraftWorldInfo(worldData, access, creator.environment(), levelStem.type().value());
|
||||
} catch (Throwable e) {
|
||||
try {
|
||||
var c = CraftWorldInfo.class.getDeclaredConstructor(
|
||||
ServerLevelData.class,
|
||||
LevelStorageSource.LevelStorageAccess.class,
|
||||
World.Environment.class,
|
||||
DimensionType.class,
|
||||
net.minecraft.world.level.chunk.ChunkGenerator.class,
|
||||
RegistryAccess.Frozen.class);
|
||||
|
||||
worldInfo = c.newInstance(worldData, access, creator.environment(), levelStem.type().value(), levelStem.generator(), server.registryAccess());
|
||||
} catch (NoSuchMethodException | InvocationTargetException | InstantiationException |
|
||||
IllegalAccessException ex) {
|
||||
var constructors = Arrays.stream(CraftWorldInfo.class.getDeclaredConstructors())
|
||||
.map(Constructor::toGenericString)
|
||||
.collect(Collectors.joining("\n"));
|
||||
throw new IOException("Failed to find CraftWorldInfo constructor found: " + constructors, ex);
|
||||
worldInfo = Reflect.newInstance(CraftWorldInfo.class, worldData, access, creator.environment(), levelStem.type().value(), levelStem.generator(), server.registryAccess());
|
||||
} catch (NoSuchMethodException | InvocationTargetException ex) {
|
||||
throw new IOException("Failed to create CraftWorldInfo", ex);
|
||||
}
|
||||
}
|
||||
if (biomeProvider == null && generator != null) {
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.google.common.collect.ImmutableList;
|
||||
import com.mojang.serialization.Lifecycle;
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.core.nms.IMemoryWorld;
|
||||
import com.volmit.iris.util.reflect.Reflect;
|
||||
import com.volmit.iris.util.scheduling.J;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.RegistryAccess;
|
||||
@@ -112,21 +113,9 @@ public class MemoryWorld implements IMemoryWorld {
|
||||
worldInfo = new CraftWorldInfo(worldData, access, creator.environment(), levelStem.type().value());
|
||||
} catch (Throwable e) {
|
||||
try {
|
||||
var c = CraftWorldInfo.class.getDeclaredConstructor(
|
||||
ServerLevelData.class,
|
||||
LevelStorageSource.LevelStorageAccess.class,
|
||||
World.Environment.class,
|
||||
DimensionType.class,
|
||||
net.minecraft.world.level.chunk.ChunkGenerator.class,
|
||||
RegistryAccess.Frozen.class);
|
||||
|
||||
worldInfo = c.newInstance(worldData, access, creator.environment(), levelStem.type().value(), levelStem.generator(), server.registryAccess());
|
||||
} catch (NoSuchMethodException | InvocationTargetException | InstantiationException |
|
||||
IllegalAccessException ex) {
|
||||
var constructors = Arrays.stream(CraftWorldInfo.class.getDeclaredConstructors())
|
||||
.map(Constructor::toGenericString)
|
||||
.collect(Collectors.joining("\n"));
|
||||
throw new IOException("Failed to find CraftWorldInfo constructor found: " + constructors, ex);
|
||||
worldInfo = Reflect.newInstance(CraftWorldInfo.class, worldData, access, creator.environment(), levelStem.type().value(), levelStem.generator(), server.registryAccess());
|
||||
} catch (NoSuchMethodException | InvocationTargetException ex) {
|
||||
throw new IOException("Failed to create CraftWorldInfo", ex);
|
||||
}
|
||||
}
|
||||
if (biomeProvider == null && generator != null) {
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.google.common.collect.ImmutableList;
|
||||
import com.mojang.serialization.Lifecycle;
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.core.nms.IMemoryWorld;
|
||||
import com.volmit.iris.util.reflect.Reflect;
|
||||
import com.volmit.iris.util.scheduling.J;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.RegistryAccess;
|
||||
@@ -113,22 +114,9 @@ public class MemoryWorld implements IMemoryWorld {
|
||||
worldInfo = new CraftWorldInfo(worldData, access, creator.environment(), levelStem.type().value());
|
||||
} catch (Throwable e) {
|
||||
try {
|
||||
var c = CraftWorldInfo.class.getDeclaredConstructor(
|
||||
ServerLevelData.class,
|
||||
LevelStorageSource.LevelStorageAccess.class,
|
||||
World.Environment.class,
|
||||
DimensionType.class,
|
||||
net.minecraft.world.level.chunk.ChunkGenerator.class,
|
||||
RegistryAccess.Frozen.class);
|
||||
|
||||
worldInfo = c.newInstance(worldData, access, creator.environment(), levelStem.type().value(), levelStem.generator(), server.registryAccess());
|
||||
} catch (NoSuchMethodException | InvocationTargetException | InstantiationException |
|
||||
IllegalAccessException ex) {
|
||||
var constructors = Arrays.stream(CraftWorldInfo.class.getDeclaredConstructors())
|
||||
.map(Constructor::toGenericString)
|
||||
.collect(Collectors.joining("\n"));
|
||||
CraftAttributeInstance
|
||||
throw new IOException("Failed to find CraftWorldInfo constructor found: " + constructors, ex);
|
||||
worldInfo = Reflect.newInstance(CraftWorldInfo.class, worldData, access, creator.environment(), levelStem.type().value(), levelStem.generator(), server.registryAccess());
|
||||
} catch (NoSuchMethodException | InvocationTargetException ex) {
|
||||
throw new IOException("Failed to create CraftWorldInfo", ex);
|
||||
}
|
||||
}
|
||||
if (biomeProvider == null && generator != null) {
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.google.common.collect.ImmutableList;
|
||||
import com.mojang.serialization.Lifecycle;
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.core.nms.IMemoryWorld;
|
||||
import com.volmit.iris.util.reflect.Reflect;
|
||||
import com.volmit.iris.util.scheduling.J;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.RegistryAccess;
|
||||
@@ -112,21 +113,9 @@ public class MemoryWorld implements IMemoryWorld {
|
||||
worldInfo = new CraftWorldInfo(worldData, access, creator.environment(), levelStem.type().value());
|
||||
} catch (Throwable e) {
|
||||
try {
|
||||
var c = CraftWorldInfo.class.getDeclaredConstructor(
|
||||
ServerLevelData.class,
|
||||
LevelStorageSource.LevelStorageAccess.class,
|
||||
World.Environment.class,
|
||||
DimensionType.class,
|
||||
net.minecraft.world.level.chunk.ChunkGenerator.class,
|
||||
RegistryAccess.Frozen.class);
|
||||
|
||||
worldInfo = c.newInstance(worldData, access, creator.environment(), levelStem.type().value(), levelStem.generator(), server.registryAccess());
|
||||
} catch (NoSuchMethodException | InvocationTargetException | InstantiationException |
|
||||
IllegalAccessException ex) {
|
||||
var constructors = Arrays.stream(CraftWorldInfo.class.getDeclaredConstructors())
|
||||
.map(Constructor::toGenericString)
|
||||
.collect(Collectors.joining("\n"));
|
||||
throw new IOException("Failed to find CraftWorldInfo constructor found: " + constructors, ex);
|
||||
worldInfo = Reflect.newInstance(CraftWorldInfo.class, worldData, access, creator.environment(), levelStem.type().value(), levelStem.generator(), server.registryAccess());
|
||||
} catch (NoSuchMethodException | InvocationTargetException ex) {
|
||||
throw new IOException("Failed to create CraftWorldInfo", ex);
|
||||
}
|
||||
}
|
||||
if (biomeProvider == null && generator != null) {
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.google.common.collect.ImmutableList;
|
||||
import com.mojang.serialization.Lifecycle;
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.core.nms.IMemoryWorld;
|
||||
import com.volmit.iris.util.reflect.Reflect;
|
||||
import com.volmit.iris.util.scheduling.J;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.RegistryAccess;
|
||||
@@ -65,6 +66,7 @@ import java.lang.reflect.Field;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.nio.file.Files;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
@@ -116,21 +118,9 @@ public class MemoryWorld implements IMemoryWorld {
|
||||
worldInfo = new CraftWorldInfo(worldData, access, creator.environment(), levelStem.type().value());
|
||||
} catch (Throwable e) {
|
||||
try {
|
||||
var c = CraftWorldInfo.class.getDeclaredConstructor(
|
||||
ServerLevelData.class,
|
||||
LevelStorageSource.LevelStorageAccess.class,
|
||||
World.Environment.class,
|
||||
DimensionType.class,
|
||||
net.minecraft.world.level.chunk.ChunkGenerator.class,
|
||||
RegistryAccess.Frozen.class);
|
||||
|
||||
worldInfo = c.newInstance(worldData, access, creator.environment(), levelStem.type().value(), levelStem.generator(), server.registryAccess());
|
||||
} catch (NoSuchMethodException | InvocationTargetException | InstantiationException |
|
||||
IllegalAccessException ex) {
|
||||
var constructors = Arrays.stream(CraftWorldInfo.class.getDeclaredConstructors())
|
||||
.map(Constructor::toGenericString)
|
||||
.collect(Collectors.joining("\n"));
|
||||
throw new IOException("Failed to find CraftWorldInfo constructor found: " + constructors, ex);
|
||||
worldInfo = Reflect.newInstance(CraftWorldInfo.class, worldData, access, creator.environment(), levelStem.type().value(), levelStem.generator(), server.registryAccess());
|
||||
} catch (NoSuchMethodException | InvocationTargetException ex) {
|
||||
throw new IOException("Failed to create CraftWorldInfo", ex);
|
||||
}
|
||||
}
|
||||
if (biomeProvider == null && generator != null) {
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.google.common.collect.ImmutableList;
|
||||
import com.mojang.serialization.Lifecycle;
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.core.nms.IMemoryWorld;
|
||||
import com.volmit.iris.util.reflect.Reflect;
|
||||
import com.volmit.iris.util.scheduling.J;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.RegistryAccess;
|
||||
@@ -114,21 +115,9 @@ public class MemoryWorld implements IMemoryWorld {
|
||||
worldInfo = new CraftWorldInfo(worldData, access, creator.environment(), levelStem.type().value());
|
||||
} catch (Throwable e) {
|
||||
try {
|
||||
var c = CraftWorldInfo.class.getDeclaredConstructor(
|
||||
ServerLevelData.class,
|
||||
LevelStorageSource.LevelStorageAccess.class,
|
||||
World.Environment.class,
|
||||
DimensionType.class,
|
||||
net.minecraft.world.level.chunk.ChunkGenerator.class,
|
||||
RegistryAccess.Frozen.class);
|
||||
|
||||
worldInfo = c.newInstance(worldData, access, creator.environment(), levelStem.type().value(), levelStem.generator(), server.registryAccess());
|
||||
} catch (NoSuchMethodException | InvocationTargetException | InstantiationException |
|
||||
IllegalAccessException ex) {
|
||||
var constructors = Arrays.stream(CraftWorldInfo.class.getDeclaredConstructors())
|
||||
.map(Constructor::toGenericString)
|
||||
.collect(Collectors.joining("\n"));
|
||||
throw new IOException("Failed to find CraftWorldInfo constructor found: " + constructors, ex);
|
||||
worldInfo = Reflect.newInstance(CraftWorldInfo.class, worldData, access, creator.environment(), levelStem.type().value(), levelStem.generator(), server.registryAccess());
|
||||
} catch (NoSuchMethodException | InvocationTargetException ex) {
|
||||
throw new IOException("Failed to create CraftWorldInfo", ex);
|
||||
}
|
||||
}
|
||||
if (biomeProvider == null && generator != null) {
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.google.common.collect.ImmutableList;
|
||||
import com.mojang.serialization.Lifecycle;
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.core.nms.IMemoryWorld;
|
||||
import com.volmit.iris.util.reflect.Reflect;
|
||||
import com.volmit.iris.util.scheduling.J;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.RegistryAccess;
|
||||
@@ -115,21 +116,9 @@ public class MemoryWorld implements IMemoryWorld {
|
||||
worldInfo = new CraftWorldInfo(worldData, access, creator.environment(), levelStem.type().value());
|
||||
} catch (Throwable e) {
|
||||
try {
|
||||
var c = CraftWorldInfo.class.getDeclaredConstructor(
|
||||
ServerLevelData.class,
|
||||
LevelStorageSource.LevelStorageAccess.class,
|
||||
World.Environment.class,
|
||||
DimensionType.class,
|
||||
net.minecraft.world.level.chunk.ChunkGenerator.class,
|
||||
RegistryAccess.Frozen.class);
|
||||
|
||||
worldInfo = c.newInstance(worldData, access, creator.environment(), levelStem.type().value(), levelStem.generator(), server.registryAccess());
|
||||
} catch (NoSuchMethodException | InvocationTargetException | InstantiationException |
|
||||
IllegalAccessException ex) {
|
||||
var constructors = Arrays.stream(CraftWorldInfo.class.getDeclaredConstructors())
|
||||
.map(Constructor::toGenericString)
|
||||
.collect(Collectors.joining("\n"));
|
||||
throw new IOException("Failed to find CraftWorldInfo constructor found: " + constructors, ex);
|
||||
worldInfo = Reflect.newInstance(CraftWorldInfo.class, worldData, access, creator.environment(), levelStem.type().value(), levelStem.generator(), server.registryAccess());
|
||||
} catch (NoSuchMethodException | InvocationTargetException ex) {
|
||||
throw new IOException("Failed to create CraftWorldInfo", ex);
|
||||
}
|
||||
}
|
||||
if (biomeProvider == null && generator != null) {
|
||||
|
||||
Reference in New Issue
Block a user