Co-authored-by: Drex <nicknamedrex@gmail.com>
This commit is contained in:
modmuss 2024-05-04 14:28:29 +01:00 committed by GitHub
parent 97fc76fd23
commit 0af3f5a702
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
91 changed files with 262 additions and 245 deletions

View file

@ -4,7 +4,7 @@ plugins {
id "idea" id "idea"
id "maven-publish" id "maven-publish"
id 'jacoco' id 'jacoco'
id "fabric-loom" version "1.6.5" apply false id "fabric-loom" version "1.6.11" apply false
id "com.diffplug.spotless" version "6.20.0" id "com.diffplug.spotless" version "6.20.0"
id "org.ajoberstar.grgit" version "3.1.0" id "org.ajoberstar.grgit" version "3.1.0"
id "me.modmuss50.remotesign" version "0.4.0" apply false id "me.modmuss50.remotesign" version "0.4.0" apply false

View file

@ -16,7 +16,7 @@
"FabricMC" "FabricMC"
], ],
"depends": { "depends": {
"fabricloader": ">=0.15.6", "fabricloader": ">=0.15.11",
"fabric-api-base": "*", "fabric-api-base": "*",
"fabric-command-api-v2": "*" "fabric-command-api-v2": "*"
}, },

View file

@ -16,7 +16,7 @@
"FabricMC" "FabricMC"
], ],
"depends": { "depends": {
"fabricloader": ">=0.15.6", "fabricloader": ">=0.15.11",
"fabric-api-base": "*", "fabric-api-base": "*",
"fabric-command-api-v2": "*" "fabric-command-api-v2": "*"
}, },

View file

@ -21,7 +21,7 @@
] ]
}, },
"depends": { "depends": {
"fabricloader": ">=0.15.6", "fabricloader": ">=0.15.11",
"minecraft": ">=1.18.2" "minecraft": ">=1.18.2"
}, },
"description": "Contains common tags used by mods for vanilla things.", "description": "Contains common tags used by mods for vanilla things.",

View file

@ -16,7 +16,7 @@
"FabricMC" "FabricMC"
], ],
"depends": { "depends": {
"fabricloader": ">=0.15.6", "fabricloader": ">=0.15.11",
"fabric-key-binding-api-v1": "*" "fabric-key-binding-api-v1": "*"
}, },
"description": "Keybinding registry API.", "description": "Keybinding registry API.",

View file

@ -16,7 +16,7 @@
"FabricMC" "FabricMC"
], ],
"depends": { "depends": {
"fabricloader": ">=0.15.6", "fabricloader": ">=0.15.11",
"fabric-api-base": "*", "fabric-api-base": "*",
"fabric-model-loading-api-v1": "*" "fabric-model-loading-api-v1": "*"
}, },

View file

@ -16,7 +16,7 @@
"FabricMC" "FabricMC"
], ],
"depends": { "depends": {
"fabricloader": ">=0.15.6", "fabricloader": ">=0.15.11",
"minecraft": ">=1.15-alpha.19.39.a", "minecraft": ">=1.15-alpha.19.39.a",
"fabric-api-base": "*", "fabric-api-base": "*",
"fabric-rendering-v1": "*" "fabric-rendering-v1": "*"

View file

@ -16,7 +16,7 @@
"FabricMC" "FabricMC"
], ],
"depends": { "depends": {
"fabricloader": ">=0.15.6", "fabricloader": ">=0.15.11",
"fabric-block-view-api-v2": "*" "fabric-block-view-api-v2": "*"
}, },
"description": "Thread-safe hooks for block entity data use during terrain rendering.", "description": "Thread-safe hooks for block entity data use during terrain rendering.",

View file

@ -21,7 +21,7 @@
] ]
}, },
"depends": { "depends": {
"fabricloader": ">=0.15.6", "fabricloader": ">=0.15.11",
"minecraft": ">=1.15-alpha.19.39.a", "minecraft": ">=1.15-alpha.19.39.a",
"fabric-api-base": "*", "fabric-api-base": "*",
"fabric-rendering-v1": "*" "fabric-rendering-v1": "*"

View file

@ -16,7 +16,7 @@
"FabricMC" "FabricMC"
], ],
"depends": { "depends": {
"fabricloader": ">=0.15.6" "fabricloader": ">=0.15.11"
}, },
"description": "Contains the essentials for Fabric API modules.", "description": "Contains the essentials for Fabric API modules.",
"custom": { "custom": {

View file

@ -16,7 +16,7 @@
"FabricMC" "FabricMC"
], ],
"depends": { "depends": {
"fabricloader": ">=0.15.6", "fabricloader": ">=0.15.11",
"fabric-api-base": "*", "fabric-api-base": "*",
"fabric-lifecycle-events-v1": "*" "fabric-lifecycle-events-v1": "*"
}, },

View file

@ -16,7 +16,7 @@
"FabricMC" "FabricMC"
], ],
"depends": { "depends": {
"fabricloader": ">=0.15.6", "fabricloader": ">=0.15.11",
"minecraft": ">=1.16.2" "minecraft": ">=1.16.2"
}, },
"description": "Hooks for adding biomes to the default world generator.", "description": "Hooks for adding biomes to the default world generator.",

View file

@ -16,7 +16,7 @@
"FabricMC" "FabricMC"
], ],
"depends": { "depends": {
"fabricloader": ">=0.15.6" "fabricloader": ">=0.15.11"
}, },
"entrypoints": { "entrypoints": {
}, },

View file

@ -16,7 +16,7 @@
"FabricMC" "FabricMC"
], ],
"depends": { "depends": {
"fabricloader": ">=0.15.6" "fabricloader": ">=0.15.11"
}, },
"description": "Hooks for block views", "description": "Hooks for block views",
"mixins": [ "mixins": [

View file

@ -16,7 +16,7 @@
"FabricMC" "FabricMC"
], ],
"depends": { "depends": {
"fabricloader": ">=0.15.6", "fabricloader": ">=0.15.11",
"minecraft": ">=1.15-alpha.19.38.b", "minecraft": ">=1.15-alpha.19.38.b",
"fabric-api-base": "*" "fabric-api-base": "*"
}, },

View file

@ -16,7 +16,7 @@
"FabricMC" "FabricMC"
], ],
"depends": { "depends": {
"fabricloader": ">=0.15.6" "fabricloader": ">=0.15.11"
}, },
"description": "Adds the ability to load tags from the local mods.", "description": "Adds the ability to load tags from the local mods.",
"custom": { "custom": {

View file

@ -16,7 +16,7 @@
"FabricMC" "FabricMC"
], ],
"depends": { "depends": {
"fabricloader": ">=0.15.6", "fabricloader": ">=0.15.11",
"fabric-api-base": "*", "fabric-api-base": "*",
"minecraft": ">1.19-alpha.22.11.a" "minecraft": ">1.19-alpha.22.11.a"
}, },

View file

@ -16,7 +16,7 @@
"FabricMC" "FabricMC"
], ],
"depends": { "depends": {
"fabricloader": ">=0.15.6", "fabricloader": ">=0.15.11",
"fabric-api-base": "*", "fabric-api-base": "*",
"fabric-lifecycle-events-v1": "*", "fabric-lifecycle-events-v1": "*",
"fabric-resource-loader-v0": "*" "fabric-resource-loader-v0": "*"

View file

@ -16,7 +16,7 @@
"FabricMC" "FabricMC"
], ],
"depends": { "depends": {
"fabricloader": ">=0.15.6", "fabricloader": ">=0.15.11",
"minecraft": ">=1.18.2" "minecraft": ">=1.18.2"
}, },
"description": "Contains common tags used by mods for vanilla things.", "description": "Contains common tags used by mods for vanilla things.",

View file

@ -16,7 +16,7 @@
"FabricMC" "FabricMC"
], ],
"depends": { "depends": {
"fabricloader": ">=0.15.6", "fabricloader": ">=0.15.11",
"minecraft": ">=1.20.5-beta.1", "minecraft": ">=1.20.5-beta.1",
"fabric-lifecycle-events-v1": "*" "fabric-lifecycle-events-v1": "*"
}, },

View file

@ -37,7 +37,7 @@ public class TagUtilTest implements ModInitializer {
@Override @Override
public void onInitialize() { public void onInitialize() {
ServerLifecycleEvents.SERVER_STARTED.register(server -> { ServerLifecycleEvents.SERVER_STARTED.register(server -> {
if (!TagUtil.isIn(ConventionalEnchantmentTags.INCREASE_BLOCK_DROPS, Enchantments.FORTUNE)) { if (!TagUtil.isIn(server.getRegistryManager(), ConventionalEnchantmentTags.INCREASE_BLOCK_DROPS, server.getRegistryManager().get(RegistryKeys.ENCHANTMENT).get(Enchantments.FORTUNE))) {
throw new AssertionError("Failed to find fortune in c:increase_block_drops!"); throw new AssertionError("Failed to find fortune in c:increase_block_drops!");
} }

View file

@ -16,7 +16,7 @@
"FabricMC" "FabricMC"
], ],
"depends": { "depends": {
"fabricloader": ">=0.15.6" "fabricloader": ">=0.15.11"
}, },
"description": "Adds Fabric-related debug info to crash reports.", "description": "Adds Fabric-related debug info to crash reports.",
"mixins": [ "mixins": [

View file

@ -16,7 +16,7 @@
"FabricMC" "FabricMC"
], ],
"depends": { "depends": {
"fabricloader": ">=0.15.6", "fabricloader": ">=0.15.11",
"fabric-entity-events-v1": "*", "fabric-entity-events-v1": "*",
"fabric-object-builder-api-v1": "*" "fabric-object-builder-api-v1": "*"
}, },

View file

@ -52,7 +52,7 @@ public abstract class FabricBlockLootTableProvider extends BlockLootTableGenerat
private final CompletableFuture<RegistryWrapper.WrapperLookup> registryLookup; private final CompletableFuture<RegistryWrapper.WrapperLookup> registryLookup;
protected FabricBlockLootTableProvider(FabricDataOutput dataOutput, CompletableFuture<RegistryWrapper.WrapperLookup> registryLookup) { protected FabricBlockLootTableProvider(FabricDataOutput dataOutput, CompletableFuture<RegistryWrapper.WrapperLookup> registryLookup) {
super(Collections.emptySet(), FeatureFlags.FEATURE_MANAGER.getFeatureSet()); super(Collections.emptySet(), FeatureFlags.FEATURE_MANAGER.getFeatureSet(), registryLookup.join());
this.output = dataOutput; this.output = dataOutput;
this.registryLookup = registryLookup; this.registryLookup = registryLookup;
} }
@ -73,7 +73,7 @@ public abstract class FabricBlockLootTableProvider extends BlockLootTableGenerat
} }
@Override @Override
public void accept(RegistryWrapper.WrapperLookup registryLookup, BiConsumer<RegistryKey<LootTable>, LootTable.Builder> biConsumer) { public void accept(BiConsumer<RegistryKey<LootTable>, LootTable.Builder> biConsumer) {
generate(); generate();
for (Map.Entry<RegistryKey<LootTable>, LootTable.Builder> entry : lootTables.entrySet()) { for (Map.Entry<RegistryKey<LootTable>, LootTable.Builder> entry : lootTables.entrySet()) {

View file

@ -47,6 +47,7 @@ import net.minecraft.stat.StatType;
import net.minecraft.text.TextContent; import net.minecraft.text.TextContent;
import net.minecraft.text.TranslatableTextContent; import net.minecraft.text.TranslatableTextContent;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import net.minecraft.util.Util;
import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator; import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator;
import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput; import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput;
@ -184,8 +185,8 @@ public abstract class FabricLanguageProvider implements DataProvider {
* @param enchantment The {@link Enchantment} to get the translation key from. * @param enchantment The {@link Enchantment} to get the translation key from.
* @param value The value of the entry. * @param value The value of the entry.
*/ */
default void add(Enchantment enchantment, String value) { default void addEnchantment(RegistryKey<Enchantment> enchantment, String value) {
add(enchantment.getTranslationKey(), value); add(Util.createTranslationKey("enchantment", enchantment.getValue()), value);
} }
/** /**

View file

@ -114,6 +114,7 @@ public abstract class FabricRecipeProvider extends RecipeProvider {
@Override @Override
public Advancement.Builder getAdvancementBuilder() { public Advancement.Builder getAdvancementBuilder() {
//noinspection removal
return Advancement.Builder.createUntelemetered().parent(CraftingRecipeJsonBuilder.ROOT); return Advancement.Builder.createUntelemetered().parent(CraftingRecipeJsonBuilder.ROOT);
} }
}); });

View file

@ -212,12 +212,6 @@ public abstract class FabricTagProvider<T> extends TagProvider<T> {
public EnchantmentTagProvider(FabricDataOutput output, CompletableFuture<RegistryWrapper.WrapperLookup> completableFuture) { public EnchantmentTagProvider(FabricDataOutput output, CompletableFuture<RegistryWrapper.WrapperLookup> completableFuture) {
super(output, RegistryKeys.ENCHANTMENT, completableFuture); super(output, RegistryKeys.ENCHANTMENT, completableFuture);
} }
@Override
protected RegistryKey<Enchantment> reverseLookup(Enchantment element) {
return Registries.ENCHANTMENT.getKey(element)
.orElseThrow(() -> new IllegalArgumentException("Enchantment " + element + " is not registered"));
}
} }
/** /**

View file

@ -25,13 +25,14 @@ import net.minecraft.resource.featuretoggle.FeatureFlags;
import net.fabricmc.fabric.api.resource.conditions.v1.ResourceCondition; import net.fabricmc.fabric.api.resource.conditions.v1.ResourceCondition;
import net.fabricmc.fabric.impl.datagen.FabricDataGenHelper; import net.fabricmc.fabric.impl.datagen.FabricDataGenHelper;
import net.fabricmc.fabric.mixin.datagen.loot.BlockLootTableGeneratorAccessor;
public class ConditionBlockLootTableGenerator extends BlockLootTableGenerator { public class ConditionBlockLootTableGenerator extends BlockLootTableGenerator {
private final BlockLootTableGenerator parent; private final BlockLootTableGenerator parent;
private final ResourceCondition[] conditions; private final ResourceCondition[] conditions;
public ConditionBlockLootTableGenerator(BlockLootTableGenerator parent, ResourceCondition[] conditions) { public ConditionBlockLootTableGenerator(BlockLootTableGenerator parent, ResourceCondition[] conditions) {
super(Collections.emptySet(), FeatureFlags.FEATURE_MANAGER.getFeatureSet()); super(Collections.emptySet(), FeatureFlags.FEATURE_MANAGER.getFeatureSet(), ((BlockLootTableGeneratorAccessor) parent).getRegistryLookup());
this.parent = parent; this.parent = parent;
this.conditions = conditions; this.conditions = conditions;

View file

@ -58,7 +58,7 @@ public final class FabricLootTableProviderImpl {
HashMap<Identifier, ResourceCondition[]> conditionMap = new HashMap<>(); HashMap<Identifier, ResourceCondition[]> conditionMap = new HashMap<>();
return registryLookup.thenCompose(lookup -> { return registryLookup.thenCompose(lookup -> {
provider.accept(lookup, (registryKey, builder) -> { provider.accept((registryKey, builder) -> {
ResourceCondition[] conditions = FabricDataGenHelper.consumeConditions(builder); ResourceCondition[] conditions = FabricDataGenHelper.consumeConditions(builder);
conditionMap.put(registryKey.getValue(), conditions); conditionMap.put(registryKey.getValue(), conditions);

View file

@ -0,0 +1,29 @@
/*
* Copyright (c) 2016, 2017, 2018, 2019 FabricMC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package net.fabricmc.fabric.mixin.datagen.loot;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Accessor;
import net.minecraft.data.server.loottable.BlockLootTableGenerator;
import net.minecraft.registry.RegistryWrapper;
@Mixin(BlockLootTableGenerator.class)
public interface BlockLootTableGeneratorAccessor {
@Accessor()
RegistryWrapper.WrapperLookup getRegistryLookup();
}

View file

@ -54,13 +54,7 @@ transitive-accessible class net/minecraft/data/client/BlockStateModelGenerator$B
transitive-accessible class net/minecraft/data/client/BlockStateModelGenerator$LogTexturePool transitive-accessible class net/minecraft/data/client/BlockStateModelGenerator$LogTexturePool
transitive-accessible class net/minecraft/data/client/BlockStateModelGenerator$BuiltinModelPool transitive-accessible class net/minecraft/data/client/BlockStateModelGenerator$BuiltinModelPool
transitive-accessible field net/minecraft/data/server/loottable/BlockLootTableGenerator WITH_SILK_TOUCH Lnet/minecraft/loot/condition/LootCondition$Builder;
transitive-accessible field net/minecraft/data/server/loottable/BlockLootTableGenerator WITHOUT_SILK_TOUCH Lnet/minecraft/loot/condition/LootCondition$Builder;
transitive-accessible field net/minecraft/data/server/loottable/BlockLootTableGenerator WITH_SHEARS Lnet/minecraft/loot/condition/LootCondition$Builder; transitive-accessible field net/minecraft/data/server/loottable/BlockLootTableGenerator WITH_SHEARS Lnet/minecraft/loot/condition/LootCondition$Builder;
transitive-accessible field net/minecraft/data/server/loottable/BlockLootTableGenerator WITH_SILK_TOUCH_OR_SHEARS Lnet/minecraft/loot/condition/LootCondition$Builder;
transitive-accessible field net/minecraft/data/server/loottable/BlockLootTableGenerator WITHOUT_SILK_TOUCH_NOR_SHEARS Lnet/minecraft/loot/condition/LootCondition$Builder;
transitive-accessible field net/minecraft/data/server/loottable/BlockLootTableGenerator SAPLING_DROP_CHANCE [F
transitive-accessible field net/minecraft/data/server/loottable/BlockLootTableGenerator LEAVES_STICK_DROP_CHANCE [F
### Generated access wideners below ### Generated access wideners below
@ -259,6 +253,10 @@ transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator registerRoots (Lnet/minecraft/block/Block;Lnet/minecraft/block/Block;)V transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator registerRoots (Lnet/minecraft/block/Block;Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator addJigsawOrientationToVariant (Lnet/minecraft/block/enums/Orientation;Lnet/minecraft/data/client/BlockStateVariant;)Lnet/minecraft/data/client/BlockStateVariant; transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator addJigsawOrientationToVariant (Lnet/minecraft/block/enums/Orientation;Lnet/minecraft/data/client/BlockStateVariant;)Lnet/minecraft/data/client/BlockStateVariant;
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator registerCandle (Lnet/minecraft/block/Block;Lnet/minecraft/block/Block;)V transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator registerCandle (Lnet/minecraft/block/Block;Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/server/loottable/BlockLootTableGenerator createSilkTouchCondition ()Lnet/minecraft/loot/condition/LootCondition$Builder;
transitive-accessible method net/minecraft/data/server/loottable/BlockLootTableGenerator createWithoutSilkTouchCondition ()Lnet/minecraft/loot/condition/LootCondition$Builder;
transitive-accessible method net/minecraft/data/server/loottable/BlockLootTableGenerator createWithShearsOrSilkTouchCondition ()Lnet/minecraft/loot/condition/LootCondition$Builder;
transitive-accessible method net/minecraft/data/server/loottable/BlockLootTableGenerator createWithoutShearsOrSilkTouchCondition ()Lnet/minecraft/loot/condition/LootCondition$Builder;
transitive-accessible method net/minecraft/data/server/loottable/BlockLootTableGenerator applyExplosionDecay (Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/loot/function/LootFunctionConsumingBuilder;)Lnet/minecraft/loot/function/LootFunctionConsumingBuilder; transitive-accessible method net/minecraft/data/server/loottable/BlockLootTableGenerator applyExplosionDecay (Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/loot/function/LootFunctionConsumingBuilder;)Lnet/minecraft/loot/function/LootFunctionConsumingBuilder;
transitive-accessible method net/minecraft/data/server/loottable/BlockLootTableGenerator addSurvivesExplosionCondition (Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/loot/condition/LootConditionConsumingBuilder;)Lnet/minecraft/loot/condition/LootConditionConsumingBuilder; transitive-accessible method net/minecraft/data/server/loottable/BlockLootTableGenerator addSurvivesExplosionCondition (Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/loot/condition/LootConditionConsumingBuilder;)Lnet/minecraft/loot/condition/LootConditionConsumingBuilder;
transitive-accessible method net/minecraft/data/server/loottable/BlockLootTableGenerator drops (Lnet/minecraft/block/Block;Lnet/minecraft/loot/condition/LootCondition$Builder;Lnet/minecraft/loot/entry/LootPoolEntry$Builder;)Lnet/minecraft/loot/LootTable$Builder; transitive-accessible method net/minecraft/data/server/loottable/BlockLootTableGenerator drops (Lnet/minecraft/block/Block;Lnet/minecraft/loot/condition/LootCondition$Builder;Lnet/minecraft/loot/entry/LootPoolEntry$Builder;)Lnet/minecraft/loot/LootTable$Builder;

View file

@ -3,11 +3,12 @@
"package": "net.fabricmc.fabric.mixin.datagen", "package": "net.fabricmc.fabric.mixin.datagen",
"compatibilityLevel": "JAVA_17", "compatibilityLevel": "JAVA_17",
"mixins": [ "mixins": [
"loot.BlockLootTableGeneratorMixin",
"DataProviderMixin", "DataProviderMixin",
"TagProviderMixin",
"ModelProviderMixin", "ModelProviderMixin",
"TagBuilderMixin" "TagBuilderMixin",
"TagProviderMixin",
"loot.BlockLootTableGeneratorAccessor",
"loot.BlockLootTableGeneratorMixin"
], ],
"server": [ "server": [
"server.MainMixin" "server.MainMixin"

View file

@ -16,7 +16,7 @@
"FabricMC" "FabricMC"
], ],
"depends": { "depends": {
"fabricloader": ">=0.15.6" "fabricloader": ">=0.15.11"
}, },
"description": "Allows for automatic data generation.", "description": "Allows for automatic data generation.",
"mixins": [ "mixins": [

View file

@ -58,7 +58,6 @@ import net.minecraft.loot.LootTable;
import net.minecraft.loot.LootTables; import net.minecraft.loot.LootTables;
import net.minecraft.loot.condition.BlockStatePropertyLootCondition; import net.minecraft.loot.condition.BlockStatePropertyLootCondition;
import net.minecraft.loot.condition.LootCondition; import net.minecraft.loot.condition.LootCondition;
import net.minecraft.loot.condition.LootConditionTypes;
import net.minecraft.loot.context.LootContextTypes; import net.minecraft.loot.context.LootContextTypes;
import net.minecraft.loot.entry.ItemEntry; import net.minecraft.loot.entry.ItemEntry;
import net.minecraft.loot.provider.number.ConstantLootNumberProvider; import net.minecraft.loot.provider.number.ConstantLootNumberProvider;
@ -403,7 +402,7 @@ public class DataGeneratorTestEntrypoint implements DataGeneratorEntrypoint {
} }
@Override @Override
public void accept(RegistryWrapper.WrapperLookup registryLookup, BiConsumer<RegistryKey<LootTable>, LootTable.Builder> consumer) { public void accept(BiConsumer<RegistryKey<LootTable>, LootTable.Builder> consumer) {
withConditions(consumer, ALWAYS_LOADED).accept( withConditions(consumer, ALWAYS_LOADED).accept(
LootTables.PIGLIN_BARTERING_GAMEPLAY, LootTables.PIGLIN_BARTERING_GAMEPLAY,
LootTable.builder().pool( LootTable.builder().pool(
@ -435,7 +434,7 @@ public class DataGeneratorTestEntrypoint implements DataGeneratorEntrypoint {
private static class TestPredicateProvider extends FabricCodecDataProvider<LootCondition> { private static class TestPredicateProvider extends FabricCodecDataProvider<LootCondition> {
private TestPredicateProvider(FabricDataOutput dataOutput, CompletableFuture<RegistryWrapper.WrapperLookup> registriesFuture) { private TestPredicateProvider(FabricDataOutput dataOutput, CompletableFuture<RegistryWrapper.WrapperLookup> registriesFuture) {
super(dataOutput, registriesFuture, DataOutput.OutputType.DATA_PACK, "predicates", LootConditionTypes.CODEC); super(dataOutput, registriesFuture, DataOutput.OutputType.DATA_PACK, "predicates", LootCondition.CODEC);
} }
@Override @Override

View file

@ -49,12 +49,6 @@ transitive-accessible class net/minecraft/data/client/BlockStateModelGenerator$B
transitive-accessible class net/minecraft/data/client/BlockStateModelGenerator$LogTexturePool transitive-accessible class net/minecraft/data/client/BlockStateModelGenerator$LogTexturePool
transitive-accessible class net/minecraft/data/client/BlockStateModelGenerator$BuiltinModelPool transitive-accessible class net/minecraft/data/client/BlockStateModelGenerator$BuiltinModelPool
transitive-accessible field net/minecraft/data/server/loottable/BlockLootTableGenerator WITH_SILK_TOUCH Lnet/minecraft/loot/condition/LootCondition$Builder;
transitive-accessible field net/minecraft/data/server/loottable/BlockLootTableGenerator WITHOUT_SILK_TOUCH Lnet/minecraft/loot/condition/LootCondition$Builder;
transitive-accessible field net/minecraft/data/server/loottable/BlockLootTableGenerator WITH_SHEARS Lnet/minecraft/loot/condition/LootCondition$Builder; transitive-accessible field net/minecraft/data/server/loottable/BlockLootTableGenerator WITH_SHEARS Lnet/minecraft/loot/condition/LootCondition$Builder;
transitive-accessible field net/minecraft/data/server/loottable/BlockLootTableGenerator WITH_SILK_TOUCH_OR_SHEARS Lnet/minecraft/loot/condition/LootCondition$Builder;
transitive-accessible field net/minecraft/data/server/loottable/BlockLootTableGenerator WITHOUT_SILK_TOUCH_NOR_SHEARS Lnet/minecraft/loot/condition/LootCondition$Builder;
transitive-accessible field net/minecraft/data/server/loottable/BlockLootTableGenerator SAPLING_DROP_CHANCE [F
transitive-accessible field net/minecraft/data/server/loottable/BlockLootTableGenerator LEAVES_STICK_DROP_CHANCE [F
### Generated access wideners below ### Generated access wideners below

View file

@ -15,7 +15,7 @@
"FabricMC" "FabricMC"
], ],
"depends": { "depends": {
"fabricloader": ">=0.15.6", "fabricloader": ">=0.15.11",
"minecraft": ">=1.16-rc.3", "minecraft": ">=1.16-rc.3",
"fabric-api-base": "*" "fabric-api-base": "*"
}, },

View file

@ -16,7 +16,7 @@
"FabricMC" "FabricMC"
], ],
"depends": { "depends": {
"fabricloader": ">=0.15.6" "fabricloader": ">=0.15.11"
}, },
"description": "Events to hook into entities.", "description": "Events to hook into entities.",
"mixins": [ "mixins": [

View file

@ -16,7 +16,7 @@
"FabricMC" "FabricMC"
], ],
"depends": { "depends": {
"fabricloader": ">=0.15.6", "fabricloader": ">=0.15.11",
"fabric-api-base": "*", "fabric-api-base": "*",
"minecraft": ">=1.15-alpha.19.37.a" "minecraft": ">=1.15-alpha.19.37.a"
}, },

View file

@ -16,7 +16,7 @@
"FabricMC" "FabricMC"
], ],
"depends": { "depends": {
"fabricloader": ">=0.15.6" "fabricloader": ">=0.15.11"
}, },
"description": "Allows registration of custom game rules.", "description": "Allows registration of custom game rules.",
"mixins": [ "mixins": [

View file

@ -21,7 +21,7 @@
] ]
}, },
"depends": { "depends": {
"fabricloader": ">=0.15.6", "fabricloader": ">=0.15.11",
"fabric-resource-loader-v0": "*" "fabric-resource-loader-v0": "*"
}, },
"description": "Allows registration of custom game tests.", "description": "Allows registration of custom game tests.",

View file

@ -18,6 +18,7 @@ package net.fabricmc.fabric.api.item.v1;
import net.minecraft.enchantment.Enchantment; import net.minecraft.enchantment.Enchantment;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.registry.entry.RegistryEntry;
import net.fabricmc.fabric.api.event.Event; import net.fabricmc.fabric.api.event.Event;
import net.fabricmc.fabric.api.event.EventFactory; import net.fabricmc.fabric.api.event.EventFactory;
@ -44,7 +45,7 @@ public final class EnchantmentEvents {
* <p>Note that allowing an enchantment using this event does not guarantee the item will receive that enchantment, * <p>Note that allowing an enchantment using this event does not guarantee the item will receive that enchantment,
* only that it isn't forbidden from doing so.</p> * only that it isn't forbidden from doing so.</p>
* *
* @see AllowEnchanting#allowEnchanting(Enchantment, ItemStack, EnchantingContext) * @see AllowEnchanting#allowEnchanting(RegistryEntry, ItemStack, EnchantingContext)
* @see Enchantment#isAcceptableItem(ItemStack) * @see Enchantment#isAcceptableItem(ItemStack)
* @see FabricItem#canBeEnchantedWith(ItemStack, Enchantment, EnchantingContext) * @see FabricItem#canBeEnchantedWith(ItemStack, Enchantment, EnchantingContext)
*/ */
@ -76,7 +77,7 @@ public final class EnchantmentEvents {
* @see EnchantingContext * @see EnchantingContext
*/ */
TriState allowEnchanting( TriState allowEnchanting(
Enchantment enchantment, RegistryEntry<Enchantment> enchantment,
ItemStack target, ItemStack target,
EnchantingContext enchantingContext EnchantingContext enchantingContext
); );

View file

@ -21,6 +21,7 @@ import net.minecraft.enchantment.Enchantment;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.registry.entry.RegistryEntry;
import net.minecraft.util.Hand; import net.minecraft.util.Hand;
import net.fabricmc.fabric.impl.item.FabricItemInternals; import net.fabricmc.fabric.impl.item.FabricItemInternals;
@ -124,8 +125,8 @@ public interface FabricItem {
* @param context the context in which the enchantment is being checked * @param context the context in which the enchantment is being checked
* @return whether the enchantment is allowed to apply to the stack * @return whether the enchantment is allowed to apply to the stack
*/ */
default boolean canBeEnchantedWith(ItemStack stack, Enchantment enchantment, EnchantingContext context) { default boolean canBeEnchantedWith(ItemStack stack, RegistryEntry<Enchantment> enchantment, EnchantingContext context) {
return enchantment.isAcceptableItem(stack); return enchantment.value().isAcceptableItem(stack);
} }
/** /**

View file

@ -19,6 +19,7 @@ package net.fabricmc.fabric.api.item.v1;
import net.minecraft.enchantment.Enchantment; import net.minecraft.enchantment.Enchantment;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.registry.entry.RegistryEntry;
import net.fabricmc.fabric.api.util.TriState; import net.fabricmc.fabric.api.util.TriState;
@ -49,9 +50,9 @@ public interface FabricItemStack {
* @param enchantment the enchantment to check * @param enchantment the enchantment to check
* @param context the context in which the enchantment is being checked * @param context the context in which the enchantment is being checked
* @return whether the enchantment is allowed to apply to the stack * @return whether the enchantment is allowed to apply to the stack
* @see FabricItem#canBeEnchantedWith(ItemStack, Enchantment, EnchantingContext) * @see FabricItem#canBeEnchantedWith(ItemStack, RegistryEntry, EnchantingContext)
*/ */
default boolean canBeEnchantedWith(Enchantment enchantment, EnchantingContext context) { default boolean canBeEnchantedWith(RegistryEntry<Enchantment> enchantment, EnchantingContext context) {
TriState result = EnchantmentEvents.ALLOW_ENCHANTING.invoker().allowEnchanting( TriState result = EnchantmentEvents.ALLOW_ENCHANTING.invoker().allowEnchanting(
enchantment, enchantment,
(ItemStack) this, (ItemStack) this,

View file

@ -37,7 +37,7 @@ public abstract class AbstractFurnaceBlockEntityMixin {
private static final ThreadLocal<ItemStack> REMAINDER_STACK = new ThreadLocal<>(); private static final ThreadLocal<ItemStack> REMAINDER_STACK = new ThreadLocal<>();
@Inject(method = "tick", at = @At(value = "INVOKE", target = "Lnet/minecraft/item/ItemStack;getItem()Lnet/minecraft/item/Item;"), locals = LocalCapture.CAPTURE_FAILHARD, allow = 1) @Inject(method = "tick", at = @At(value = "INVOKE", target = "Lnet/minecraft/item/ItemStack;getItem()Lnet/minecraft/item/Item;"), locals = LocalCapture.CAPTURE_FAILHARD, allow = 1)
private static void getStackRemainder(World world, BlockPos pos, BlockState state, AbstractFurnaceBlockEntity blockEntity, CallbackInfo ci, boolean bl, boolean bl2, ItemStack itemStack, boolean bl3, boolean bl4, RecipeEntry<?> recipe, int i) { private static void getStackRemainder(World world, BlockPos pos, BlockState state, AbstractFurnaceBlockEntity blockEntity, CallbackInfo ci, boolean bl, boolean bl2, ItemStack itemStack, ItemStack itemStack2, boolean bl3, boolean bl4, RecipeEntry recipeEntry, int i) {
REMAINDER_STACK.set(itemStack.getRecipeRemainder()); REMAINDER_STACK.set(itemStack.getRecipeRemainder());
} }

View file

@ -16,6 +16,7 @@
package net.fabricmc.fabric.mixin.item; package net.fabricmc.fabric.mixin.item;
import com.llamalad7.mixinextras.sugar.Local;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.At;
@ -24,6 +25,7 @@ import org.spongepowered.asm.mixin.injection.Redirect;
import net.minecraft.enchantment.Enchantment; import net.minecraft.enchantment.Enchantment;
import net.minecraft.entity.player.PlayerInventory; import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.registry.entry.RegistryEntry;
import net.minecraft.screen.AnvilScreenHandler; import net.minecraft.screen.AnvilScreenHandler;
import net.minecraft.screen.ForgingScreenHandler; import net.minecraft.screen.ForgingScreenHandler;
import net.minecraft.screen.ScreenHandlerContext; import net.minecraft.screen.ScreenHandlerContext;
@ -44,7 +46,7 @@ abstract class AnvilScreenHandlerMixin extends ForgingScreenHandler {
target = "Lnet/minecraft/enchantment/Enchantment;isAcceptableItem(Lnet/minecraft/item/ItemStack;)Z" target = "Lnet/minecraft/enchantment/Enchantment;isAcceptableItem(Lnet/minecraft/item/ItemStack;)Z"
) )
) )
private boolean callAllowEnchantingEvent(Enchantment instance, ItemStack stack) { private boolean callAllowEnchantingEvent(Enchantment instance, ItemStack stack, @Local RegistryEntry<Enchantment> registryEntry) {
return stack.canBeEnchantedWith(instance, EnchantingContext.ANVIL); return stack.canBeEnchantedWith(registryEntry, EnchantingContext.ANVIL);
} }
} }

View file

@ -16,13 +16,18 @@
package net.fabricmc.fabric.mixin.item; package net.fabricmc.fabric.mixin.item;
import java.util.Collection;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect; import org.spongepowered.asm.mixin.injection.Redirect;
import net.minecraft.enchantment.Enchantment; import net.minecraft.enchantment.Enchantment;
import net.minecraft.entity.Entity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.registry.entry.RegistryEntry;
import net.minecraft.server.command.EnchantCommand; import net.minecraft.server.command.EnchantCommand;
import net.minecraft.server.command.ServerCommandSource;
import net.fabricmc.fabric.api.item.v1.EnchantingContext; import net.fabricmc.fabric.api.item.v1.EnchantingContext;
@ -32,7 +37,7 @@ abstract class EnchantCommandMixin {
method = "execute", method = "execute",
at = @At(value = "INVOKE", target = "Lnet/minecraft/enchantment/Enchantment;isAcceptableItem(Lnet/minecraft/item/ItemStack;)Z") at = @At(value = "INVOKE", target = "Lnet/minecraft/enchantment/Enchantment;isAcceptableItem(Lnet/minecraft/item/ItemStack;)Z")
) )
private static boolean callAllowEnchantingEvent(Enchantment instance, ItemStack stack) { private static boolean callAllowEnchantingEvent(Enchantment instance, ItemStack stack, ServerCommandSource source, Collection<? extends Entity> targets, RegistryEntry<Enchantment> enchantment) {
return stack.canBeEnchantedWith(instance, EnchantingContext.ENCHANT_COMMAND); return stack.canBeEnchantedWith(enchantment, EnchantingContext.ENCHANT_COMMAND);
} }
} }

View file

@ -23,16 +23,17 @@ import org.spongepowered.asm.mixin.injection.Redirect;
import net.minecraft.enchantment.Enchantment; import net.minecraft.enchantment.Enchantment;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.loot.function.EnchantRandomlyLootFunction; import net.minecraft.loot.function.EnchantRandomlyLootFunction;
import net.minecraft.registry.entry.RegistryEntry;
import net.fabricmc.fabric.api.item.v1.EnchantingContext; import net.fabricmc.fabric.api.item.v1.EnchantingContext;
@Mixin(EnchantRandomlyLootFunction.class) @Mixin(EnchantRandomlyLootFunction.class)
abstract class EnchantRandomlyLootFunctionMixin { abstract class EnchantRandomlyLootFunctionMixin {
@Redirect( @Redirect(
method = "method_53327", method = "method_60291",
at = @At(value = "INVOKE", target = "Lnet/minecraft/enchantment/Enchantment;isAcceptableItem(Lnet/minecraft/item/ItemStack;)Z") at = @At(value = "INVOKE", target = "Lnet/minecraft/enchantment/Enchantment;isAcceptableItem(Lnet/minecraft/item/ItemStack;)Z")
) )
private static boolean callAllowEnchantingEvent(Enchantment instance, ItemStack stack) { private static boolean callAllowEnchantingEvent(Enchantment enchantment, ItemStack stack, boolean bl, ItemStack itemStack, RegistryEntry<Enchantment> registryEntry) {
return stack.canBeEnchantedWith(instance, EnchantingContext.LOOT_RANDOM_ENCHANTMENT); return stack.canBeEnchantedWith(registryEntry, EnchantingContext.LOOT_RANDOM_ENCHANTMENT);
} }
} }

View file

@ -23,16 +23,17 @@ import org.spongepowered.asm.mixin.injection.Redirect;
import net.minecraft.enchantment.Enchantment; import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.registry.entry.RegistryEntry;
import net.fabricmc.fabric.api.item.v1.EnchantingContext; import net.fabricmc.fabric.api.item.v1.EnchantingContext;
@Mixin(EnchantmentHelper.class) @Mixin(EnchantmentHelper.class)
abstract class EnchantmentHelperMixin { abstract class EnchantmentHelperMixin {
@Redirect( @Redirect(
method = "getPossibleEntries", method = "method_60143",
at = @At(value = "INVOKE", target = "Lnet/minecraft/enchantment/Enchantment;isAcceptableItem(Lnet/minecraft/item/ItemStack;)Z") at = @At(value = "INVOKE", target = "Lnet/minecraft/enchantment/Enchantment;isPrimaryItem(Lnet/minecraft/item/ItemStack;)Z")
) )
private static boolean useCustomEnchantingChecks(Enchantment instance, ItemStack stack) { private static boolean useCustomEnchantingChecks(Enchantment instance, ItemStack stack, ItemStack itemStack, boolean bl, RegistryEntry<Enchantment> registryEntry) {
return stack.canBeEnchantedWith(instance, EnchantingContext.RANDOM_ENCHANTMENT); return stack.canBeEnchantedWith(registryEntry, EnchantingContext.RANDOM_ENCHANTMENT);
} }
} }

View file

@ -28,7 +28,7 @@ import net.minecraft.entity.EquipmentSlot;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.server.network.ServerPlayerEntity; import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.util.math.random.Random; import net.minecraft.server.world.ServerWorld;
import net.fabricmc.fabric.api.item.v1.CustomDamageHandler; import net.fabricmc.fabric.api.item.v1.CustomDamageHandler;
import net.fabricmc.fabric.api.item.v1.FabricItemStack; import net.fabricmc.fabric.api.item.v1.FabricItemStack;
@ -38,8 +38,8 @@ import net.fabricmc.fabric.impl.item.ItemExtensions;
public abstract class ItemStackMixin implements FabricItemStack { public abstract class ItemStackMixin implements FabricItemStack {
@Shadow public abstract Item getItem(); @Shadow public abstract Item getItem();
@WrapOperation(method = "damage(ILnet/minecraft/entity/LivingEntity;Lnet/minecraft/entity/EquipmentSlot;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/item/ItemStack;damage(ILnet/minecraft/util/math/random/Random;Lnet/minecraft/server/network/ServerPlayerEntity;Ljava/lang/Runnable;)V")) @WrapOperation(method = "damage(ILnet/minecraft/entity/LivingEntity;Lnet/minecraft/entity/EquipmentSlot;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/item/ItemStack;damage(ILnet/minecraft/server/world/ServerWorld;Lnet/minecraft/server/network/ServerPlayerEntity;Ljava/lang/Runnable;)V"))
private void hookDamage(ItemStack instance, int amount, Random random, ServerPlayerEntity serverPlayerEntity, Runnable runnable, Operation<Void> original, @Local(argsOnly = true) EquipmentSlot slot) { private void hookDamage(ItemStack instance, int amount, ServerWorld serverWorld, ServerPlayerEntity serverPlayerEntity, Runnable runnable, Operation<Void> original, @Local(argsOnly = true) EquipmentSlot slot) {
CustomDamageHandler handler = ((ItemExtensions) getItem()).fabric_getCustomDamageHandler(); CustomDamageHandler handler = ((ItemExtensions) getItem()).fabric_getCustomDamageHandler();
if (handler != null) { if (handler != null) {
@ -54,6 +54,6 @@ public abstract class ItemStackMixin implements FabricItemStack {
if (mut.booleanValue()) return; if (mut.booleanValue()) return;
} }
original.call(instance, amount, random, serverPlayerEntity, runnable); original.call(instance, amount, serverWorld, serverPlayerEntity, runnable);
} }
} }

View file

@ -23,20 +23,20 @@ import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import org.spongepowered.asm.mixin.injection.callback.LocalCapture; import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
import net.minecraft.inventory.Inventory;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.Items; import net.minecraft.item.Items;
import net.minecraft.recipe.Recipe; import net.minecraft.recipe.Recipe;
import net.minecraft.recipe.input.RecipeInput;
import net.minecraft.util.collection.DefaultedList; import net.minecraft.util.collection.DefaultedList;
import net.fabricmc.fabric.impl.item.RecipeRemainderHandler; import net.fabricmc.fabric.impl.item.RecipeRemainderHandler;
@Mixin(Recipe.class) @Mixin(Recipe.class)
public interface RecipeMixin<C extends Inventory> { public interface RecipeMixin<T extends RecipeInput> {
@Inject(method = "getRemainder", at = @At(value = "INVOKE", target = "Lnet/minecraft/inventory/Inventory;getStack(I)Lnet/minecraft/item/ItemStack;"), locals = LocalCapture.CAPTURE_FAILHARD) @Inject(method = "getRemainder", at = @At(value = "INVOKE", target = "Lnet/minecraft/recipe/input/RecipeInput;getStackInSlot(I)Lnet/minecraft/item/ItemStack;"), locals = LocalCapture.CAPTURE_FAILHARD)
default void captureStack(C inventory, CallbackInfoReturnable<DefaultedList<ItemStack>> cir, DefaultedList<ItemStack> defaultedList, int i) { default void captureStack(T inventory, CallbackInfoReturnable<DefaultedList<ItemStack>> cir, DefaultedList<ItemStack> defaultedList, int i) {
RecipeRemainderHandler.REMAINDER_STACK.set(inventory.getStack(i).getRecipeRemainder()); RecipeRemainderHandler.REMAINDER_STACK.set(inventory.getStackInSlot(i).getRecipeRemainder());
} }
@Redirect(method = "getRemainder", at = @At(value = "INVOKE", target = "Lnet/minecraft/item/Item;hasRecipeRemainder()Z")) @Redirect(method = "getRemainder", at = @At(value = "INVOKE", target = "Lnet/minecraft/item/Item;hasRecipeRemainder()Z"))

View file

@ -23,7 +23,7 @@
} }
], ],
"depends": { "depends": {
"fabricloader": ">=0.15.6", "fabricloader": ">=0.15.11",
"fabric-api-base": "*" "fabric-api-base": "*"
}, },
"description": "Hooks for items", "description": "Hooks for items",

View file

@ -16,7 +16,7 @@
package net.fabricmc.fabric.test.item; package net.fabricmc.fabric.test.item;
import net.minecraft.component.DataComponentType; import net.minecraft.component.ComponentType;
import net.minecraft.enchantment.Enchantment; import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.enchantment.Enchantments; import net.minecraft.enchantment.Enchantments;
@ -29,6 +29,7 @@ import net.minecraft.network.codec.PacketCodecs;
import net.minecraft.potion.Potions; import net.minecraft.potion.Potions;
import net.minecraft.registry.Registries; import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry; import net.minecraft.registry.Registry;
import net.minecraft.registry.entry.RegistryEntry;
import net.minecraft.text.Text; import net.minecraft.text.Text;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import net.minecraft.util.dynamic.Codecs; import net.minecraft.util.dynamic.Codecs;
@ -42,8 +43,8 @@ import net.fabricmc.fabric.api.registry.FuelRegistry;
import net.fabricmc.fabric.api.util.TriState; import net.fabricmc.fabric.api.util.TriState;
public class CustomDamageTest implements ModInitializer { public class CustomDamageTest implements ModInitializer {
public static final DataComponentType<Integer> WEIRD = Registry.register(Registries.DATA_COMPONENT_TYPE, new Identifier("fabric-item-api-v1-testmod", "weird"), public static final ComponentType<Integer> WEIRD = Registry.register(Registries.DATA_COMPONENT_TYPE, new Identifier("fabric-item-api-v1-testmod", "weird"),
DataComponentType.<Integer>builder().codec(Codecs.NONNEGATIVE_INT).packetCodec(PacketCodecs.VAR_INT).build()); ComponentType.<Integer>builder().codec(Codecs.NONNEGATIVE_INT).packetCodec(PacketCodecs.VAR_INT).build());
public static final CustomDamageHandler WEIRD_DAMAGE_HANDLER = (stack, amount, entity, slot, breakCallback) -> { public static final CustomDamageHandler WEIRD_DAMAGE_HANDLER = (stack, amount, entity, slot, breakCallback) -> {
// If sneaking, apply all damage to vanilla. Otherwise, increment a tag on the stack by one and don't apply any damage // If sneaking, apply all damage to vanilla. Otherwise, increment a tag on the stack by one and don't apply any damage
if (entity.isSneaking()) { if (entity.isSneaking()) {
@ -62,9 +63,17 @@ public class CustomDamageTest implements ModInitializer {
FuelRegistry.INSTANCE.add(WEIRD_PICK, 200); FuelRegistry.INSTANCE.add(WEIRD_PICK, 200);
FabricBrewingRecipeRegistryBuilder.BUILD.register(builder -> builder.registerPotionRecipe(Potions.WATER, WEIRD_PICK, Potions.AWKWARD)); FabricBrewingRecipeRegistryBuilder.BUILD.register(builder -> builder.registerPotionRecipe(Potions.WATER, WEIRD_PICK, Potions.AWKWARD));
EnchantmentEvents.ALLOW_ENCHANTING.register(((enchantment, target, enchantingContext) -> { EnchantmentEvents.ALLOW_ENCHANTING.register(((enchantment, target, enchantingContext) -> {
if (target.isOf(Items.DIAMOND_PICKAXE) // TODO 1.21 this is clearly wrong
&& enchantment == Enchantments.SHARPNESS boolean hasSilkTouch = false;
&& EnchantmentHelper.hasSilkTouch(target)) {
for (RegistryEntry<Enchantment> entry : EnchantmentHelper.getEnchantments(target).getEnchantments()) {
if (entry.getKey().orElse(null) == Enchantments.SILK_TOUCH) {
hasSilkTouch = true;
break;
}
}
if (target.isOf(Items.DIAMOND_PICKAXE) && enchantment == Enchantments.SHARPNESS && hasSilkTouch) {
return TriState.TRUE; return TriState.TRUE;
} }
@ -96,7 +105,7 @@ public class CustomDamageTest implements ModInitializer {
} }
@Override @Override
public boolean canBeEnchantedWith(ItemStack stack, Enchantment enchantment, EnchantingContext context) { public boolean canBeEnchantedWith(ItemStack stack, RegistryEntry<Enchantment> enchantment, EnchantingContext context) {
return context == EnchantingContext.ANVIL && enchantment == Enchantments.FIRE_ASPECT return context == EnchantingContext.ANVIL && enchantment == Enchantments.FIRE_ASPECT
|| enchantment != Enchantments.FORTUNE && super.canBeEnchantedWith(stack, enchantment, context); || enchantment != Enchantments.FORTUNE && super.canBeEnchantedWith(stack, enchantment, context);
} }

View file

@ -16,7 +16,7 @@
package net.fabricmc.fabric.test.item; package net.fabricmc.fabric.test.item;
import net.minecraft.component.DataComponentType; import net.minecraft.component.ComponentType;
import net.minecraft.network.codec.PacketCodecs; import net.minecraft.network.codec.PacketCodecs;
import net.minecraft.registry.Registries; import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry; import net.minecraft.registry.Registry;
@ -26,8 +26,8 @@ import net.minecraft.util.dynamic.Codecs;
import net.fabricmc.api.ModInitializer; import net.fabricmc.api.ModInitializer;
public class ItemUpdateAnimationTest implements ModInitializer { public class ItemUpdateAnimationTest implements ModInitializer {
public static final DataComponentType<Integer> TICKS = Registry.register(Registries.DATA_COMPONENT_TYPE, new Identifier("fabric-item-api-v1-testmod", "ticks"), public static final ComponentType<Integer> TICKS = Registry.register(Registries.DATA_COMPONENT_TYPE, new Identifier("fabric-item-api-v1-testmod", "ticks"),
DataComponentType.<Integer>builder().codec(Codecs.NONNEGATIVE_INT).packetCodec(PacketCodecs.VAR_INT).build()); ComponentType.<Integer>builder().codec(Codecs.NONNEGATIVE_INT).packetCodec(PacketCodecs.VAR_INT).build());
@Override @Override
public void onInitialize() { public void onInitialize() {

View file

@ -16,12 +16,14 @@
package net.fabricmc.fabric.test.item.gametest; package net.fabricmc.fabric.test.item.gametest;
import net.minecraft.inventory.SimpleInventory; import java.util.List;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.Items; import net.minecraft.item.Items;
import net.minecraft.recipe.Recipe; import net.minecraft.recipe.Recipe;
import net.minecraft.recipe.RecipeSerializer; import net.minecraft.recipe.RecipeSerializer;
import net.minecraft.recipe.RecipeType; import net.minecraft.recipe.RecipeType;
import net.minecraft.recipe.input.CraftingRecipeInput;
import net.minecraft.registry.RegistryWrapper; import net.minecraft.registry.RegistryWrapper;
import net.minecraft.test.GameTest; import net.minecraft.test.GameTest;
import net.minecraft.test.GameTestException; import net.minecraft.test.GameTestException;
@ -35,11 +37,11 @@ import net.fabricmc.fabric.test.item.CustomDamageTest;
public class RecipeGameTest implements FabricGameTest { public class RecipeGameTest implements FabricGameTest {
@GameTest(templateName = EMPTY_STRUCTURE) @GameTest(templateName = EMPTY_STRUCTURE)
public void vanillaRemainderTest(TestContext context) { public void vanillaRemainderTest(TestContext context) {
Recipe<SimpleInventory> testRecipe = createTestingRecipeInstance(); Recipe<CraftingRecipeInput> testRecipe = createTestingRecipeInstance();
SimpleInventory inventory = new SimpleInventory( CraftingRecipeInput inventory = CraftingRecipeInput.create(1, 2, List.of(
new ItemStack(Items.WATER_BUCKET), new ItemStack(Items.WATER_BUCKET),
new ItemStack(Items.DIAMOND)); new ItemStack(Items.DIAMOND)));
DefaultedList<ItemStack> remainderList = testRecipe.getRemainder(inventory); DefaultedList<ItemStack> remainderList = testRecipe.getRemainder(inventory);
@ -52,13 +54,13 @@ public class RecipeGameTest implements FabricGameTest {
@GameTest(templateName = EMPTY_STRUCTURE) @GameTest(templateName = EMPTY_STRUCTURE)
public void fabricRemainderTest(TestContext context) { public void fabricRemainderTest(TestContext context) {
Recipe<SimpleInventory> testRecipe = createTestingRecipeInstance(); Recipe<CraftingRecipeInput> testRecipe = createTestingRecipeInstance();
SimpleInventory inventory = new SimpleInventory( CraftingRecipeInput inventory = CraftingRecipeInput.create(1, 4, List.of(
new ItemStack(CustomDamageTest.WEIRD_PICK), new ItemStack(CustomDamageTest.WEIRD_PICK),
withDamage(new ItemStack(CustomDamageTest.WEIRD_PICK), 10), withDamage(new ItemStack(CustomDamageTest.WEIRD_PICK), 10),
withDamage(new ItemStack(CustomDamageTest.WEIRD_PICK), 31), withDamage(new ItemStack(CustomDamageTest.WEIRD_PICK), 31),
new ItemStack(Items.DIAMOND)); new ItemStack(Items.DIAMOND)));
DefaultedList<ItemStack> remainderList = testRecipe.getRemainder(inventory); DefaultedList<ItemStack> remainderList = testRecipe.getRemainder(inventory);
@ -71,15 +73,15 @@ public class RecipeGameTest implements FabricGameTest {
context.complete(); context.complete();
} }
private Recipe<SimpleInventory> createTestingRecipeInstance() { private Recipe<CraftingRecipeInput> createTestingRecipeInstance() {
return new Recipe<>() { return new Recipe<>() {
@Override @Override
public boolean matches(SimpleInventory inventory, World world) { public boolean matches(CraftingRecipeInput recipeInput, World world) {
return true; return true;
} }
@Override @Override
public ItemStack craft(SimpleInventory inventory, RegistryWrapper.WrapperLookup wrapperLookup) { public ItemStack craft(CraftingRecipeInput recipeInput, RegistryWrapper.WrapperLookup wrapperLookup) {
return null; return null;
} }

View file

@ -52,7 +52,7 @@ abstract class ItemGroupMixin implements FabricItemGroup {
private int fabric_page = -1; private int fabric_page = -1;
@SuppressWarnings("ConstantConditions") @SuppressWarnings("ConstantConditions")
@Inject(method = "updateEntries", at = @At(value = "INVOKE", target = "Lnet/minecraft/item/ItemGroup;reloadSearchProvider()V")) @Inject(method = "updateEntries", at = @At("TAIL"))
public void getStacks(ItemGroup.DisplayContext context, CallbackInfo ci) { public void getStacks(ItemGroup.DisplayContext context, CallbackInfo ci) {
final ItemGroup self = (ItemGroup) (Object) this; final ItemGroup self = (ItemGroup) (Object) this;
final RegistryKey<ItemGroup> registryKey = Registries.ITEM_GROUP.getKey(self).orElseThrow(() -> new IllegalStateException("Unregistered item group : " + self)); final RegistryKey<ItemGroup> registryKey = Registries.ITEM_GROUP.getKey(self).orElseThrow(() -> new IllegalStateException("Unregistered item group : " + self));

View file

@ -16,7 +16,7 @@
"FabricMC" "FabricMC"
], ],
"depends": { "depends": {
"fabricloader": ">=0.15.6", "fabricloader": ">=0.15.11",
"fabric-api-base": "*", "fabric-api-base": "*",
"fabric-resource-loader-v0": "*" "fabric-resource-loader-v0": "*"
}, },

View file

@ -16,7 +16,7 @@
"FabricMC" "FabricMC"
], ],
"depends": { "depends": {
"fabricloader": ">=0.15.6" "fabricloader": ">=0.15.11"
}, },
"description": "Key Binding registry API.", "description": "Key Binding registry API.",
"mixins": [ "mixins": [

View file

@ -31,7 +31,7 @@
} }
], ],
"depends": { "depends": {
"fabricloader": ">=0.15.6", "fabricloader": ">=0.15.11",
"fabric-api-base": "*" "fabric-api-base": "*"
}, },
"description": "Events for the game's lifecycle.", "description": "Events for the game's lifecycle.",

View file

@ -16,7 +16,7 @@
"FabricMC" "FabricMC"
], ],
"depends": { "depends": {
"fabricloader": ">=0.15.6", "fabricloader": ">=0.15.11",
"fabric-api-base": "*", "fabric-api-base": "*",
"fabric-resource-loader-v0": "*" "fabric-resource-loader-v0": "*"
}, },

View file

@ -16,7 +16,7 @@
"FabricMC" "FabricMC"
], ],
"depends": { "depends": {
"fabricloader": ">=0.15.6", "fabricloader": ">=0.15.11",
"fabric-api-base": "*" "fabric-api-base": "*"
}, },
"description": "Adds message-related hooks.", "description": "Adds message-related hooks.",

View file

@ -16,7 +16,7 @@
"FabricMC" "FabricMC"
], ],
"depends": { "depends": {
"fabricloader": ">=0.15.6", "fabricloader": ">=0.15.11",
"fabric-api-base": "*" "fabric-api-base": "*"
}, },
"breaks": { "breaks": {

View file

@ -26,7 +26,7 @@
}, },
"accessWidener": "fabric-networking-api-v1.accesswidener", "accessWidener": "fabric-networking-api-v1.accesswidener",
"depends": { "depends": {
"fabricloader": ">=0.15.6", "fabricloader": ">=0.15.11",
"fabric-api-base": "*" "fabric-api-base": "*"
}, },
"description": "Low-level, vanilla protocol oriented networking hooks.", "description": "Low-level, vanilla protocol oriented networking hooks.",

View file

@ -16,7 +16,7 @@
"FabricMC" "FabricMC"
], ],
"depends": { "depends": {
"fabricloader": ">=0.15.6", "fabricloader": ">=0.15.11",
"fabric-api-base": "*" "fabric-api-base": "*"
}, },
"description": "Builders for objects vanilla has locked down.", "description": "Builders for objects vanilla has locked down.",

View file

@ -16,7 +16,7 @@
"FabricMC" "FabricMC"
], ],
"depends": { "depends": {
"fabricloader": ">=0.15.6" "fabricloader": ">=0.15.11"
}, },
"description": "Hooks for registering custom particles.", "description": "Hooks for registering custom particles.",
"mixins": [ "mixins": [

View file

@ -28,7 +28,7 @@ import com.mojang.serialization.codecs.RecordCodecBuilder;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import net.minecraft.component.ComponentChanges; import net.minecraft.component.ComponentChanges;
import net.minecraft.component.DataComponentType; import net.minecraft.component.ComponentType;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.network.RegistryByteBuf; import net.minecraft.network.RegistryByteBuf;
import net.minecraft.network.codec.PacketCodec; import net.minecraft.network.codec.PacketCodec;
@ -58,8 +58,8 @@ public class ComponentsIngredient implements CustomIngredient {
if (!base.test(stack)) return false; if (!base.test(stack)) return false;
// None strict matching // None strict matching
for (Map.Entry<DataComponentType<?>, Optional<?>> entry : components.entrySet()) { for (Map.Entry<ComponentType<?>, Optional<?>> entry : components.entrySet()) {
final DataComponentType<?> type = entry.getKey(); final ComponentType<?> type = entry.getKey();
final Optional<?> value = entry.getValue(); final Optional<?> value = entry.getValue();
if (value.isPresent()) { if (value.isPresent()) {

View file

@ -28,11 +28,11 @@ import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import net.minecraft.inventory.RecipeInputInventory;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.recipe.Ingredient; import net.minecraft.recipe.Ingredient;
import net.minecraft.recipe.ShapelessRecipe; import net.minecraft.recipe.ShapelessRecipe;
import net.minecraft.recipe.book.CraftingRecipeCategory; import net.minecraft.recipe.book.CraftingRecipeCategory;
import net.minecraft.recipe.input.CraftingRecipeInput;
import net.minecraft.util.collection.DefaultedList; import net.minecraft.util.collection.DefaultedList;
import net.minecraft.world.World; import net.minecraft.world.World;
@ -56,13 +56,13 @@ public class ShapelessRecipeMixin {
} }
} }
@Inject(at = @At("HEAD"), method = "matches", cancellable = true) @Inject(at = @At("HEAD"), method = "matches(Lnet/minecraft/recipe/input/CraftingRecipeInput;Lnet/minecraft/world/World;)Z", cancellable = true)
public void customIngredientMatch(RecipeInputInventory craftingInventory, World world, CallbackInfoReturnable<Boolean> cir) { public void customIngredientMatch(CraftingRecipeInput recipeInput, World world, CallbackInfoReturnable<Boolean> cir) {
if (fabric_requiresTesting) { if (fabric_requiresTesting) {
List<ItemStack> nonEmptyStacks = new ArrayList<>(craftingInventory.size()); List<ItemStack> nonEmptyStacks = new ArrayList<>(recipeInput.getStackCount());
for (int i = 0; i < craftingInventory.size(); ++i) { for (int i = 0; i < recipeInput.getStackCount(); ++i) {
ItemStack stack = craftingInventory.getStack(i); ItemStack stack = recipeInput.getStackInSlot(i);
if (!stack.isEmpty()) { if (!stack.isEmpty()) {
nonEmptyStacks.add(stack); nonEmptyStacks.add(stack);

View file

@ -20,7 +20,7 @@
], ],
"accessWidener": "fabric-recipe-api-v1.accesswidener", "accessWidener": "fabric-recipe-api-v1.accesswidener",
"depends": { "depends": {
"fabricloader": ">=0.15.6", "fabricloader": ">=0.15.11",
"fabric-networking-api-v1": "*" "fabric-networking-api-v1": "*"
}, },
"entrypoints": { "entrypoints": {

View file

@ -16,12 +16,14 @@
package net.fabricmc.fabric.test.recipe.ingredient; package net.fabricmc.fabric.test.recipe.ingredient;
import net.minecraft.entity.player.PlayerEntity; import java.util.Collections;
import net.minecraft.inventory.CraftingInventory; import java.util.LinkedList;
import java.util.List;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.Items; import net.minecraft.item.Items;
import net.minecraft.recipe.ShapelessRecipe; import net.minecraft.recipe.ShapelessRecipe;
import net.minecraft.screen.ScreenHandler; import net.minecraft.recipe.input.CraftingRecipeInput;
import net.minecraft.test.GameTest; import net.minecraft.test.GameTest;
import net.minecraft.test.GameTestException; import net.minecraft.test.GameTestException;
import net.minecraft.test.TestContext; import net.minecraft.test.TestContext;
@ -42,30 +44,16 @@ public class ShapelessRecipeMatchTests {
ItemStack damagedPickaxe = new ItemStack(Items.DIAMOND_PICKAXE); ItemStack damagedPickaxe = new ItemStack(Items.DIAMOND_PICKAXE);
damagedPickaxe.setDamage(100); damagedPickaxe.setDamage(100);
CraftingInventory craftingInv = new CraftingInventory(new ScreenHandler(null, 0) { List<ItemStack> damagedPickaxes = Collections.nCopies(9, damagedPickaxe);
@Override
public ItemStack quickMove(PlayerEntity player, int slot) {
return ItemStack.EMPTY;
}
@Override if (recipe.matches(CraftingRecipeInput.create(3, 3, damagedPickaxes), context.getWorld())) {
public boolean canUse(PlayerEntity player) {
return false;
}
}, 3, 3);
// Test that damaged only doesn't work
for (int i = 0; i < 9; ++i) {
craftingInv.setStack(i, damagedPickaxe);
}
if (recipe.matches(craftingInv, context.getWorld())) {
throw new GameTestException("Recipe should not match with only damaged pickaxes"); throw new GameTestException("Recipe should not match with only damaged pickaxes");
} }
craftingInv.setStack(1, undamagedPickaxe); List<ItemStack> oneUndamagedPickaxe = new LinkedList<>(damagedPickaxes);
oneUndamagedPickaxe.set(0, undamagedPickaxe);
if (!recipe.matches(craftingInv, context.getWorld())) { if (!recipe.matches(CraftingRecipeInput.create(3, 3, oneUndamagedPickaxe), context.getWorld())) {
throw new GameTestException("Recipe should match with at least one undamaged pickaxe"); throw new GameTestException("Recipe should match with at least one undamaged pickaxe");
} }

View file

@ -59,7 +59,7 @@ public final class DynamicRegistriesImpl {
throw new IllegalArgumentException("Dynamic registry " + key + " has already been registered!"); throw new IllegalArgumentException("Dynamic registry " + key + " has already been registered!");
} }
var entry = new RegistryLoader.Entry<>(key, codec); var entry = new RegistryLoader.Entry<>(key, codec, false);
DYNAMIC_REGISTRIES.add(entry); DYNAMIC_REGISTRIES.add(entry);
FABRIC_DYNAMIC_REGISTRY_KEYS.add(key); FABRIC_DYNAMIC_REGISTRY_KEYS.add(key);
return entry; return entry;
@ -74,7 +74,7 @@ public final class DynamicRegistriesImpl {
RegistryLoader.SYNCED_REGISTRIES = new ArrayList<>(RegistryLoader.SYNCED_REGISTRIES); RegistryLoader.SYNCED_REGISTRIES = new ArrayList<>(RegistryLoader.SYNCED_REGISTRIES);
} }
RegistryLoader.SYNCED_REGISTRIES.add(new RegistryLoader.Entry<>(key, networkCodec)); RegistryLoader.SYNCED_REGISTRIES.add(new RegistryLoader.Entry<>(key, networkCodec, false));
if (!(SerializableRegistries.SYNCED_REGISTRIES instanceof HashSet<RegistryKey<? extends Registry<?>>>)) { if (!(SerializableRegistries.SYNCED_REGISTRIES instanceof HashSet<RegistryKey<? extends Registry<?>>>)) {
SerializableRegistries.SYNCED_REGISTRIES = new HashSet<>(SerializableRegistries.SYNCED_REGISTRIES); SerializableRegistries.SYNCED_REGISTRIES = new HashSet<>(SerializableRegistries.SYNCED_REGISTRIES);

View file

@ -53,10 +53,6 @@ public class FabricRegistryInit implements ModInitializer {
RegistryAttributeHolder.get(Registries.BLOCK) RegistryAttributeHolder.get(Registries.BLOCK)
.addAttribute(RegistryAttribute.SYNCED); .addAttribute(RegistryAttribute.SYNCED);
// Synced in EnchantmentScreenHandler
RegistryAttributeHolder.get(Registries.ENCHANTMENT)
.addAttribute(RegistryAttribute.SYNCED);
// Synced in EntitySpawnS2CPacket and RegistryTagManager // Synced in EntitySpawnS2CPacket and RegistryTagManager
RegistryAttributeHolder.get(Registries.ENTITY_TYPE) RegistryAttributeHolder.get(Registries.ENTITY_TYPE)
.addAttribute(RegistryAttribute.SYNCED); .addAttribute(RegistryAttribute.SYNCED);
@ -101,10 +97,6 @@ public class FabricRegistryInit implements ModInitializer {
RegistryAttributeHolder.get(Registries.BLOCK_ENTITY_TYPE) RegistryAttributeHolder.get(Registries.BLOCK_ENTITY_TYPE)
.addAttribute(RegistryAttribute.SYNCED); .addAttribute(RegistryAttribute.SYNCED);
// Synced in PaintingSpawnS2CPacket
RegistryAttributeHolder.get(Registries.PAINTING_VARIANT)
.addAttribute(RegistryAttribute.SYNCED);
// Synced via PacketCodecs.registry // Synced via PacketCodecs.registry
RegistryAttributeHolder.get(Registries.CUSTOM_STAT) RegistryAttributeHolder.get(Registries.CUSTOM_STAT)
.addAttribute(RegistryAttribute.SYNCED); .addAttribute(RegistryAttribute.SYNCED);
@ -137,10 +129,6 @@ public class FabricRegistryInit implements ModInitializer {
RegistryAttributeHolder.get(Registries.FROG_VARIANT) RegistryAttributeHolder.get(Registries.FROG_VARIANT)
.addAttribute(RegistryAttribute.SYNCED); .addAttribute(RegistryAttribute.SYNCED);
// Uses a data tracker (and thus, raw IDs) to sync painting entities to the client
RegistryAttributeHolder.get(Registries.PAINTING_VARIANT)
.addAttribute(RegistryAttribute.SYNCED);
// Uses the raw ID when syncing the command tree to the client // Uses the raw ID when syncing the command tree to the client
RegistryAttributeHolder.get(Registries.COMMAND_ARGUMENT_TYPE) RegistryAttributeHolder.get(Registries.COMMAND_ARGUMENT_TYPE)
.addAttribute(RegistryAttribute.SYNCED); .addAttribute(RegistryAttribute.SYNCED);

View file

@ -16,7 +16,7 @@
"FabricMC" "FabricMC"
], ],
"depends": { "depends": {
"fabricloader": ">=0.15.6", "fabricloader": ">=0.15.11",
"fabric-api-base": "*", "fabric-api-base": "*",
"fabric-networking-api-v1": "*" "fabric-networking-api-v1": "*"
}, },

View file

@ -16,7 +16,7 @@
"FabricMC" "FabricMC"
], ],
"depends": { "depends": {
"fabricloader": ">=0.15.6", "fabricloader": ">=0.15.11",
"minecraft": ">=1.15-alpha.19.39.a", "minecraft": ">=1.15-alpha.19.39.a",
"fabric-api-base": "*" "fabric-api-base": "*"
}, },

View file

@ -16,7 +16,7 @@
"FabricMC" "FabricMC"
], ],
"depends": { "depends": {
"fabricloader": ">=0.15.6", "fabricloader": ">=0.15.11",
"minecraft": ">=1.15-alpha.19.39.a", "minecraft": ">=1.15-alpha.19.39.a",
"fabric-api-base": "*", "fabric-api-base": "*",
"fabric-renderer-api-v1": "*" "fabric-renderer-api-v1": "*"

View file

@ -15,7 +15,7 @@
"FabricMC" "FabricMC"
], ],
"depends": { "depends": {
"fabricloader": ">=0.15.6", "fabricloader": ">=0.15.11",
"fabric-api-base": "*" "fabric-api-base": "*"
}, },
"description": "Hooks for registering fluid renders.", "description": "Hooks for registering fluid renders.",

View file

@ -29,7 +29,7 @@ import net.fabricmc.fabric.api.client.rendering.v1.HudRenderCallback;
@Mixin(InGameHud.class) @Mixin(InGameHud.class)
public class InGameHudMixin { public class InGameHudMixin {
@Inject(method = "render", at = @At(value = "TAIL"), slice = @Slice(from = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/hud/PlayerListHud;render(Lnet/minecraft/client/gui/DrawContext;ILnet/minecraft/scoreboard/Scoreboard;Lnet/minecraft/scoreboard/ScoreboardObjective;)V"))) @Inject(method = "render", at = @At(value = "TAIL"), slice = @Slice(from = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/LayeredDrawer;render(Lnet/minecraft/client/gui/DrawContext;F)V")))
public void render(DrawContext drawContext, float tickDelta, CallbackInfo callbackInfo) { public void render(DrawContext drawContext, float tickDelta, CallbackInfo callbackInfo) {
HudRenderCallback.EVENT.invoker().onHudRender(drawContext, tickDelta); HudRenderCallback.EVENT.invoker().onHudRender(drawContext, tickDelta);
} }

View file

@ -16,7 +16,7 @@
"FabricMC" "FabricMC"
], ],
"depends": { "depends": {
"fabricloader": ">=0.15.6", "fabricloader": ">=0.15.11",
"fabric-api-base": "*" "fabric-api-base": "*"
}, },
"description": "Hooks and registries for rendering-related things.", "description": "Hooks and registries for rendering-related things.",

View file

@ -16,7 +16,7 @@
"FabricMC" "FabricMC"
], ],
"depends": { "depends": {
"fabricloader": ">=0.15.6" "fabricloader": ">=0.15.11"
}, },
"description": "Allows conditionally loading resources.", "description": "Allows conditionally loading resources.",
"entrypoints": { "entrypoints": {

View file

@ -58,7 +58,7 @@ public class SimpleResourceReloadMixin {
return sorted; return sorted;
} }
@Redirect(method = "start", at = @At(value = "NEW", target = "Lnet/minecraft/resource/ProfiledResourceReload;<init>")) @Redirect(method = "start", at = @At(value = "NEW", target = "(Lnet/minecraft/resource/ResourceManager;Ljava/util/List;Ljava/util/concurrent/Executor;Ljava/util/concurrent/Executor;Ljava/util/concurrent/CompletableFuture;)Lnet/minecraft/resource/ProfiledResourceReload;"))
private static ProfiledResourceReload sortProfiled(ResourceManager manager, List<ResourceReloader> reloaders, Executor prepareExecutor, Executor applyExecutor, CompletableFuture<Unit> initialStage) { private static ProfiledResourceReload sortProfiled(ResourceManager manager, List<ResourceReloader> reloaders, Executor prepareExecutor, Executor applyExecutor, CompletableFuture<Unit> initialStage) {
List<ResourceReloader> sorted = ResourceManagerHelperImpl.sort(fabric_resourceType.get(), reloaders); List<ResourceReloader> sorted = ResourceManagerHelperImpl.sort(fabric_resourceType.get(), reloaders);
fabric_resourceType.set(null); fabric_resourceType.set(null);

View file

@ -16,7 +16,7 @@
"FabricMC" "FabricMC"
], ],
"depends": { "depends": {
"fabricloader": ">=0.15.6" "fabricloader": ">=0.15.11"
}, },
"description": "Asset and data resource loading.", "description": "Asset and data resource loading.",
"mixins": [ "mixins": [

View file

@ -16,7 +16,7 @@
"FabricMC" "FabricMC"
], ],
"depends": { "depends": {
"fabricloader": ">=0.15.6", "fabricloader": ">=0.15.11",
"fabric-api-base": "*" "fabric-api-base": "*"
}, },
"description": "Adds screen related hooks.", "description": "Adds screen related hooks.",

View file

@ -16,7 +16,7 @@
"FabricMC" "FabricMC"
], ],
"depends": { "depends": {
"fabricloader": ">=0.15.6", "fabricloader": ">=0.15.11",
"fabric-api-base": "*", "fabric-api-base": "*",
"fabric-networking-api-v1": "*" "fabric-networking-api-v1": "*"
}, },

View file

@ -16,7 +16,7 @@
"FabricMC" "FabricMC"
], ],
"depends": { "depends": {
"fabricloader": ">=0.15.6", "fabricloader": ">=0.15.11",
"minecraft": ">=1.19.2" "minecraft": ">=1.19.2"
}, },
"description": "Hooks for modifying Minecraft's sound system.", "description": "Hooks for modifying Minecraft's sound system.",

View file

@ -20,5 +20,5 @@ package net.fabricmc.fabric.api.transfer.v1.storage.base;
* An immutable object storing both a resource and an amount, provided for convenience. * An immutable object storing both a resource and an amount, provided for convenience.
* @param <T> The type of the stored resource. * @param <T> The type of the stored resource.
*/ */
public record ResourceAmount<T> (T resource, long amount) { public record ResourceAmount<T>(T resource, long amount) {
} }

View file

@ -24,7 +24,7 @@ import net.minecraft.block.entity.BrewingStandBlockEntity;
import net.minecraft.block.entity.ChestBlockEntity; import net.minecraft.block.entity.ChestBlockEntity;
import net.minecraft.block.entity.ShulkerBoxBlockEntity; import net.minecraft.block.entity.ShulkerBoxBlockEntity;
import net.minecraft.block.enums.ChestType; import net.minecraft.block.enums.ChestType;
import net.minecraft.component.DataComponentType; import net.minecraft.component.ComponentType;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.Items; import net.minecraft.item.Items;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
@ -159,7 +159,7 @@ class InventorySlotWrapper extends SingleStackStorage {
// Components have changed, we need to copy the stack. // Components have changed, we need to copy the stack.
if (!Objects.equals(original.getComponentChanges(), currentStack.getComponentChanges())) { if (!Objects.equals(original.getComponentChanges(), currentStack.getComponentChanges())) {
// Remove all the existing components and copy the new ones on top. // Remove all the existing components and copy the new ones on top.
for (DataComponentType<?> type : original.getComponents().getTypes()) { for (ComponentType<?> type : original.getComponents().getTypes()) {
original.set(type, null); original.set(type, null);
} }

View file

@ -16,7 +16,7 @@
"FabricMC" "FabricMC"
], ],
"depends": { "depends": {
"fabricloader": ">=0.15.6", "fabricloader": ">=0.15.11",
"fabric-api-lookup-api-v1": "*", "fabric-api-lookup-api-v1": "*",
"fabric-rendering-fluids-v1": "*" "fabric-rendering-fluids-v1": "*"
}, },

View file

@ -24,7 +24,7 @@ import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import net.minecraft.component.ComponentChanges; import net.minecraft.component.ComponentChanges;
import net.minecraft.component.DataComponentType; import net.minecraft.component.ComponentType;
import net.minecraft.fluid.Fluids; import net.minecraft.fluid.Fluids;
import net.minecraft.network.PacketByteBuf; import net.minecraft.network.PacketByteBuf;
import net.minecraft.network.RegistryByteBuf; import net.minecraft.network.RegistryByteBuf;
@ -44,7 +44,7 @@ import net.fabricmc.fabric.test.transfer.ingame.TransferTestInitializer;
class FluidTests extends AbstractTransferApiTest { class FluidTests extends AbstractTransferApiTest {
private static FluidVariant TAGGED_WATER, TAGGED_WATER_2, WATER, LAVA; private static FluidVariant TAGGED_WATER, TAGGED_WATER_2, WATER, LAVA;
private static int finalCommitCount = 0; private static int finalCommitCount = 0;
public static DataComponentType<Integer> TEST; public static ComponentType<Integer> TEST;
private static SingleSlotStorage<FluidVariant> createWaterStorage() { private static SingleSlotStorage<FluidVariant> createWaterStorage() {
return new SingleVariantStorage<>() { return new SingleVariantStorage<>() {
@Override @Override
@ -81,7 +81,7 @@ class FluidTests extends AbstractTransferApiTest {
WATER = FluidVariant.of(Fluids.WATER); WATER = FluidVariant.of(Fluids.WATER);
LAVA = FluidVariant.of(Fluids.LAVA); LAVA = FluidVariant.of(Fluids.LAVA);
TEST = Registry.register(Registries.DATA_COMPONENT_TYPE, new Identifier(TransferTestInitializer.MOD_ID, "test"), TEST = Registry.register(Registries.DATA_COMPONENT_TYPE, new Identifier(TransferTestInitializer.MOD_ID, "test"),
DataComponentType.<Integer>builder().codec(Codecs.NONNEGATIVE_INT).packetCodec(PacketCodecs.VAR_INT).build()); ComponentType.<Integer>builder().codec(Codecs.NONNEGATIVE_INT).packetCodec(PacketCodecs.VAR_INT).build());
} }
@Test @Test

View file

@ -27,7 +27,7 @@ import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import net.minecraft.component.ComponentChanges; import net.minecraft.component.ComponentChanges;
import net.minecraft.component.DataComponentType; import net.minecraft.component.ComponentType;
import net.minecraft.component.DataComponentTypes; import net.minecraft.component.DataComponentTypes;
import net.minecraft.inventory.Inventory; import net.minecraft.inventory.Inventory;
import net.minecraft.inventory.SidedInventory; import net.minecraft.inventory.SidedInventory;
@ -57,13 +57,13 @@ import net.fabricmc.fabric.test.transfer.ingame.TransferTestInitializer;
* Tests for the item transfer APIs. * Tests for the item transfer APIs.
*/ */
class ItemTests extends AbstractTransferApiTest { class ItemTests extends AbstractTransferApiTest {
public static DataComponentType<Integer> ENERGY; public static ComponentType<Integer> ENERGY;
@BeforeAll @BeforeAll
static void beforeAll() { static void beforeAll() {
bootstrap(); bootstrap();
ENERGY = Registry.register(Registries.DATA_COMPONENT_TYPE, new Identifier(TransferTestInitializer.MOD_ID, "energy"), ENERGY = Registry.register(Registries.DATA_COMPONENT_TYPE, new Identifier(TransferTestInitializer.MOD_ID, "energy"),
DataComponentType.<Integer>builder().codec(Codecs.NONNEGATIVE_INT).packetCodec(PacketCodecs.VAR_INT).build()); ComponentType.<Integer>builder().codec(Codecs.NONNEGATIVE_INT).packetCodec(PacketCodecs.VAR_INT).build());
} }
@Test @Test

View file

@ -27,7 +27,7 @@ import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import net.minecraft.component.ComponentChanges; import net.minecraft.component.ComponentChanges;
import net.minecraft.component.DataComponentType; import net.minecraft.component.ComponentType;
import net.minecraft.component.DataComponentTypes; import net.minecraft.component.DataComponentTypes;
import net.minecraft.fluid.Fluids; import net.minecraft.fluid.Fluids;
import net.minecraft.inventory.Inventory; import net.minecraft.inventory.Inventory;
@ -57,7 +57,7 @@ import net.fabricmc.fabric.test.transfer.ingame.TransferTestInitializer;
public class SingleVariantItemStorageTests extends AbstractTransferApiTest { public class SingleVariantItemStorageTests extends AbstractTransferApiTest {
private static FluidVariant LAVA; private static FluidVariant LAVA;
public static DataComponentType<FluidData> FLUID; public static ComponentType<FluidData> FLUID;
@BeforeAll @BeforeAll
static void beforeAll() { static void beforeAll() {
@ -66,7 +66,7 @@ public class SingleVariantItemStorageTests extends AbstractTransferApiTest {
LAVA = FluidVariant.of(Fluids.LAVA); LAVA = FluidVariant.of(Fluids.LAVA);
FLUID = Registry.register( FLUID = Registry.register(
Registries.DATA_COMPONENT_TYPE, new Identifier(TransferTestInitializer.MOD_ID, "fluid"), Registries.DATA_COMPONENT_TYPE, new Identifier(TransferTestInitializer.MOD_ID, "fluid"),
DataComponentType.<FluidData>builder().codec(FluidData.CODEC).packetCodec(FluidData.PACKET_CODEC).build()); ComponentType.<FluidData>builder().codec(FluidData.CODEC).packetCodec(FluidData.PACKET_CODEC).build());
} }
@Test @Test

View file

@ -16,7 +16,7 @@
"FabricMC" "FabricMC"
], ],
"depends": { "depends": {
"fabricloader": ">=0.15.6" "fabricloader": ">=0.15.11"
}, },
"description": "Contains transitive access wideners that provide access to otherwise inaccessible Minecraft code.", "description": "Contains transitive access wideners that provide access to otherwise inaccessible Minecraft code.",
"accessWidener": "fabric-transitive-access-wideners-v1.accesswidener", "accessWidener": "fabric-transitive-access-wideners-v1.accesswidener",

View file

@ -2,62 +2,62 @@ org.gradle.jvmargs=-Xmx2560M
org.gradle.parallel=true org.gradle.parallel=true
fabric.loom.multiProjectOptimisation=true fabric.loom.multiProjectOptimisation=true
version=0.97.8 version=0.97.9
minecraft_version=1.20.6-rc1 minecraft_version=24w18a
yarn_version=+build.1 yarn_version=+build.2
loader_version=0.15.6 loader_version=0.15.11
installer_version=1.0.1 installer_version=1.0.1
prerelease=true prerelease=true
curseforge_minecraft_version=1.20.5-Snapshot curseforge_minecraft_version=1.21-Snapshot
# Do not manually update, use the bumpversions task: # Do not manually update, use the bumpversions task:
fabric-api-base-version=0.4.40 fabric-api-base-version=0.4.41
fabric-api-lookup-api-v1-version=1.6.59 fabric-api-lookup-api-v1-version=1.6.60
fabric-biome-api-v1-version=13.0.25 fabric-biome-api-v1-version=13.0.26
fabric-block-api-v1-version=1.0.20 fabric-block-api-v1-version=1.0.21
fabric-block-view-api-v2-version=1.0.8 fabric-block-view-api-v2-version=1.0.9
fabric-blockrenderlayer-v1-version=1.1.50 fabric-blockrenderlayer-v1-version=1.1.51
fabric-command-api-v1-version=1.2.45 fabric-command-api-v1-version=1.2.46
fabric-command-api-v2-version=2.2.24 fabric-command-api-v2-version=2.2.25
fabric-commands-v0-version=0.2.62 fabric-commands-v0-version=0.2.63
fabric-content-registries-v0-version=8.0.4 fabric-content-registries-v0-version=8.0.5
fabric-crash-report-info-v1-version=0.2.27 fabric-crash-report-info-v1-version=0.2.28
fabric-data-attachment-api-v1-version=1.1.15 fabric-data-attachment-api-v1-version=1.1.16
fabric-data-generation-api-v1-version=19.0.6 fabric-data-generation-api-v1-version=20.0.0
fabric-dimensions-v1-version=2.1.68 fabric-dimensions-v1-version=2.1.69
fabric-entity-events-v1-version=1.6.8 fabric-entity-events-v1-version=1.6.9
fabric-events-interaction-v0-version=0.7.6 fabric-events-interaction-v0-version=0.7.7
fabric-game-rule-api-v1-version=1.0.50 fabric-game-rule-api-v1-version=1.0.51
fabric-gametest-api-v1-version=1.3.16 fabric-gametest-api-v1-version=1.3.17
fabric-item-api-v1-version=8.1.1 fabric-item-api-v1-version=9.0.0
fabric-item-group-api-v1-version=4.0.38 fabric-item-group-api-v1-version=4.0.39
fabric-key-binding-api-v1-version=1.0.45 fabric-key-binding-api-v1-version=1.0.46
fabric-keybindings-v0-version=0.2.43 fabric-keybindings-v0-version=0.2.44
fabric-lifecycle-events-v1-version=2.3.4 fabric-lifecycle-events-v1-version=2.3.5
fabric-loot-api-v2-version=3.0.4 fabric-loot-api-v2-version=3.0.5
fabric-message-api-v1-version=6.0.10 fabric-message-api-v1-version=6.0.11
fabric-model-loading-api-v1-version=1.0.12 fabric-model-loading-api-v1-version=1.0.13
fabric-models-v0-version=0.4.11 fabric-models-v0-version=0.4.12
fabric-networking-api-v1-version=4.0.8 fabric-networking-api-v1-version=4.0.9
fabric-object-builder-api-v1-version=15.1.3 fabric-object-builder-api-v1-version=15.1.4
fabric-particles-v1-version=4.0.0 fabric-particles-v1-version=4.0.1
fabric-recipe-api-v1-version=5.0.3 fabric-recipe-api-v1-version=5.0.4
fabric-registry-sync-v0-version=5.0.15 fabric-registry-sync-v0-version=5.0.16
fabric-renderer-api-v1-version=3.2.12 fabric-renderer-api-v1-version=3.2.13
fabric-renderer-indigo-version=1.5.12 fabric-renderer-indigo-version=1.5.13
fabric-renderer-registries-v1-version=3.2.61 fabric-renderer-registries-v1-version=3.2.62
fabric-rendering-data-attachment-v1-version=0.3.46 fabric-rendering-data-attachment-v1-version=0.3.47
fabric-rendering-fluids-v1-version=3.1.3 fabric-rendering-fluids-v1-version=3.1.4
fabric-rendering-v0-version=1.1.64 fabric-rendering-v0-version=1.1.65
fabric-rendering-v1-version=4.2.4 fabric-rendering-v1-version=4.2.5
fabric-resource-conditions-api-v1-version=4.0.1 fabric-resource-conditions-api-v1-version=4.0.2
fabric-resource-loader-v0-version=1.0.5 fabric-resource-loader-v0-version=1.0.6
fabric-screen-api-v1-version=2.0.21 fabric-screen-api-v1-version=2.0.22
fabric-screen-handler-api-v1-version=1.3.72 fabric-screen-handler-api-v1-version=1.3.73
fabric-sound-api-v1-version=1.0.21 fabric-sound-api-v1-version=1.0.22
fabric-transfer-api-v1-version=5.1.6 fabric-transfer-api-v1-version=5.1.7
fabric-transitive-access-wideners-v1-version=6.0.10 fabric-transitive-access-wideners-v1-version=6.0.11
fabric-convention-tags-v1-version=2.0.3 fabric-convention-tags-v1-version=2.0.4
fabric-convention-tags-v2-version=2.0.0 fabric-convention-tags-v2-version=2.0.1
fabric-client-tags-api-v1-version=1.1.12 fabric-client-tags-api-v1-version=1.1.13

View file

@ -19,9 +19,9 @@
"FabricMC" "FabricMC"
], ],
"depends": { "depends": {
"fabricloader": ">=0.15.6", "fabricloader": ">=0.15.11",
"java": ">=21", "java": ">=21",
"minecraft": ">=1.20.5- <1.20.7-" "minecraft": ">=1.21- <1.21.1-"
}, },
"description": "Core API module providing key hooks and intercompatibility features." "description": "Core API module providing key hooks and intercompatibility features."
} }