From 30ca9ac15c74ee188a4d9af587693887196bf3fa Mon Sep 17 00:00:00 2001 From: zml Date: Sun, 12 May 2024 17:29:17 -0700 Subject: [PATCH 1/3] chore(deps): Bump Mixin to 0.8.6 (#3937) --- .../gradle/impl/OutputDependenciesToJson.java | 4 ++-- gradle/libs.versions.toml | 2 +- gradle/verification-metadata.xml | 8 ++++++++ 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/build-logic/src/main/java/org/spongepowered/gradle/impl/OutputDependenciesToJson.java b/build-logic/src/main/java/org/spongepowered/gradle/impl/OutputDependenciesToJson.java index 87af9d6094a..b34651cc054 100644 --- a/build-logic/src/main/java/org/spongepowered/gradle/impl/OutputDependenciesToJson.java +++ b/build-logic/src/main/java/org/spongepowered/gradle/impl/OutputDependenciesToJson.java @@ -270,11 +270,11 @@ public ConfigurationHolder(final Configuration configuration) { } @Input - public Provider> getIds() { + public Provider> getIds() { return this.getArtifacts().map(set -> set.stream() .map(art -> art.getId().getComponentIdentifier()) .filter(id -> id instanceof ModuleComponentIdentifier) - .map(art -> (ModuleComponentIdentifier) art) + .map(art -> art.getDisplayName()) .collect(Collectors.toSet())); } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index b20b80d38b5..0a0b2a99484 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -7,7 +7,7 @@ format = { version = "1.1" } asm = "9.7" log4j = "2.19.0" forgeAutoRenamingTool = "1.0.6" -mixin = "0.8.5" +mixin = "0.8.6" modlauncher = "8.1.3" guava = "32.1.2-jre" mockito = "5.11.0" diff --git a/gradle/verification-metadata.xml b/gradle/verification-metadata.xml index 4dbf4b26fcc..a0a61fc0e16 100644 --- a/gradle/verification-metadata.xml +++ b/gradle/verification-metadata.xml @@ -3501,6 +3501,14 @@ + + + + + + + + From 391d5b6f575aebaa0ffc29490721d26d9a5c3413 Mon Sep 17 00:00:00 2001 From: Gabriel Harris-Rouquette Date: Sun, 12 May 2024 18:13:44 -0700 Subject: [PATCH 2/3] fix: Re-enable setting biomes on Chunks --- .../common/world/volume/VolumeStreamUtils.java | 7 ++++++- .../minecraft/world/level/chunk/LevelChunkMixin_API.java | 4 +--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/spongepowered/common/world/volume/VolumeStreamUtils.java b/src/main/java/org/spongepowered/common/world/volume/VolumeStreamUtils.java index 1824446a47a..1243b41e8d1 100644 --- a/src/main/java/org/spongepowered/common/world/volume/VolumeStreamUtils.java +++ b/src/main/java/org/spongepowered/common/world/volume/VolumeStreamUtils.java @@ -26,6 +26,7 @@ import net.minecraft.client.multiplayer.ClientLevel; import net.minecraft.core.BlockPos; +import net.minecraft.core.Holder; import net.minecraft.core.Registry; import net.minecraft.core.SectionPos; import net.minecraft.core.registries.Registries; @@ -44,6 +45,7 @@ import net.minecraft.world.level.chunk.ImposterProtoChunk; import net.minecraft.world.level.chunk.LevelChunk; import net.minecraft.world.level.chunk.LevelChunkSection; +import net.minecraft.world.level.chunk.PalettedContainer; import net.minecraft.world.level.chunk.ProtoChunk; import net.minecraft.world.level.entity.EntitySection; import org.checkerframework.checker.nullness.qual.MonotonicNonNull; @@ -175,7 +177,10 @@ public static boolean setBiomeOnNativeChunk(final int x, final int y, final int final int maskedX = x & 3; final int maskedY = y & 3; final int maskedZ = z & 3; - // TODO section.getBiomes().set(maskedX, maskedY, maskedZ, Holder.direct((Biome) (Object) biome)); + final var old = ((PalettedContainer>) section.getBiomes()).getAndSet(maskedX, maskedY, maskedZ, Holder.direct((Biome) (Object) biome)); + if (old.value() == (Object) biome) { + return false; + } finalizer.run(); return true; diff --git a/src/mixins/java/org/spongepowered/common/mixin/api/minecraft/world/level/chunk/LevelChunkMixin_API.java b/src/mixins/java/org/spongepowered/common/mixin/api/minecraft/world/level/chunk/LevelChunkMixin_API.java index f063053ff4e..be4529c6257 100644 --- a/src/mixins/java/org/spongepowered/common/mixin/api/minecraft/world/level/chunk/LevelChunkMixin_API.java +++ b/src/mixins/java/org/spongepowered/common/mixin/api/minecraft/world/level/chunk/LevelChunkMixin_API.java @@ -128,9 +128,7 @@ public Biome biome(final int x, final int y, final int z) { @Override public boolean setBiome(final int x, final int y, final int z, final Biome biome) { - // TODO ChunkBiomeContainerAccessor is dead - //return VolumeStreamUtils.setBiomeOnNativeChunk(x, y, z, biome, () -> (ChunkBiomeContainerAccessor) this.biomes, () -> this.setUnsaved(true)); - return false; + return VolumeStreamUtils.setBiomeOnNativeChunk(x, y, z, biome, () -> this.getSection(this.getSectionIndex(y)), () -> this.setUnsaved(true)); } @Intrinsic From 8404dcbba70cb6ca6efcabf8df1d84242a0eb8e1 Mon Sep 17 00:00:00 2001 From: Gabriel Harris-Rouquette Date: Sun, 12 May 2024 22:21:17 -0700 Subject: [PATCH 3/3] fix: Call correct methods for biome access on chunks Fixes #3955 --- .../common/world/volume/VolumeStreamUtils.java | 7 ++++++- .../minecraft/world/level/chunk/LevelChunkMixin_API.java | 6 ++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/main/java/org/spongepowered/common/world/volume/VolumeStreamUtils.java b/src/main/java/org/spongepowered/common/world/volume/VolumeStreamUtils.java index af7e1564495..0b6200320d1 100644 --- a/src/main/java/org/spongepowered/common/world/volume/VolumeStreamUtils.java +++ b/src/main/java/org/spongepowered/common/world/volume/VolumeStreamUtils.java @@ -26,6 +26,7 @@ import net.minecraft.client.multiplayer.ClientLevel; import net.minecraft.core.BlockPos; +import net.minecraft.core.Holder; import net.minecraft.core.Registry; import net.minecraft.core.SectionPos; import net.minecraft.core.registries.Registries; @@ -44,6 +45,7 @@ import net.minecraft.world.level.chunk.ImposterProtoChunk; import net.minecraft.world.level.chunk.LevelChunk; import net.minecraft.world.level.chunk.LevelChunkSection; +import net.minecraft.world.level.chunk.PalettedContainer; import net.minecraft.world.level.chunk.ProtoChunk; import net.minecraft.world.level.entity.EntitySection; import org.checkerframework.checker.nullness.qual.MonotonicNonNull; @@ -176,7 +178,10 @@ public static boolean setBiomeOnNativeChunk(final int x, final int y, final int final int maskedX = x & 3; final int maskedY = y & 3; final int maskedZ = z & 3; - // TODO section.getBiomes().set(maskedX, maskedY, maskedZ, Holder.direct((Biome) (Object) biome)); + final var old = ((PalettedContainer>) section.getBiomes()).getAndSet(maskedX, maskedY, maskedZ, Holder.direct((Biome) (Object) biome)); + if (old.value() == (Object) biome) { + return false; + } finalizer.run(); return true; diff --git a/src/mixins/java/org/spongepowered/common/mixin/api/minecraft/world/level/chunk/LevelChunkMixin_API.java b/src/mixins/java/org/spongepowered/common/mixin/api/minecraft/world/level/chunk/LevelChunkMixin_API.java index 52d1fb1335a..00058be52f7 100644 --- a/src/mixins/java/org/spongepowered/common/mixin/api/minecraft/world/level/chunk/LevelChunkMixin_API.java +++ b/src/mixins/java/org/spongepowered/common/mixin/api/minecraft/world/level/chunk/LevelChunkMixin_API.java @@ -122,14 +122,12 @@ public Biome biome(final int x, final int y, final int z) { if (!this.contains(x, y, z)) { throw new PositionOutOfBoundsException(new Vector3i(x, y, z), Constants.World.BLOCK_MIN, Constants.World.BLOCK_MAX); } - return (Biome) (Object) this.level.getBiome(new BlockPos(x, y, z)); + return (Biome) (Object) this.level.getBiome(new BlockPos(x, y, z)).value(); } @Override public boolean setBiome(final int x, final int y, final int z, final Biome biome) { - // TODO ChunkBiomeContainerAccessor is dead - //return VolumeStreamUtils.setBiomeOnNativeChunk(x, y, z, biome, () -> (ChunkBiomeContainerAccessor) this.biomes, () -> this.setUnsaved(true)); - return false; + return VolumeStreamUtils.setBiomeOnNativeChunk(x, y, z, biome, () -> this.getSection(this.getSectionIndex(y)), () -> this.setUnsaved(true)); } @Intrinsic