Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ported to 1.21.2 #58

Open
wants to merge 1 commit into
base: 1.22
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ jar {
}

loom {
accessWidenerPath = file("src/main/resources/${modId}.accesswidener")
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unneccesary

accessWidenerPath = file("src/main/resources/surveyor.accesswidener")
}

publishing {
Expand Down
8 changes: 4 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ authors=Sisby folk
contributors=Ampflower, falkreon, jaskarth, Garden System
license=LGPL-3.0-or-later
# Mod Version
baseVersion=0.6.25
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unneccesary

baseVersion=0.6.26
# Branch Metadata
branch=1.21
tagBranch=1.20
compatibleVersions=1.21, 1.21.1
branch=1.21.2
tagBranch=1.21.2
compatibleVersions=1.21.2
compatibleLoaders=fabric, quilt, neoforge
8 changes: 4 additions & 4 deletions libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ minotaur = "2.+"

kaleidoConfig = "0.3.1+1.3.2"

mc = "1.21.1"
fl = "0.15.11"
yarn = "1.21.1+build.3"
fapi = "0.104.0+1.21.1"
mc = "1.21.2"
fl = "0.16.7"
yarn = "1.21.2+build.1"
fapi = "0.106.1+1.21.2"

[plugins]
loom = { id = "fabric-loom", version.ref = "loom" }
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/folk/sisby/surveyor/Surveyor.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public static void checkStructureExploration(ServerWorld world, ServerPlayerEnti
if (!world.isChunkLoaded(pos.getX() >> 4, pos.getZ() >> 4)) return;
WorldStructureSummary worldStructures = WorldSummary.of(world).structures();
if (worldStructures == null) return;
Registry<Structure> structureRegistry = world.getRegistryManager().get(RegistryKeys.STRUCTURE);
Registry<Structure> structureRegistry = world.getRegistryManager().getOrThrow(RegistryKeys.STRUCTURE);
SurveyorExploration exploration = SurveyorExploration.of(player);
Map<Structure, LongSet> structureReferences = world.getChunk(pos.getX() >> 4, pos.getZ() >> 4, ChunkStatus.STRUCTURE_REFERENCES).getStructureReferences();
if (!structureReferences.isEmpty()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,17 @@
import folk.sisby.surveyor.Surveyor;
import net.minecraft.network.PacketByteBuf;
import net.minecraft.network.codec.PacketCodec;
import net.minecraft.network.packet.CustomPayload;
import net.minecraft.registry.RegistryKey;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.ChunkPos;
import net.minecraft.world.gen.structure.Structure;

public record C2SKnownStructuresPacket(Multimap<RegistryKey<Structure>, ChunkPos> structureKeys) implements C2SPacket {
public static final CustomPayload.Id<C2SKnownStructuresPacket> ID = new CustomPayload.Id<>(Identifier.of(Surveyor.ID, "c2s_known_structures"));
public static final Id<C2SKnownStructuresPacket> ID = new Id<>(Identifier.of(Surveyor.ID, "c2s_known_structures"));
public static final PacketCodec<PacketByteBuf, C2SKnownStructuresPacket> CODEC = SurveyorPacketCodecs.STRUCTURE_KEYS.xmap(C2SKnownStructuresPacket::new, C2SKnownStructuresPacket::structureKeys);

@Override
public CustomPayload.Id<C2SKnownStructuresPacket> getId() {
public Id<C2SKnownStructuresPacket> getId() {
return ID;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,18 @@
import folk.sisby.surveyor.Surveyor;
import net.minecraft.network.PacketByteBuf;
import net.minecraft.network.codec.PacketCodec;
import net.minecraft.network.packet.CustomPayload;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.ChunkPos;

import java.util.BitSet;
import java.util.Map;

public record C2SKnownTerrainPacket(Map<ChunkPos, BitSet> regionBits) implements C2SPacket {
public static final CustomPayload.Id<C2SKnownTerrainPacket> ID = new CustomPayload.Id<>(Identifier.of(Surveyor.ID, "known_terrain"));
public static final Id<C2SKnownTerrainPacket> ID = new Id<>(Identifier.of(Surveyor.ID, "known_terrain"));
public static final PacketCodec<PacketByteBuf, C2SKnownTerrainPacket> CODEC = SurveyorPacketCodecs.TERRAIN_KEYS.xmap(C2SKnownTerrainPacket::new, C2SKnownTerrainPacket::regionBits);

@Override
public CustomPayload.Id<C2SKnownTerrainPacket> getId() {
public Id<C2SKnownTerrainPacket> getId() {
return ID;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import it.unimi.dsi.fastutil.longs.LongSet;
import net.minecraft.network.RegistryByteBuf;
import net.minecraft.network.codec.PacketCodec;
import net.minecraft.network.packet.CustomPayload;
import net.minecraft.registry.RegistryKey;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.ChunkPos;
Expand All @@ -16,7 +15,7 @@
import java.util.UUID;

public record S2CGroupChangedPacket(Map<UUID, PlayerSummary> players, Map<ChunkPos, BitSet> regionBits, Map<RegistryKey<Structure>, LongSet> structureKeys) implements S2CPacket {
public static final CustomPayload.Id<S2CGroupChangedPacket> ID = new CustomPayload.Id<>(Identifier.of(Surveyor.ID, "s2c_group_changed"));
public static final Id<S2CGroupChangedPacket> ID = new Id<>(Identifier.of(Surveyor.ID, "s2c_group_changed"));
public static final PacketCodec<RegistryByteBuf, S2CGroupChangedPacket> CODEC = PacketCodec.tuple(
SurveyorPacketCodecs.GROUP_SUMMARIES, S2CGroupChangedPacket::players,
SurveyorPacketCodecs.TERRAIN_KEYS, S2CGroupChangedPacket::regionBits,
Expand All @@ -25,7 +24,7 @@ public record S2CGroupChangedPacket(Map<UUID, PlayerSummary> players, Map<ChunkP
);

@Override
public CustomPayload.Id<S2CGroupChangedPacket> getId() {
public Id<S2CGroupChangedPacket> getId() {
return ID;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,13 @@
import folk.sisby.surveyor.Surveyor;
import net.minecraft.network.RegistryByteBuf;
import net.minecraft.network.codec.PacketCodec;
import net.minecraft.network.packet.CustomPayload;
import net.minecraft.util.Identifier;

import java.util.Map;
import java.util.UUID;

public record S2CGroupUpdatedPacket(Map<UUID, PlayerSummary> players) implements S2CPacket {
public static final CustomPayload.Id<S2CGroupUpdatedPacket> ID = new CustomPayload.Id<>(Identifier.of(Surveyor.ID, "s2c_group_updated"));
public static final Id<S2CGroupUpdatedPacket> ID = new Id<>(Identifier.of(Surveyor.ID, "s2c_group_updated"));
public static final PacketCodec<RegistryByteBuf, S2CGroupUpdatedPacket> CODEC = SurveyorPacketCodecs.GROUP_SUMMARIES.xmap(S2CGroupUpdatedPacket::new, S2CGroupUpdatedPacket::players);

public static S2CGroupUpdatedPacket of(UUID uuid, PlayerSummary summary) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import net.minecraft.network.PacketByteBuf;
import net.minecraft.network.codec.PacketCodec;
import net.minecraft.network.codec.PacketCodecs;
import net.minecraft.network.packet.CustomPayload;
import net.minecraft.registry.RegistryKey;
import net.minecraft.registry.tag.TagKey;
import net.minecraft.util.Identifier;
Expand All @@ -23,7 +22,7 @@
import java.util.Map;

public record S2CStructuresAddedPacket(boolean shared, Map<RegistryKey<Structure>, Map<ChunkPos, StructureStartSummary>> structures, Map<RegistryKey<Structure>, RegistryKey<StructureType<?>>> types, Multimap<RegistryKey<Structure>, TagKey<Structure>> tags) implements S2CPacket {
public static final CustomPayload.Id<S2CStructuresAddedPacket> ID = new CustomPayload.Id<>(Identifier.of(Surveyor.ID, "s2c_structures_added"));
public static final Id<S2CStructuresAddedPacket> ID = new Id<>(Identifier.of(Surveyor.ID, "s2c_structures_added"));
public static final PacketCodec<PacketByteBuf, S2CStructuresAddedPacket> CODEC = PacketCodec.tuple(
PacketCodecs.BOOL, S2CStructuresAddedPacket::shared,
SurveyorPacketCodecs.STRUCTURE_SUMMARIES, S2CStructuresAddedPacket::structures,
Expand Down Expand Up @@ -69,7 +68,7 @@ public List<SurveyorPacket> toPayloads() {
}

@Override
public CustomPayload.Id<S2CStructuresAddedPacket> getId() {
public Id<S2CStructuresAddedPacket> getId() {
return ID;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import net.minecraft.network.PacketByteBuf;
import net.minecraft.network.codec.PacketCodec;
import net.minecraft.network.codec.PacketCodecs;
import net.minecraft.network.packet.CustomPayload;
import net.minecraft.util.Identifier;
import net.minecraft.util.dynamic.Codecs;
import net.minecraft.util.math.ChunkPos;
Expand All @@ -19,7 +18,7 @@
import java.util.List;

public record S2CUpdateRegionPacket(boolean shared, ChunkPos regionPos, List<Integer> biomePalette, List<Integer> blockPalette, BitSet set, List<ChunkSummary> chunks) implements S2CPacket {
public static final CustomPayload.Id<S2CUpdateRegionPacket> ID = new CustomPayload.Id<>(Identifier.of(Surveyor.ID, "s2c_update_region"));
public static final Id<S2CUpdateRegionPacket> ID = new Id<>(Identifier.of(Surveyor.ID, "s2c_update_region"));
public static final PacketCodec<PacketByteBuf, S2CUpdateRegionPacket> CODEC = PacketCodec.tuple(
PacketCodecs.BOOL, S2CUpdateRegionPacket::shared,
PacketCodecs.VAR_LONG.xmap(ChunkPos::new, ChunkPos::toLong), S2CUpdateRegionPacket::regionPos,
Expand Down Expand Up @@ -55,7 +54,7 @@ public List<SurveyorPacket> toPayloads() {
}

@Override
public CustomPayload.Id<S2CUpdateRegionPacket> getId() {
public Id<S2CUpdateRegionPacket> getId() {
return ID;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import io.netty.buffer.Unpooled;
import net.minecraft.network.PacketByteBuf;
import net.minecraft.network.codec.PacketCodec;
import net.minecraft.network.packet.CustomPayload;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.BlockPos;

Expand All @@ -20,7 +19,7 @@
import java.util.Map;

public record SyncLandmarksAddedPacket(Map<LandmarkType<?>, Map<BlockPos, Landmark<?>>> landmarks) implements SyncPacket {
public static final CustomPayload.Id<SyncLandmarksAddedPacket> ID = new CustomPayload.Id<>(Identifier.of(Surveyor.ID, "landmarks_added"));
public static final Id<SyncLandmarksAddedPacket> ID = new Id<>(Identifier.of(Surveyor.ID, "landmarks_added"));
public static final PacketCodec<ByteBuf, SyncLandmarksAddedPacket> CODEC = SurveyorPacketCodecs.LANDMARK_SUMMARIES.xmap(SyncLandmarksAddedPacket::new, SyncLandmarksAddedPacket::landmarks);

public static SyncLandmarksAddedPacket of(Multimap<LandmarkType<?>, BlockPos> keySet, WorldLandmarks summary) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import net.minecraft.network.RegistryByteBuf;
import net.minecraft.network.codec.PacketCodec;
import net.minecraft.network.codec.PacketCodecs;
import net.minecraft.network.packet.CustomPayload;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.BlockPos;

Expand All @@ -16,7 +15,7 @@
import java.util.Map;

public record SyncLandmarksRemovedPacket(Multimap<LandmarkType<?>, BlockPos> landmarks) implements SyncPacket {
public static final CustomPayload.Id<SyncLandmarksRemovedPacket> ID = new CustomPayload.Id<>(Identifier.of(Surveyor.ID, "landmarks_removed"));
public static final Id<SyncLandmarksRemovedPacket> ID = new Id<>(Identifier.of(Surveyor.ID, "landmarks_removed"));
public static final PacketCodec<RegistryByteBuf, SyncLandmarksRemovedPacket> CODEC = PacketCodecs.<RegistryByteBuf, LandmarkType<?>, List<BlockPos>, Map<LandmarkType<?>, List<BlockPos>>>map(HashMap::new, PacketCodecs.codec(LandmarkType.CODEC), BlockPos.PACKET_CODEC.collect(PacketCodecs.toList()))
.xmap(MapUtil::asMultiMap, MapUtil::asListMap)
.xmap(SyncLandmarksRemovedPacket::new, SyncLandmarksRemovedPacket::landmarks);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ protected static RegionStructureSummary readNbt(NbtCompound nbt) {
}

public boolean contains(World world, StructureStart start) {
RegistryKey<Structure> key = world.getRegistryManager().get(RegistryKeys.STRUCTURE).getKey(start.getStructure()).orElse(null);
RegistryKey<Structure> key = world.getRegistryManager().getOrThrow(RegistryKeys.STRUCTURE).getKey(start.getStructure()).orElse(null);
if (key == null) {
Surveyor.LOGGER.error("Encountered an unregistered structure! {} | {}", start, start.getStructure());
return true;
Expand All @@ -103,7 +103,7 @@ public Multimap<RegistryKey<Structure>, ChunkPos> keySet() {
}

public void put(ServerWorld world, StructureStart start) {
RegistryKey<Structure> key = world.getRegistryManager().get(RegistryKeys.STRUCTURE).getKey(start.getStructure()).orElseThrow();
RegistryKey<Structure> key = world.getRegistryManager().getOrThrow(RegistryKeys.STRUCTURE).getKey(start.getStructure()).orElseThrow();
structures.computeIfAbsent(key, k -> new ConcurrentHashMap<>());
ChunkPos pos = start.getPos();
StructureStartSummary summary = summarisePieces(StructureContext.from(world), start);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,7 @@
import folk.sisby.surveyor.terrain.RegionSummary;
import folk.sisby.surveyor.util.ChunkUtil;
import folk.sisby.surveyor.util.MapUtil;
import net.minecraft.nbt.NbtCompound;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ignoring editorconfig here, you need to fix your IDE setup.

import net.minecraft.nbt.NbtElement;
import net.minecraft.nbt.NbtIo;
import net.minecraft.nbt.NbtList;
import net.minecraft.nbt.NbtSizeTracker;
import net.minecraft.nbt.NbtString;
import net.minecraft.nbt.*;
import net.minecraft.registry.Registries;
import net.minecraft.registry.RegistryKey;
import net.minecraft.registry.RegistryKeys;
Expand All @@ -34,12 +29,7 @@

import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;

public class WorldStructureSummary {
Expand Down Expand Up @@ -164,8 +154,8 @@ public Multimap<RegistryKey<Structure>, ChunkPos> keySet(SurveyorExploration exp
public void put(ServerWorld world, StructureStart start) {
if (Surveyor.CONFIG.structures == SystemMode.FROZEN) return;
ChunkPos rPos = regionPosOf(start.getPos());
RegistryKey<Structure> key = world.getRegistryManager().get(RegistryKeys.STRUCTURE).getKey(start.getStructure()).orElseThrow();
Optional<RegistryKey<StructureType<?>>> type = world.getRegistryManager().get(RegistryKeys.STRUCTURE_TYPE).getKey(start.getStructure().getType());
RegistryKey<Structure> key = world.getRegistryManager().getOrThrow(RegistryKeys.STRUCTURE).getKey(start.getStructure()).orElseThrow();
Optional<RegistryKey<StructureType<?>>> type = world.getRegistryManager().getOrThrow(RegistryKeys.STRUCTURE_TYPE).getKey(start.getStructure().getType());
if (!start.hasChildren()) {
Surveyor.LOGGER.error("Cowardly refusing to save structure {} as it has no pieces! Report this to the structure mod author!", key.getValue());
return;
Expand All @@ -175,7 +165,7 @@ public void put(ServerWorld world, StructureStart start) {
return;
}
regions.computeIfAbsent(rPos, k -> new RegionStructureSummary()).put(world, start);
List<TagKey<Structure>> tags = world.getRegistryManager().get(RegistryKeys.STRUCTURE).getEntry(start.getStructure()).streamTags().toList();
List<TagKey<Structure>> tags = world.getRegistryManager().getOrThrow(RegistryKeys.STRUCTURE).getEntry(start.getStructure()).streamTags().toList();
structureTypes.put(key, type.orElseThrow());
structureTags.putAll(key, tags);
dirty();
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/folk/sisby/surveyor/terrain/ChunkSummary.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public ChunkSummary(World world, WorldChunk chunk, int[] layerHeights, RegistryP
BlockState state = section.getBlockState(x, y, z);
Fluid fluid = state.getFluidState().getFluid();

if (!state.blocksMovement() && fluid.matchesType(Fluids.EMPTY)) {
if (!state.isSolidBlock(world, pos) && fluid.matchesType(Fluids.EMPTY)) {
walkspaceHeight++;
waterDepth = 0;
if (walkspaceHeight >= MINIMUM_AIR_DEPTH && state.getMapColor(world, pos) != MapColor.CLEAR) {
Expand All @@ -76,7 +76,7 @@ public ChunkSummary(World world, WorldChunk chunk, int[] layerHeights, RegistryP
} else { // Blocks Movement or Has Non-Water Fluid.
if (foundFloor == null) {
if (carpetPos.getY() == y + 1) {
foundFloor = new LayerSummary.FloorSummary(carpetPos.getY(), biomePalette.findOrAdd(section.getBiomeEntry(x, carpetPos.getY(), z, world.getBottomY(), world.getTopY()).value()), blockPalette.findOrAdd(carpetBlock), world.getLightLevel(LightType.BLOCK, carpetPos), waterDepth, waterDepth == 0 ? 0 : world.getLightLevel(LightType.BLOCK, pos.up().up(waterDepth)));
foundFloor = new LayerSummary.FloorSummary(carpetPos.getY(), biomePalette.findOrAdd(section.getBiomeEntry(x, carpetPos.getY(), z, world.getBottomY(), world.getTopYInclusive()).value()), blockPalette.findOrAdd(carpetBlock), world.getLightLevel(LightType.BLOCK, carpetPos), waterDepth, waterDepth == 0 ? 0 : world.getLightLevel(LightType.BLOCK, pos.up().up(waterDepth)));
if (carpetPos.getY() > layerHeights[layerIndex]) { // Actually a floor for the layer above
if (layerFloors[layerIndex - 1][x * 16 + z] == null) layerFloors[layerIndex - 1][x * 16 + z] = foundFloor;
foundFloor = null;
Expand All @@ -85,7 +85,7 @@ public ChunkSummary(World world, WorldChunk chunk, int[] layerHeights, RegistryP
walkspaceHeight = 0;
waterDepth = 0;
} else if (walkspaceHeight >= MINIMUM_AIR_DEPTH && state.getMapColor(world, pos) != MapColor.CLEAR) {
foundFloor = new LayerSummary.FloorSummary(y, biomePalette.findOrAdd(section.getBiomeEntry(x, y, z, world.getBottomY(), world.getTopY()).value()), blockPalette.findOrAdd(state.getBlock()), world.getLightLevel(LightType.BLOCK, pos.up()), waterDepth, waterDepth == 0 ? 0 : world.getLightLevel(LightType.BLOCK, pos.up().up(waterDepth)));
foundFloor = new LayerSummary.FloorSummary(y, biomePalette.findOrAdd(section.getBiomeEntry(x, y, z, world.getBottomY(), world.getTopYInclusive()).value()), blockPalette.findOrAdd(state.getBlock()), world.getLightLevel(LightType.BLOCK, pos.up()), waterDepth, waterDepth == 0 ? 0 : world.getLightLevel(LightType.BLOCK, pos.up().up(waterDepth)));
}
}
if (state.getMapColor(world, pos) != MapColor.CLEAR) { // Don't reset walkspace for glass/barriers/etc.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public void writeBuf(PacketByteBuf buf) {
UInts.writeBuf(glint, buf);
}

public void fillEmptyFloors(int depthOffset, int minDepth, int maxDepth, LayerSummary.Raw outLayer) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unneccessary and confusing

public void fillEmptyFloors(int depthOffset, int minDepth, int maxDepth, Raw outLayer) {
int i = 0;
for (int j = 0; j < 256; j++) {
if (found.get(j)) {
Expand Down
12 changes: 6 additions & 6 deletions src/main/java/folk/sisby/surveyor/terrain/RegionSummary.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ public class RegionSummary {
protected boolean dirty = false;

public RegionSummary(DynamicRegistryManager manager) {
biomePalette = new RegistryPalette<>(manager.get(RegistryKeys.BIOME));
blockPalette = new RegistryPalette<>(manager.get(RegistryKeys.BLOCK));
biomePalette = new RegistryPalette<>(manager.getOrThrow(RegistryKeys.BIOME));
blockPalette = new RegistryPalette<>(manager.getOrThrow(RegistryKeys.BLOCK));
}

public static <T, O> List<O> mapIterable(Iterable<T> palette, Function<T, O> mapper) {
Expand Down Expand Up @@ -93,8 +93,8 @@ public static ChunkPos chunkForBit(ChunkPos rPos, int i) {

public static RegionSummary readNbt(NbtCompound nbt, DynamicRegistryManager manager, ChunkPos pos) {
RegionSummary summary = new RegionSummary(manager);
Registry<Biome> biomeRegistry = manager.get(RegistryKeys.BIOME);
Registry<Block> blockRegistry = manager.get(RegistryKeys.BLOCK);
Registry<Biome> biomeRegistry = manager.getOrThrow(RegistryKeys.BIOME);
Registry<Block> blockRegistry = manager.getOrThrow(RegistryKeys.BLOCK);
NbtList biomeList = nbt.getList(KEY_BIOMES, NbtElement.STRING_TYPE);
Map<Integer, Integer> biomeRemap = new Int2IntArrayMap(biomeList.size());
for (int i = 0; i < biomeList.size(); i++) {
Expand Down Expand Up @@ -157,8 +157,8 @@ public void putChunk(World world, WorldChunk chunk) {
}

public NbtCompound writeNbt(DynamicRegistryManager manager, NbtCompound nbt, ChunkPos regionPos) {
Registry<Biome> biomeRegistry = manager.get(RegistryKeys.BIOME);
Registry<Block> blockRegistry = manager.get(RegistryKeys.BLOCK);
Registry<Biome> biomeRegistry = manager.getOrThrow(RegistryKeys.BIOME);
Registry<Block> blockRegistry = manager.getOrThrow(RegistryKeys.BLOCK);
nbt.put(KEY_BIOMES, new NbtList(mapIterable(biomePalette.view(), b -> NbtString.of(biomeRegistry.getId(b).toString())), NbtElement.STRING_TYPE));
nbt.put(KEY_BLOCKS, new NbtList(mapIterable(blockPalette.view(), b -> NbtString.of(blockRegistry.getId(b).toString())), NbtElement.STRING_TYPE));
nbt.putIntArray(KEY_BIOME_WATER, mapIterable(biomePalette.view(), Biome::getWaterColor));
Expand Down
Loading
Loading