mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-06-17 14:21:08 +00:00
dynamically fetch pack in ServerWorldMixin
This commit is contained in:
+1
-17
@@ -58,7 +58,6 @@ import com.dfsek.terra.fabric.util.FabricUtil;
|
|||||||
@Mixin(net.minecraft.server.world.ServerWorld.class)
|
@Mixin(net.minecraft.server.world.ServerWorld.class)
|
||||||
@Implements(@Interface(iface = ServerWorld.class, prefix = "terra$", remap = Interface.Remap.NONE))
|
@Implements(@Interface(iface = ServerWorld.class, prefix = "terra$", remap = Interface.Remap.NONE))
|
||||||
public abstract class ServerWorldMixin {
|
public abstract class ServerWorldMixin {
|
||||||
private ConfigPack config;
|
|
||||||
@Shadow
|
@Shadow
|
||||||
@Final
|
@Final
|
||||||
private ServerChunkManager chunkManager;
|
private ServerChunkManager chunkManager;
|
||||||
@@ -66,21 +65,6 @@ public abstract class ServerWorldMixin {
|
|||||||
@Shadow
|
@Shadow
|
||||||
public abstract long getSeed();
|
public abstract long getSeed();
|
||||||
|
|
||||||
@Inject(at = @At("RETURN"),
|
|
||||||
method = "<init>(Lnet/minecraft/server/MinecraftServer;Ljava/util/concurrent/Executor;" +
|
|
||||||
"Lnet/minecraft/world/level/storage/LevelStorage$Session;Lnet/minecraft/world/level/ServerWorldProperties;" +
|
|
||||||
"Lnet/minecraft/util/registry/RegistryKey;Lnet/minecraft/world/dimension/DimensionType;" +
|
|
||||||
"Lnet/minecraft/server/WorldGenerationProgressListener;Lnet/minecraft/world/gen/chunk/ChunkGenerator;" +
|
|
||||||
"ZJLjava/util/List;Z)V")
|
|
||||||
public void injectConstructor(MinecraftServer server, Executor workerExecutor, LevelStorage.Session session,
|
|
||||||
ServerWorldProperties properties, RegistryKey<net.minecraft.world.World> worldKey,
|
|
||||||
DimensionType dimensionType, WorldGenerationProgressListener worldGenerationProgressListener,
|
|
||||||
net.minecraft.world.gen.chunk.ChunkGenerator chunkGenerator, boolean debugWorld, long seed,
|
|
||||||
List<Spawner> spawners, boolean shouldTickTime, CallbackInfo ci) {
|
|
||||||
if(chunkGenerator instanceof FabricChunkGeneratorWrapper) {
|
|
||||||
config = ((FabricChunkGeneratorWrapper) chunkGenerator).getPack();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public Entity terra$spawnEntity(Vector3 location, EntityType entityType) {
|
public Entity terra$spawnEntity(Vector3 location, EntityType entityType) {
|
||||||
net.minecraft.entity.Entity entity = ((net.minecraft.entity.EntityType<?>) entityType).create(
|
net.minecraft.entity.Entity entity = ((net.minecraft.entity.EntityType<?>) entityType).create(
|
||||||
@@ -133,6 +117,6 @@ public abstract class ServerWorldMixin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ConfigPack terra$getPack() {
|
public ConfigPack terra$getPack() {
|
||||||
return config;
|
return ((FabricChunkGeneratorWrapper) chunkManager.getChunkGenerator()).getPack();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user