Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import net.minecraft.registry.RegistryKey;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.registry.RegistryWrapper;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.ChunkRegion;
Expand Down Expand Up @@ -32,9 +33,12 @@ public GameChunkGenerator(MinecraftServer server) {
this(createBiomeSource(server, BiomeKeys.THE_VOID));
}

protected static FixedBiomeSource createBiomeSource(RegistryWrapper.WrapperLookup registries, RegistryKey<Biome> biome) {
return new FixedBiomeSource(registries.getOrThrow(RegistryKeys.BIOME).getOrThrow(biome));
}

protected static FixedBiomeSource createBiomeSource(MinecraftServer server, RegistryKey<Biome> biome) {
var registryManager = server.getRegistryManager();
return new FixedBiomeSource(registryManager.getOrThrow(RegistryKeys.BIOME).getOrThrow(biome));
return createBiomeSource(server.getRegistryManager(), biome);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import net.minecraft.block.BlockState;
import net.minecraft.registry.DynamicRegistryManager;
import net.minecraft.registry.RegistryKey;
import net.minecraft.registry.RegistryWrapper;
import net.minecraft.server.MinecraftServer;
import net.minecraft.structure.StructureTemplateManager;
import net.minecraft.util.math.BlockPos;
Expand Down Expand Up @@ -30,13 +31,17 @@ public class TemplateChunkGenerator extends GameChunkGenerator {
private final MapTemplate template;
private final BlockBounds worldBounds;

public TemplateChunkGenerator(MinecraftServer server, MapTemplate template) {
super(createBiomeSource(server, template.getBiome()));
public TemplateChunkGenerator(RegistryWrapper.WrapperLookup registries, MapTemplate template) {
super(createBiomeSource(registries, template.getBiome()));

this.template = template;
this.worldBounds = template.getBounds();
}

public TemplateChunkGenerator(MinecraftServer server, MapTemplate template) {
this(server.getRegistryManager(), template);
}

@Override
public void setStructureStarts(DynamicRegistryManager registryManager, StructurePlacementCalculator placementCalculator, StructureAccessor structureAccessor, Chunk chunk, StructureTemplateManager structureTemplateManager, RegistryKey<World> dimension) {
}
Expand Down