diff --git a/common/src/main/java/com/seibel/lod/common/wrappers/block/BlockDetailMap.java b/common/src/main/java/com/seibel/lod/common/wrappers/block/BlockDetailMap.java index bc57b5f98..280a251f8 100644 --- a/common/src/main/java/com/seibel/lod/common/wrappers/block/BlockDetailMap.java +++ b/common/src/main/java/com/seibel/lod/common/wrappers/block/BlockDetailMap.java @@ -211,7 +211,7 @@ public class BlockDetailMap BlockDetail getResolvedBlockDetail(BlockState bs, int x, int y, int z, LevelReader getter) { if (!requireResolving) return blockDetail; BlockPos pos = new BlockPos(x,y,z); - Biome biome = getter.getBiome(pos); + Biome biome = getter.getBiome(pos).value(); BlockDetail tintDetail = biomeDetailMap.get(biome); if (tintDetail == null) { if (!bs.getFluidState().isEmpty()) bs = bs.getFluidState().createLegacyBlock(); diff --git a/common/src/main/java/com/seibel/lod/common/wrappers/chunk/ChunkWrapper.java b/common/src/main/java/com/seibel/lod/common/wrappers/chunk/ChunkWrapper.java index ca80de825..649f4e90e 100644 --- a/common/src/main/java/com/seibel/lod/common/wrappers/chunk/ChunkWrapper.java +++ b/common/src/main/java/com/seibel/lod/common/wrappers/chunk/ChunkWrapper.java @@ -61,7 +61,7 @@ public class ChunkWrapper implements IChunkWrapper public IBiomeWrapper getBiome(int x, int y, int z) { return BiomeWrapper.getBiomeWrapper(chunk.getNoiseBiome( - QuartPos.fromBlock(x), QuartPos.fromBlock(y), QuartPos.fromBlock(z))); + QuartPos.fromBlock(x), QuartPos.fromBlock(y), QuartPos.fromBlock(z)).value()); } @Override diff --git a/common/src/main/java/com/seibel/lod/common/wrappers/minecraft/MinecraftRenderWrapper.java b/common/src/main/java/com/seibel/lod/common/wrappers/minecraft/MinecraftRenderWrapper.java index bacd880ed..3f71e81dc 100644 --- a/common/src/main/java/com/seibel/lod/common/wrappers/minecraft/MinecraftRenderWrapper.java +++ b/common/src/main/java/com/seibel/lod/common/wrappers/minecraft/MinecraftRenderWrapper.java @@ -172,7 +172,7 @@ public class MinecraftRenderWrapper implements IMinecraftRenderWrapper LevelRenderer levelRenderer = MC.levelRenderer; LinkedHashSet chunks = levelRenderer.renderChunkStorage.get().renderChunks; return (chunks.stream().map((chunk) -> { - AABB chunkBoundingBox = chunk.chunk.bb; + AABB chunkBoundingBox = chunk.chunk.getBoundingBox(); return FACTORY.createChunkPos(Math.floorDiv((int) chunkBoundingBox.minX, 16), Math.floorDiv((int) chunkBoundingBox.minZ, 16)); }).collect(Collectors.toCollection(HashSet::new))); diff --git a/common/src/main/java/com/seibel/lod/common/wrappers/world/BiomeWrapper.java b/common/src/main/java/com/seibel/lod/common/wrappers/world/BiomeWrapper.java index 7651d4ecc..820b75bdc 100644 --- a/common/src/main/java/com/seibel/lod/common/wrappers/world/BiomeWrapper.java +++ b/common/src/main/java/com/seibel/lod/common/wrappers/world/BiomeWrapper.java @@ -65,7 +65,7 @@ public class BiomeWrapper implements IBiomeWrapper { int colorInt; - switch (biome.getBiomeCategory()) + switch (biome.biomeCategory) { case NETHER: diff --git a/common/src/main/java/com/seibel/lod/common/wrappers/worldGeneration/mimicObject/ChunkLoader.java b/common/src/main/java/com/seibel/lod/common/wrappers/worldGeneration/mimicObject/ChunkLoader.java index 2a813acfd..adf03b444 100644 --- a/common/src/main/java/com/seibel/lod/common/wrappers/worldGeneration/mimicObject/ChunkLoader.java +++ b/common/src/main/java/com/seibel/lod/common/wrappers/worldGeneration/mimicObject/ChunkLoader.java @@ -5,7 +5,6 @@ import com.google.common.collect.Maps; import com.mojang.serialization.Codec; import com.mojang.serialization.Dynamic; import com.seibel.lod.core.api.ApiShared; -import com.seibel.lod.core.api.ClientApi; import it.unimi.dsi.fastutil.longs.LongOpenHashSet; import it.unimi.dsi.fastutil.longs.LongSet; @@ -15,6 +14,7 @@ import java.util.Locale; import java.util.Map; import java.util.Objects; +import net.minecraft.core.Holder; import net.minecraft.core.Registry; import net.minecraft.core.SectionPos; import net.minecraft.nbt.CompoundTag; @@ -39,6 +39,7 @@ import net.minecraft.world.level.chunk.PalettedContainer; import net.minecraft.world.level.chunk.UpgradeData; import net.minecraft.world.level.levelgen.Heightmap; import net.minecraft.world.level.levelgen.blending.BlendingData; +import net.minecraft.world.level.levelgen.feature.ConfiguredStructureFeature; import net.minecraft.world.level.levelgen.feature.StructureFeature; import net.minecraft.world.level.levelgen.structure.StructureStart; import net.minecraft.world.level.levelgen.structure.pieces.StructurePieceSerializationContext; @@ -69,47 +70,48 @@ public class ChunkLoader private static LevelChunkSection[] readSections(LevelAccessor level, LevelLightEngine lightEngine, ChunkPos chunkPos, CompoundTag chunkData) { - Registry biomes = level.registryAccess().registryOrThrow(Registry.BIOME_REGISTRY); - Codec> biomeCodec = PalettedContainer.codec( - biomes, biomes.byNameCodec(), PalettedContainer.Strategy.SECTION_BIOMES, biomes.getOrThrow(Biomes.PLAINS)); - - int i = level.getSectionsCount(); - LevelChunkSection[] chunkSections = new LevelChunkSection[i]; - - boolean isLightOn = chunkData.getBoolean("isLightOn"); - boolean hasSkyLight = level.dimensionType().hasSkyLight(); - ListTag tagSections = chunkData.getList("sections", 10); - - for (int j = 0; j < tagSections.size(); ++j) - { - CompoundTag tagSection = tagSections.getCompound(j); - byte sectionYPos = tagSection.getByte("Y"); - int sectionId = level.getSectionIndexFromSectionY(sectionYPos); - if (sectionId >= 0 && sectionId < chunkSections.length) - { - PalettedContainer blockStateContainer; - PalettedContainer biomeContainer; - - blockStateContainer = tagSection.contains("block_states", 10) - ? BLOCK_STATE_CODEC.parse(NbtOps.INSTANCE, tagSection.getCompound("block_states")).promotePartial(string -> logErrors(chunkPos, sectionYPos, string)).getOrThrow(false, LOGGER::error) - : new PalettedContainer(Block.BLOCK_STATE_REGISTRY, Blocks.AIR.defaultBlockState(), PalettedContainer.Strategy.SECTION_STATES); - - biomeContainer = tagSection.contains("biomes", 10) - ? biomeCodec.parse(NbtOps.INSTANCE, tagSection.getCompound("biomes")).promotePartial(string -> logErrors(chunkPos, sectionYPos, string)).getOrThrow(false, LOGGER::error) - : new PalettedContainer(biomes, biomes.getOrThrow(Biomes.PLAINS), PalettedContainer.Strategy.SECTION_BIOMES); - - chunkSections[sectionId] = new LevelChunkSection(sectionYPos, blockStateContainer, biomeContainer); - } - - if (!isLightOn) - continue; - - if (tagSection.contains("BlockLight", 7)) - lightEngine.queueSectionData(LightLayer.BLOCK, SectionPos.of(chunkPos, sectionYPos), new DataLayer(tagSection.getByteArray("BlockLight")), true); - if (hasSkyLight && tagSection.contains("SkyLight", 7)) - lightEngine.queueSectionData(LightLayer.SKY, SectionPos.of(chunkPos, sectionYPos), new DataLayer(tagSection.getByteArray("SkyLight")), true); - } - return chunkSections; +// Registry biomes = level.registryAccess().registryOrThrow(Registry.BIOME_REGISTRY); +// Codec> biomeCodec = PalettedContainer.codec( +// biomes, biomes.byNameCodec(), PalettedContainer.Strategy.SECTION_BIOMES, biomes.getOrThrow(Biomes.PLAINS)); +// +// int i = level.getSectionsCount(); +// LevelChunkSection[] chunkSections = new LevelChunkSection[i]; +// +// boolean isLightOn = chunkData.getBoolean("isLightOn"); +// boolean hasSkyLight = level.dimensionType().hasSkyLight(); +// ListTag tagSections = chunkData.getList("sections", 10); +// +// for (int j = 0; j < tagSections.size(); ++j) +// { +// CompoundTag tagSection = tagSections.getCompound(j); +// byte sectionYPos = tagSection.getByte("Y"); +// int sectionId = level.getSectionIndexFromSectionY(sectionYPos); +// if (sectionId >= 0 && sectionId < chunkSections.length) +// { +// PalettedContainer blockStateContainer; +// PalettedContainer> biomeContainer; +// +// blockStateContainer = tagSection.contains("block_states", 10) +// ? BLOCK_STATE_CODEC.parse(NbtOps.INSTANCE, tagSection.getCompound("block_states")).promotePartial(string -> logErrors(chunkPos, sectionYPos, string)).getOrThrow(false, LOGGER::error) +// : new PalettedContainer(Block.BLOCK_STATE_REGISTRY, Blocks.AIR.defaultBlockState(), PalettedContainer.Strategy.SECTION_STATES); +// +// biomeContainer = tagSection.contains("biomes", 10) +// ? biomeCodec.parse(NbtOps.INSTANCE, tagSection.getCompound("biomes")).promotePartial(string -> logErrors(chunkPos, sectionYPos, string)).getOrThrow(false, LOGGER::error) +// : new PalettedContainer>(biomes, biomes.getOrThrow(Biomes.PLAINS), PalettedContainer.Strategy.SECTION_BIOMES); +// +// chunkSections[sectionId] = new LevelChunkSection(sectionYPos, blockStateContainer, biomeContainer); +// } +// +// if (!isLightOn) +// continue; +// +// if (tagSection.contains("BlockLight", 7)) +// lightEngine.queueSectionData(LightLayer.BLOCK, SectionPos.of(chunkPos, sectionYPos), new DataLayer(tagSection.getByteArray("BlockLight")), true); +// if (hasSkyLight && tagSection.contains("SkyLight", 7)) +// lightEngine.queueSectionData(LightLayer.SKY, SectionPos.of(chunkPos, sectionYPos), new DataLayer(tagSection.getByteArray("SkyLight")), true); +// } +// return chunkSections; + return null; } private static void readHeightmaps(LevelChunk chunk, CompoundTag chunkData) @@ -124,52 +126,55 @@ public class ChunkLoader Heightmap.primeHeightmaps(chunk, ChunkStatus.FULL.heightmapsAfter()); } - private static Map, StructureStart> unpackStructureStart(StructurePieceSerializationContext structurePieceSerializationContext, CompoundTag compoundTag, long l) + private static Map, StructureStart> unpackStructureStart(StructurePieceSerializationContext structurePieceSerializationContext, CompoundTag compoundTag, long l) { - HashMap, StructureStart> map = Maps.newHashMap(); - CompoundTag compoundTag2 = compoundTag.getCompound("starts"); - for (String string : compoundTag2.getAllKeys()) - { - String string2 = string.toLowerCase(Locale.ROOT); - StructureFeature structureFeature = StructureFeature.STRUCTURES_REGISTRY.get(string2); - if (structureFeature == null) - { - LOGGER.error("Unknown structure start: {}", (Object) string2); - continue; - } - StructureStart structureStart = StructureFeature.loadStaticStart(structurePieceSerializationContext, compoundTag2.getCompound(string), l); - if (structureStart == null) - continue; - map.put(structureFeature, structureStart); - } - return map; +// Map, StructureStart> map = Maps.newHashMap(); +// CompoundTag compoundTag2 = compoundTag.getCompound("starts"); +// for (String string : compoundTag2.getAllKeys()) +// { +// String string2 = string.toLowerCase(Locale.ROOT); +// ConfiguredStructureFeature structureFeature = StructureFeature.STRUCTURES_REGISTRY.get(string2); +// if (structureFeature == null) +// { +// LOGGER.error("Unknown structure start: {}", (Object) string2); +// continue; +// } +// StructureStart structureStart = StructureFeature.loadStaticStart(structurePieceSerializationContext, compoundTag2.getCompound(string), l); +// if (structureStart == null) +// continue; +// map.put(structureFeature, structureStart); +// } +// return map; + return null; } - private static Map, LongSet> unpackStructureReferences(ChunkPos chunkPos, CompoundTag compoundTag) + private static Map, LongSet> unpackStructureReferences(ChunkPos chunkPos, CompoundTag compoundTag) { - HashMap, LongSet> map = Maps.newHashMap(); - CompoundTag compoundTag2 = compoundTag.getCompound("References"); - for (String string : compoundTag2.getAllKeys()) - { - String string2 = string.toLowerCase(Locale.ROOT); - StructureFeature structureFeature = StructureFeature.STRUCTURES_REGISTRY.get(string2); - if (structureFeature == null) - { - LOGGER.warn("Found reference to unknown structure '{}' in chunk {}, discarding", (Object) string2, (Object) chunkPos); - continue; - } - map.put(structureFeature, new LongOpenHashSet(Arrays.stream(compoundTag2.getLongArray(string)).filter(l -> - { - ChunkPos chunkPos2 = new ChunkPos(l); - if (chunkPos2.getChessboardDistance(chunkPos) > 8) - { - LOGGER.warn("Found invalid structure reference [ {} @ {} ] for chunk {}.", (Object) string2, (Object) chunkPos2, (Object) chunkPos); - return false; - } - return true; - }).toArray())); - } - return map; +// Map, LongSet> map = Maps.newHashMap(); +// CompoundTag compoundTag2 = compoundTag.getCompound("References"); +// for (String string : compoundTag2.getAllKeys()) +// { +// String string2 = string.toLowerCase(Locale.ROOT); +// +// ConfiguredStructureFeature structureFeature = StructureFeature.STRUCTURES_REGISTRY.get(string2); +// if (structureFeature == null) +// { +// LOGGER.warn("Found reference to unknown structure '{}' in chunk {}, discarding", (Object) string2, (Object) chunkPos); +// continue; +// } +// map.put(structureFeature, new LongOpenHashSet(Arrays.stream(compoundTag2.getLongArray(string)).filter(l -> +// { +// ChunkPos chunkPos2 = new ChunkPos(l); +// if (chunkPos2.getChessboardDistance(chunkPos) > 8) +// { +// LOGGER.warn("Found invalid structure reference [ {} @ {} ] for chunk {}.", (Object) string2, (Object) chunkPos2, (Object) chunkPos); +// return false; +// } +// return true; +// }).toArray())); +// } +// return map; + return null; } private static void readStructures(WorldGenLevel level, LevelChunk chunk, CompoundTag chunkData) diff --git a/common/src/main/java/com/seibel/lod/common/wrappers/worldGeneration/mimicObject/LightedWorldGenRegion.java b/common/src/main/java/com/seibel/lod/common/wrappers/worldGeneration/mimicObject/LightedWorldGenRegion.java index 36bf3953c..5134626c5 100644 --- a/common/src/main/java/com/seibel/lod/common/wrappers/worldGeneration/mimicObject/LightedWorldGenRegion.java +++ b/common/src/main/java/com/seibel/lod/common/wrappers/worldGeneration/mimicObject/LightedWorldGenRegion.java @@ -77,12 +77,13 @@ public class LightedWorldGenRegion extends WorldGenRegion { } return true; } - - @Override - public List> startsForFeature(SectionPos sectionPos, - StructureFeature structureFeature) { - return structFeat.startsForFeature(sectionPos, structureFeature); - } + + // TODO Check this +// @Override +// public List> startsForFeature(SectionPos sectionPos, +// StructureFeature structureFeature) { +// return structFeat.startsForFeature(sectionPos, structureFeature); +// } // Skip updating the related tile entities @Override diff --git a/common/src/main/java/com/seibel/lod/common/wrappers/worldGeneration/mimicObject/WorldGenStructFeatManager.java b/common/src/main/java/com/seibel/lod/common/wrappers/worldGeneration/mimicObject/WorldGenStructFeatManager.java index 61687a02b..2f4b49848 100644 --- a/common/src/main/java/com/seibel/lod/common/wrappers/worldGeneration/mimicObject/WorldGenStructFeatManager.java +++ b/common/src/main/java/com/seibel/lod/common/wrappers/worldGeneration/mimicObject/WorldGenStructFeatManager.java @@ -51,7 +51,9 @@ public class WorldGenStructFeatManager extends StructureFeatureManager { if (chunk == null) return false; return chunk.hasAnyStructureReferences(); } - + + // TODO Check this + /* @Override @SuppressWarnings({ "rawtypes", "unchecked" }) public List> startsForFeature(SectionPos sectionPos, @@ -76,4 +78,5 @@ public class WorldGenStructFeatManager extends StructureFeatureManager { } return builder.build(); } + */ } \ No newline at end of file diff --git a/common/src/main/resources/lod.accesswidener b/common/src/main/resources/lod.accesswidener index 76ee5a3ba..13836d404 100644 --- a/common/src/main/resources/lod.accesswidener +++ b/common/src/main/resources/lod.accesswidener @@ -22,9 +22,10 @@ accessible field net/minecraft/world/level/lighting/LevelLightEngine skyEngine L # world generation accessible method net/minecraft/world/level/levelgen/Heightmap setHeight (III)V accessible field net/minecraft/world/level/biome/Biome generationSettings Lnet/minecraft/world/level/biome/BiomeGenerationSettings; +accessible field net/minecraft/world/level/biome/Biome biomeCategory Lnet/minecraft/world/level/biome/Biome$BiomeCategory; accessible field net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator settings Ljava/util/function/Supplier; accessible method net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator doFill (Lnet/minecraft/world/level/levelgen/blending/Blender;Lnet/minecraft/world/level/StructureFeatureManager;Lnet/minecraft/world/level/chunk/ChunkAccess;II)Lnet/minecraft/world/level/chunk/ChunkAccess; -accessible method net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator doCreateBiomes (Lnet/minecraft/core/Registry;Lnet/minecraft/world/level/levelgen/blending/Blender;Lnet/minecraft/world/level/StructureFeatureManager;Lnet/minecraft/world/level/chunk/ChunkAccess;)V +#accessible method net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator doCreateBiomes (Lnet/minecraft/core/Registry;Lnet/minecraft/world/level/levelgen/blending/Blender;Lnet/minecraft/world/level/StructureFeatureManager;Lnet/minecraft/world/level/chunk/ChunkAccess;)V accessible method net/minecraft/world/level/lighting/LayerLightEngine queueSectionData (JLnet/minecraft/world/level/chunk/DataLayer;Z)V # lod generation from save file diff --git a/fabric/src/main/java/com/seibel/lod/fabric/mixins/events/MixinClientLevel.java b/fabric/src/main/java/com/seibel/lod/fabric/mixins/events/MixinClientLevel.java index e08fed0d5..7d6312a74 100644 --- a/fabric/src/main/java/com/seibel/lod/fabric/mixins/events/MixinClientLevel.java +++ b/fabric/src/main/java/com/seibel/lod/fabric/mixins/events/MixinClientLevel.java @@ -4,6 +4,7 @@ import com.seibel.lod.fabric.Main; import net.minecraft.client.multiplayer.ClientLevel; import net.minecraft.client.multiplayer.ClientPacketListener; import net.minecraft.client.renderer.LevelRenderer; +import net.minecraft.core.Holder; import net.minecraft.resources.ResourceKey; import net.minecraft.world.level.chunk.LevelChunk; import net.minecraft.world.level.dimension.DimensionType; @@ -21,7 +22,7 @@ import java.util.function.Supplier; @Mixin(ClientLevel.class) public class MixinClientLevel { @Inject(method = "", at = @At("TAIL")) - private void loadWorldEvent(ClientPacketListener clientPacketListener, ClientLevel.ClientLevelData clientLevelData, ResourceKey resourceKey, DimensionType dimensionType, int i, int j, Supplier supplier, LevelRenderer levelRenderer, boolean bl, long l, CallbackInfo ci) { + private void loadWorldEvent(ClientPacketListener clientPacketListener, ClientLevel.ClientLevelData clientLevelData, ResourceKey resourceKey, Holder holder, int i, int j, Supplier supplier, LevelRenderer levelRenderer, boolean bl, long l, CallbackInfo ci) { Main.client_proxy.worldLoadEvent((ClientLevel) (Object) this); } @Inject(method = "setLightReady", at = @At("HEAD")) diff --git a/fabric/src/main/resources/fabric.mod.json b/fabric/src/main/resources/fabric.mod.json index 800cfbc9a..dc95685e1 100644 --- a/fabric/src/main/resources/fabric.mod.json +++ b/fabric/src/main/resources/fabric.mod.json @@ -34,7 +34,7 @@ "depends": { "fabricloader": "*", "fabric": "*", - "minecraft": "1.18.x", + "minecraft": "1.18.2", "java": ">=17" }, "suggests": { diff --git a/forge/src/main/resources/META-INF/mods.toml b/forge/src/main/resources/META-INF/mods.toml index 38d065a59..f51449c65 100644 --- a/forge/src/main/resources/META-INF/mods.toml +++ b/forge/src/main/resources/META-INF/mods.toml @@ -1,6 +1,6 @@ modLoader="javafml" #//mandatory -loaderVersion="[37,40)" # // mandatory. This is typically bumped every Minecraft version by Forge. See our download page for lists of versions. +loaderVersion="[37,41)" # // mandatory. This is typically bumped every Minecraft version by Forge. See our download page for lists of versions. license="GNU GPLv3" issueTrackerURL="${issues}" diff --git a/gradle.properties b/gradle.properties index 43e9a1e7c..61585837e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,6 @@ org.gradle.jvmargs=-Xmx2048M -minecraft_version=1.18.1 +minecraft_version=1.18.2 archives_base_name=DistantHorizons mod_version=1.6.2a @@ -16,13 +16,13 @@ mod_source=https://gitlab.com/jeseibel/minecraft-lod-mod/ mod_issues=https://gitlab.com/jeseibel/minecraft-lod-mod/-/issues # Fabric loader -fabric_loader_version=0.13.2 -fabric_api_version=0.46.4+1.18 +fabric_loader_version=0.13.3 +fabric_api_version=0.47.8+1.18.2 # Fabric mod versions - modmenu_version=3.0.1 + modmenu_version=3.1.0 starlight_version_fabric=3554912 lithium_version=mc1.18.1-0.7.7 - sodium_version=3605309 + sodium_version=3669187 iris_version=1.18.x-v1.1.4 bclib_version=1.2.5 immersive_portals_version = v1.0.4-1.18 @@ -38,7 +38,7 @@ fabric_api_version=0.46.4+1.18 enable_bclib=0 # Forge loader -forge_version=39.0.76 +forge_version=40.0.1 # Forge mod versions starlight_version_forge=3559934