From d7b148e0ec67d1c0b11817abd4c8c3b2e5e4d033 Mon Sep 17 00:00:00 2001 From: modmuss Date: Sun, 8 Oct 2023 13:02:07 +0100 Subject: [PATCH 1/4] Make some experimental APIs stable. (#3354) * Make some experimental APIs stable. * Imports. (cherry picked from commit e3d2bf3f57c526d3f08233267c22e2f543574918) --- .../net/fabricmc/fabric/api/biome/v1/BiomeModification.java | 2 -- .../fabricmc/fabric/api/biome/v1/BiomeModificationContext.java | 2 -- .../net/fabricmc/fabric/api/biome/v1/BiomeModifications.java | 2 -- .../java/net/fabricmc/fabric/api/biome/v1/BiomeSelectors.java | 2 -- .../net/fabricmc/fabric/api/biome/v1/ModificationPhase.java | 2 -- .../java/net/fabricmc/fabric/api/biome/v1/NetherBiomes.java | 2 -- .../java/net/fabricmc/fabric/api/biome/v1/TheEndBiomes.java | 3 --- fabric-biome-api-v1/src/main/resources/fabric.mod.json | 2 +- .../api/datagen/v1/provider/FabricDynamicRegistryProvider.java | 1 - .../fabric/api/itemgroup/v1/FabricItemGroupEntries.java | 1 - fabric-message-api-v1/src/main/resources/fabric.mod.json | 2 +- .../src/main/resources/fabric.mod.json | 2 +- 12 files changed, 3 insertions(+), 20 deletions(-) diff --git a/fabric-biome-api-v1/src/main/java/net/fabricmc/fabric/api/biome/v1/BiomeModification.java b/fabric-biome-api-v1/src/main/java/net/fabricmc/fabric/api/biome/v1/BiomeModification.java index 88a95b71c1..846f2dbc09 100644 --- a/fabric-biome-api-v1/src/main/java/net/fabricmc/fabric/api/biome/v1/BiomeModification.java +++ b/fabric-biome-api-v1/src/main/java/net/fabricmc/fabric/api/biome/v1/BiomeModification.java @@ -30,8 +30,6 @@ * Provides methods for modifying biomes. To create an instance, call * {@link BiomeModifications#create(Identifier)}. * - *

Experimental feature, may be removed or changed without further notice. - * * @see BiomeModifications */ public class BiomeModification { diff --git a/fabric-biome-api-v1/src/main/java/net/fabricmc/fabric/api/biome/v1/BiomeModificationContext.java b/fabric-biome-api-v1/src/main/java/net/fabricmc/fabric/api/biome/v1/BiomeModificationContext.java index 3d772c98d7..34cdde5c08 100644 --- a/fabric-biome-api-v1/src/main/java/net/fabricmc/fabric/api/biome/v1/BiomeModificationContext.java +++ b/fabric-biome-api-v1/src/main/java/net/fabricmc/fabric/api/biome/v1/BiomeModificationContext.java @@ -40,8 +40,6 @@ /** * Allows {@link Biome} properties to be modified. - * - *

Experimental feature, may be removed or changed without further notice. */ public interface BiomeModificationContext { /** diff --git a/fabric-biome-api-v1/src/main/java/net/fabricmc/fabric/api/biome/v1/BiomeModifications.java b/fabric-biome-api-v1/src/main/java/net/fabricmc/fabric/api/biome/v1/BiomeModifications.java index bf13746d71..fd0e243d33 100644 --- a/fabric-biome-api-v1/src/main/java/net/fabricmc/fabric/api/biome/v1/BiomeModifications.java +++ b/fabric-biome-api-v1/src/main/java/net/fabricmc/fabric/api/biome/v1/BiomeModifications.java @@ -34,8 +34,6 @@ * Provides an API to modify Biomes after they have been loaded and before they are used in the World. * *

Any modifications made to biomes will not be available for use in the demo level. - * - *

Experimental feature, may be removed or changed without further notice. */ public final class BiomeModifications { private BiomeModifications() { diff --git a/fabric-biome-api-v1/src/main/java/net/fabricmc/fabric/api/biome/v1/BiomeSelectors.java b/fabric-biome-api-v1/src/main/java/net/fabricmc/fabric/api/biome/v1/BiomeSelectors.java index b8b92c1aea..6da5235af7 100644 --- a/fabric-biome-api-v1/src/main/java/net/fabricmc/fabric/api/biome/v1/BiomeSelectors.java +++ b/fabric-biome-api-v1/src/main/java/net/fabricmc/fabric/api/biome/v1/BiomeSelectors.java @@ -34,8 +34,6 @@ /** * Provides several convenient biome selectors that can be used with {@link BiomeModifications}. - * - *

Experimental feature, may be removed or changed without further notice. */ public final class BiomeSelectors { private BiomeSelectors() { diff --git a/fabric-biome-api-v1/src/main/java/net/fabricmc/fabric/api/biome/v1/ModificationPhase.java b/fabric-biome-api-v1/src/main/java/net/fabricmc/fabric/api/biome/v1/ModificationPhase.java index 1f4d3ae1a7..9e227f1380 100644 --- a/fabric-biome-api-v1/src/main/java/net/fabricmc/fabric/api/biome/v1/ModificationPhase.java +++ b/fabric-biome-api-v1/src/main/java/net/fabricmc/fabric/api/biome/v1/ModificationPhase.java @@ -27,8 +27,6 @@ *

  • Replacements (removal + add) in biomes
  • *
  • Generic post-processing of biomes
  • * - * - *

    Experimental feature, may be removed or changed without further notice. */ public enum ModificationPhase { /** diff --git a/fabric-biome-api-v1/src/main/java/net/fabricmc/fabric/api/biome/v1/NetherBiomes.java b/fabric-biome-api-v1/src/main/java/net/fabricmc/fabric/api/biome/v1/NetherBiomes.java index d76c7cf3bb..b5fabc239c 100644 --- a/fabric-biome-api-v1/src/main/java/net/fabricmc/fabric/api/biome/v1/NetherBiomes.java +++ b/fabric-biome-api-v1/src/main/java/net/fabricmc/fabric/api/biome/v1/NetherBiomes.java @@ -24,8 +24,6 @@ /** * API that exposes the internals of Minecraft's nether biome code. - * - *

    Experimental feature, may be removed or changed without further notice. */ public final class NetherBiomes { private NetherBiomes() { diff --git a/fabric-biome-api-v1/src/main/java/net/fabricmc/fabric/api/biome/v1/TheEndBiomes.java b/fabric-biome-api-v1/src/main/java/net/fabricmc/fabric/api/biome/v1/TheEndBiomes.java index d020a9a745..8a69dfdf6e 100644 --- a/fabric-biome-api-v1/src/main/java/net/fabricmc/fabric/api/biome/v1/TheEndBiomes.java +++ b/fabric-biome-api-v1/src/main/java/net/fabricmc/fabric/api/biome/v1/TheEndBiomes.java @@ -25,9 +25,6 @@ /** * API that exposes some internals of the minecraft default biome source for The End. * - *

    Experimental feature, may be removed or changed without further notice. - * Because of the volatility of world generation in Minecraft 1.16, this API is marked experimental - * since it is likely to change in future Minecraft versions. */ public final class TheEndBiomes { private TheEndBiomes() { diff --git a/fabric-biome-api-v1/src/main/resources/fabric.mod.json b/fabric-biome-api-v1/src/main/resources/fabric.mod.json index 21c70d68f8..d73bb37296 100644 --- a/fabric-biome-api-v1/src/main/resources/fabric.mod.json +++ b/fabric-biome-api-v1/src/main/resources/fabric.mod.json @@ -25,6 +25,6 @@ ], "accessWidener" : "fabric-biome-api-v1.accesswidener", "custom": { - "fabric-api:module-lifecycle": "experimental" + "fabric-api:module-lifecycle": "stable" } } diff --git a/fabric-data-generation-api-v1/src/main/java/net/fabricmc/fabric/api/datagen/v1/provider/FabricDynamicRegistryProvider.java b/fabric-data-generation-api-v1/src/main/java/net/fabricmc/fabric/api/datagen/v1/provider/FabricDynamicRegistryProvider.java index 667f114e18..0be6cc8287 100644 --- a/fabric-data-generation-api-v1/src/main/java/net/fabricmc/fabric/api/datagen/v1/provider/FabricDynamicRegistryProvider.java +++ b/fabric-data-generation-api-v1/src/main/java/net/fabricmc/fabric/api/datagen/v1/provider/FabricDynamicRegistryProvider.java @@ -58,7 +58,6 @@ * A provider to help with data-generation of dynamic registry objects, * such as biomes, features, or message types. */ -@ApiStatus.Experimental public abstract class FabricDynamicRegistryProvider implements DataProvider { private static final Logger LOGGER = LoggerFactory.getLogger(FabricDynamicRegistryProvider.class); diff --git a/fabric-item-group-api-v1/src/main/java/net/fabricmc/fabric/api/itemgroup/v1/FabricItemGroupEntries.java b/fabric-item-group-api-v1/src/main/java/net/fabricmc/fabric/api/itemgroup/v1/FabricItemGroupEntries.java index 2823fafcfd..f43082aeec 100644 --- a/fabric-item-group-api-v1/src/main/java/net/fabricmc/fabric/api/itemgroup/v1/FabricItemGroupEntries.java +++ b/fabric-item-group-api-v1/src/main/java/net/fabricmc/fabric/api/itemgroup/v1/FabricItemGroupEntries.java @@ -32,7 +32,6 @@ /** * This class allows the entries of {@linkplain ItemGroup item groups} to be modified by the events in {@link ItemGroupEvents}. */ -@ApiStatus.Experimental public class FabricItemGroupEntries implements ItemGroup.Entries { private final ItemGroup.DisplayContext context; private final List displayStacks; diff --git a/fabric-message-api-v1/src/main/resources/fabric.mod.json b/fabric-message-api-v1/src/main/resources/fabric.mod.json index 7a0e078cb9..546a20b66e 100644 --- a/fabric-message-api-v1/src/main/resources/fabric.mod.json +++ b/fabric-message-api-v1/src/main/resources/fabric.mod.json @@ -28,6 +28,6 @@ } ], "custom": { - "fabric-api:module-lifecycle": "experimental" + "fabric-api:module-lifecycle": "stable" } } diff --git a/fabric-resource-conditions-api-v1/src/main/resources/fabric.mod.json b/fabric-resource-conditions-api-v1/src/main/resources/fabric.mod.json index f6ffdfb8e3..17da02e358 100644 --- a/fabric-resource-conditions-api-v1/src/main/resources/fabric.mod.json +++ b/fabric-resource-conditions-api-v1/src/main/resources/fabric.mod.json @@ -23,6 +23,6 @@ "fabric-resource-conditions-api-v1.mixins.json" ], "custom": { - "fabric-api:module-lifecycle": "experimental" + "fabric-api:module-lifecycle": "stable" } } From 96dfa9590d310c7758c57c41c713d6176ae69f7f Mon Sep 17 00:00:00 2001 From: LLytho Date: Sun, 8 Oct 2023 14:05:30 +0200 Subject: [PATCH 2/4] Add LootTableEvents.LOADED event (#3352) * Implement `LootTableEvents.LOADED` event * Update for checkstyle * rename event * Update fabric-loot-api-v2/src/main/java/net/fabricmc/fabric/api/loot/v2/LootTableEvents.java Co-authored-by: Juuz <6596629+Juuxel@users.noreply.github.com> --------- Co-authored-by: modmuss Co-authored-by: Juuz <6596629+Juuxel@users.noreply.github.com> --- .../fabric/api/loot/v2/LootTableEvents.java | 19 +++++++++++++++++++ .../fabric/mixin/loot/LootManagerMixin.java | 1 + .../fabricmc/fabric/test/loot/LootTest.java | 8 ++++++++ 3 files changed, 28 insertions(+) diff --git a/fabric-loot-api-v2/src/main/java/net/fabricmc/fabric/api/loot/v2/LootTableEvents.java b/fabric-loot-api-v2/src/main/java/net/fabricmc/fabric/api/loot/v2/LootTableEvents.java index 56776cb121..5e9d67ad7b 100644 --- a/fabric-loot-api-v2/src/main/java/net/fabricmc/fabric/api/loot/v2/LootTableEvents.java +++ b/fabric-loot-api-v2/src/main/java/net/fabricmc/fabric/api/loot/v2/LootTableEvents.java @@ -89,6 +89,15 @@ private LootTableEvents() { } }); + /** + * This event can be used for post-processing after all loot tables have been loaded and modified by Fabric. + */ + public static final Event ALL_LOADED = EventFactory.createArrayBacked(Loaded.class, listeners -> (resourceManager, lootManager) -> { + for (Loaded listener : listeners) { + listener.onLootTablesLoaded(resourceManager, lootManager); + } + }); + public interface Replace { /** * Replaces loot tables. @@ -116,4 +125,14 @@ public interface Modify { */ void modifyLootTable(ResourceManager resourceManager, LootManager lootManager, Identifier id, LootTable.Builder tableBuilder, LootTableSource source); } + + public interface Loaded { + /** + * Called when all loot tables have been loaded and {@link LootTableEvents#REPLACE} and {@link LootTableEvents#MODIFY} have been invoked. + * + * @param resourceManager the server resource manager + * @param lootManager the loot manager + */ + void onLootTablesLoaded(ResourceManager resourceManager, LootManager lootManager); + } } diff --git a/fabric-loot-api-v2/src/main/java/net/fabricmc/fabric/mixin/loot/LootManagerMixin.java b/fabric-loot-api-v2/src/main/java/net/fabricmc/fabric/mixin/loot/LootManagerMixin.java index aa684722b2..9c8625f77b 100644 --- a/fabric-loot-api-v2/src/main/java/net/fabricmc/fabric/mixin/loot/LootManagerMixin.java +++ b/fabric-loot-api-v2/src/main/java/net/fabricmc/fabric/mixin/loot/LootManagerMixin.java @@ -95,5 +95,6 @@ private void applyLootTableEvents(ResourceManager resourceManager, LootManager l }); this.keyToValue = newTables.build(); + LootTableEvents.ALL_LOADED.invoker().onLootTablesLoaded(resourceManager, lootManager); } } diff --git a/fabric-loot-api-v2/src/testmod/java/net/fabricmc/fabric/test/loot/LootTest.java b/fabric-loot-api-v2/src/testmod/java/net/fabricmc/fabric/test/loot/LootTest.java index 4a7236347d..1f34b42dd9 100644 --- a/fabric-loot-api-v2/src/testmod/java/net/fabricmc/fabric/test/loot/LootTest.java +++ b/fabric-loot-api-v2/src/testmod/java/net/fabricmc/fabric/test/loot/LootTest.java @@ -92,5 +92,13 @@ public void onInitialize() { tableBuilder.modifyPools(poolBuilder -> poolBuilder.with(ItemEntry.builder(Items.EMERALD))); } }); + + LootTableEvents.ALL_LOADED.register((resourceManager, lootManager) -> { + LootTable blackWoolTable = lootManager.getLootTable(Blocks.BLACK_WOOL.getLootTableId()); + + if (blackWoolTable == LootTable.EMPTY) { + throw new AssertionError("black wool loot table should not be empty"); + } + }); } } From 215bbe96c2a19ce6090eb148b1f402a1d1d9737a Mon Sep 17 00:00:00 2001 From: apple502j <33279053+apple502j@users.noreply.github.com> Date: Sun, 8 Oct 2023 21:13:56 +0900 Subject: [PATCH 3/4] Fix inconsistency of placed feature locations (#3369) * Fix inconsistency of placed feature locations `BiomeSource#getBiomes` mixin applies to all biome sources, including one for Overworld. The return value is a set; however one caller in the worldgen code iterates over it: `PlacedFeatureIndexer`. Using a hash set here randomizes the return value, affecting feature placement. Use a linked hash set instead. * Improve fix to only make changes when required. --------- Co-authored-by: modmuss50 (cherry picked from commit 661cc8c6dccfa63d6957696dc79c2b1eb99fe5ca) --- .../fabricmc/fabric/mixin/biome/BiomeSourceMixin.java | 9 +++------ .../fabric/mixin/biome/TheEndBiomeSourceMixin.java | 10 ++++++++-- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/fabric-biome-api-v1/src/main/java/net/fabricmc/fabric/mixin/biome/BiomeSourceMixin.java b/fabric-biome-api-v1/src/main/java/net/fabricmc/fabric/mixin/biome/BiomeSourceMixin.java index 546d5b2cf6..117d2dca5e 100644 --- a/fabric-biome-api-v1/src/main/java/net/fabricmc/fabric/mixin/biome/BiomeSourceMixin.java +++ b/fabric-biome-api-v1/src/main/java/net/fabricmc/fabric/mixin/biome/BiomeSourceMixin.java @@ -16,8 +16,6 @@ package net.fabricmc.fabric.mixin.biome; -import java.util.Collections; -import java.util.HashSet; import java.util.Set; import java.util.function.Supplier; @@ -33,11 +31,10 @@ public class BiomeSourceMixin { @Redirect(method = "getBiomes", at = @At(value = "INVOKE", target = "Ljava/util/function/Supplier;get()Ljava/lang/Object;")) private Object getBiomes(Supplier>> instance) { - var biomes = new HashSet<>(instance.get()); - fabric_modifyBiomeSet(biomes); - return Collections.unmodifiableSet(biomes); + return fabric_modifyBiomeSet(instance.get()); } - protected void fabric_modifyBiomeSet(Set> biomes) { + protected Set> fabric_modifyBiomeSet(Set> biomes) { + return biomes; } } diff --git a/fabric-biome-api-v1/src/main/java/net/fabricmc/fabric/mixin/biome/TheEndBiomeSourceMixin.java b/fabric-biome-api-v1/src/main/java/net/fabricmc/fabric/mixin/biome/TheEndBiomeSourceMixin.java index 3d156f4c6e..09ee624240 100644 --- a/fabric-biome-api-v1/src/main/java/net/fabricmc/fabric/mixin/biome/TheEndBiomeSourceMixin.java +++ b/fabric-biome-api-v1/src/main/java/net/fabricmc/fabric/mixin/biome/TheEndBiomeSourceMixin.java @@ -16,6 +16,8 @@ package net.fabricmc.fabric.mixin.biome; +import java.util.Collections; +import java.util.LinkedHashSet; import java.util.Set; import java.util.function.Supplier; @@ -108,14 +110,18 @@ private void getWeightedEndBiome(int biomeX, int biomeY, int biomeZ, MultiNoiseU } @Override - protected void fabric_modifyBiomeSet(Set> biomes) { + protected Set> fabric_modifyBiomeSet(Set> biomes) { if (!hasCheckedForModifiedSet) { hasCheckedForModifiedSet = true; biomeSetModified = !overrides.get().customBiomes.isEmpty(); } if (biomeSetModified) { - biomes.addAll(overrides.get().customBiomes); + var modifiedBiomes = new LinkedHashSet<>(biomes); + modifiedBiomes.addAll(overrides.get().customBiomes); + return Collections.unmodifiableSet(modifiedBiomes); } + + return biomes; } } From 16a9bc783ed62b79f2a619dcd665ffe57b2e54b1 Mon Sep 17 00:00:00 2001 From: modmuss50 Date: Sun, 8 Oct 2023 13:34:37 +0100 Subject: [PATCH 4/4] Bump version --- gradle.properties | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/gradle.properties b/gradle.properties index fd7db491fc..fc42544804 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,7 +2,7 @@ org.gradle.jvmargs=-Xmx2560M org.gradle.parallel=true fabric.loom.multiProjectOptimisation=true -version=0.89.3 +version=0.90.0 minecraft_version=1.20.1 yarn_version=+build.1 loader_version=0.14.21 @@ -13,7 +13,7 @@ prerelease=false # Do not manually update, use the bumpversions task: fabric-api-base-version=0.4.30 fabric-api-lookup-api-v1-version=1.6.35 -fabric-biome-api-v1-version=13.0.11 +fabric-biome-api-v1-version=13.0.12 fabric-block-api-v1-version=1.0.10 fabric-block-view-api-v2-version=1.0.0 fabric-blockrenderlayer-v1-version=1.1.40 @@ -23,7 +23,7 @@ fabric-commands-v0-version=0.2.50 fabric-containers-v0-version=0.1.63 fabric-content-registries-v0-version=4.0.10 fabric-crash-report-info-v1-version=0.2.18 -fabric-data-generation-api-v1-version=12.3.1 +fabric-data-generation-api-v1-version=12.3.2 fabric-dimensions-v1-version=2.1.53 fabric-entity-events-v1-version=1.5.22 fabric-events-interaction-v0-version=0.6.1 @@ -31,13 +31,13 @@ fabric-events-lifecycle-v0-version=0.2.62 fabric-game-rule-api-v1-version=1.0.38 fabric-gametest-api-v1-version=1.2.12 fabric-item-api-v1-version=2.1.27 -fabric-item-group-api-v1-version=4.0.10 +fabric-item-group-api-v1-version=4.0.11 fabric-key-binding-api-v1-version=1.0.36 fabric-keybindings-v0-version=0.2.34 fabric-lifecycle-events-v1-version=2.2.21 -fabric-loot-api-v2-version=1.1.39 -fabric-loot-tables-v1-version=1.1.43 -fabric-message-api-v1-version=5.1.7 +fabric-loot-api-v2-version=1.2.0 +fabric-loot-tables-v1-version=1.1.44 +fabric-message-api-v1-version=5.1.8 fabric-mining-level-api-v1-version=2.1.49 fabric-model-loading-api-v1-version=1.0.2 fabric-models-v0-version=0.4.1 @@ -54,7 +54,7 @@ fabric-rendering-data-attachment-v1-version=0.3.36 fabric-rendering-fluids-v1-version=3.0.27 fabric-rendering-v0-version=1.1.48 fabric-rendering-v1-version=3.0.7 -fabric-resource-conditions-api-v1-version=2.3.5 +fabric-resource-conditions-api-v1-version=2.3.6 fabric-resource-loader-v0-version=0.11.9 fabric-screen-api-v1-version=2.0.7 fabric-screen-handler-api-v1-version=1.3.29