Port to 24w33a ()

Co-authored-by: haykam821 <24855774+haykam821@users.noreply.github.com>
Co-authored-by: hypherionmc <hypherionmc@gmail.com>
(cherry picked from commit 952fb19a0df7354e8352ef0c993a956b2bed32c2)
This commit is contained in:
modmuss 2024-08-18 19:15:11 +01:00 committed by modmuss50
parent 343cdcb01b
commit 1bb677a646
287 changed files with 1262 additions and 1775 deletions
build.gradle
deprecated
fabric-command-api-v1/src/main/resources
fabric-commands-v0/src/main/resources
fabric-convention-tags-v1/src/main
java/net/fabricmc/fabric/impl/tag/convention
resources
fabric-keybindings-v0/src/client/resources
fabric-loot-api-v2/src/main/resources
fabric-renderer-registries-v1
fabric-rendering-data-attachment-v1/src
fabric-rendering-v0/src/client/resources
fabric-api-base/src
fabric-api-lookup-api-v1
build.gradle
src
main
java/net/fabricmc/fabric/impl/lookup/entity
resources
testmod/java/net/fabricmc/fabric/test/lookup
testmodClient/java/net/fabricmc/fabric/test/lookup/client/entity
fabric-biome-api-v1/src
fabric-block-api-v1/src/main/resources
fabric-block-view-api-v2/src
fabric-blockrenderlayer-v1/src/client/resources
fabric-client-tags-api-v1/src/client/resources
fabric-command-api-v2/src
fabric-content-registries-v0/src
fabric-convention-tags-v2/src
datagen/resources
main
fabric-crash-report-info-v1/src/main/resources
fabric-data-attachment-api-v1/src
client/resources
main
testmod
java/net/fabricmc/fabric/test/attachment/gametest
resources
fabric-data-generation-api-v1
fabric-dimensions-v1/src
main/resources
testmod/java/net/fabricmc/fabric/test/dimension
fabric-entity-events-v1/src
client/resources
main
java/net/fabricmc/fabric/mixin/entity/event
resources
testmodClient/java/net/fabricmc/fabric/test/entity/event/client
fabric-events-interaction-v0/src

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.11" apply false id "fabric-loom" version "1.7.3" apply false
id "com.diffplug.spotless" version "6.20.0" id "com.diffplug.spotless" version "6.20.0"
id "org.ajoberstar.grgit" version "5.2.2" id "org.ajoberstar.grgit" version "5.2.2"
id "me.modmuss50.remotesign" version "0.4.0" apply false id "me.modmuss50.remotesign" version "0.4.0" apply false
@ -365,8 +365,7 @@ apply from: "gradle/module-validation.gradle"
apply from: "gradle/module-versioning.gradle" apply from: "gradle/module-versioning.gradle"
loom { loom {
// Required as the item-group API uses access widened classes in its API, without this the javadoc generation fails. accessWidenerPath = file("gradle/javadoc.accesswidener")
accessWidenerPath = file("fabric-item-group-api-v1/src/main/resources/fabric-item-group-api-v1.accesswidener")
} }
javadoc { javadoc {
@ -550,6 +549,8 @@ tasks.register('serverPropertiesJar', Jar) {
} }
tasks.register('runProductionAutoTestServer', JavaExec) { tasks.register('runProductionAutoTestServer', JavaExec) {
// TODO re-enable with https://github.com/FabricMC/fabric-loader/pull/967
enabled = false
dependsOn remapJar, remapTestmodJar, serverPropertiesJar dependsOn remapJar, remapTestmodJar, serverPropertiesJar
classpath.from configurations.productionRuntimeServer, serverPropertiesJar classpath.from configurations.productionRuntimeServer, serverPropertiesJar
mainClass = "net.fabricmc.installer.ServerLauncher" mainClass = "net.fabricmc.installer.ServerLauncher"

View file

@ -16,7 +16,7 @@
"FabricMC" "FabricMC"
], ],
"depends": { "depends": {
"fabricloader": ">=0.15.11", "fabricloader": ">=0.16.2",
"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.11", "fabricloader": ">=0.16.2",
"fabric-api-base": "*", "fabric-api-base": "*",
"fabric-command-api-v2": "*" "fabric-command-api-v2": "*"
}, },

View file

@ -234,7 +234,9 @@ public class ConventionLogWarnings implements ModInitializer {
// We only care about vanilla registries // We only care about vanilla registries
dynamicRegistries.streamAllRegistries().forEach(registryEntry -> { dynamicRegistries.streamAllRegistries().forEach(registryEntry -> {
if (registryEntry.key().getValue().getNamespace().equals(Identifier.DEFAULT_NAMESPACE)) { if (registryEntry.key().getValue().getNamespace().equals(Identifier.DEFAULT_NAMESPACE)) {
registryEntry.value().streamTags().forEach(tagKey -> { registryEntry.value().streamTags().forEach(listEntry -> {
TagKey<?> tagKey = TagKey.of(registryEntry.key(), listEntry.getTag().id());
// Grab legacy tags we migrated or discourage // Grab legacy tags we migrated or discourage
if (LEGACY_C_TAGS.containsKey(tagKey)) { if (LEGACY_C_TAGS.containsKey(tagKey)) {
legacyTags.add(tagKey); legacyTags.add(tagKey);

View file

@ -21,7 +21,7 @@
] ]
}, },
"depends": { "depends": {
"fabricloader": ">=0.15.11", "fabricloader": ">=0.16.2",
"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.11", "fabricloader": ">=0.16.2",
"fabric-key-binding-api-v1": "*" "fabric-key-binding-api-v1": "*"
}, },
"description": "Keybinding registry API.", "description": "Keybinding registry API.",

View file

@ -1,7 +1,7 @@
{ {
"required": true, "required": true,
"package": "net.fabricmc.fabric.mixin.loot.v2", "package": "net.fabricmc.fabric.mixin.loot.v2",
"compatibilityLevel": "JAVA_17", "compatibilityLevel": "JAVA_21",
"mixins": [ "mixins": [
"LootPoolBuilderMixin", "LootPoolBuilderMixin",
"LootTableBuilderMixin" "LootTableBuilderMixin"

View file

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

View file

@ -1,6 +0,0 @@
version = getSubprojectVersion(project)
moduleDependencies(project, [
'fabric-api-base',
'fabric-rendering-v1'
])

View file

@ -1,49 +0,0 @@
/*
* 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.api.client.rendereregistry.v1;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.block.entity.BlockEntityType;
import net.minecraft.client.render.block.entity.BlockEntityRenderDispatcher;
import net.minecraft.client.render.block.entity.BlockEntityRenderer;
import net.minecraft.client.render.block.entity.BlockEntityRendererFactory;
/**
* Helper class for registering BlockEntityRenderers.
*
* @deprecated This module has been moved into fabric-rendering-v1. Use {@link net.fabricmc.fabric.api.client.rendering.v1.BlockEntityRendererRegistry} instead
*/
@Deprecated
public interface BlockEntityRendererRegistry {
BlockEntityRendererRegistry INSTANCE = new BlockEntityRendererRegistry() {
@Override
public <E extends BlockEntity> void register(BlockEntityType<E> blockEntityType, BlockEntityRendererFactory<? super E> blockEntityRendererFactory) {
net.fabricmc.fabric.api.client.rendering.v1.BlockEntityRendererRegistry.register(blockEntityType, blockEntityRendererFactory);
}
};
/**
* Register a BlockEntityRenderer for a BlockEntityType. Can be called clientside before the world is rendered.
*
* @param blockEntityType the {@link BlockEntityType} to register a renderer for
* @param blockEntityRendererFactory a {@link BlockEntityRendererFactory} that creates a {@link BlockEntityRenderer}, called
* when {@link BlockEntityRenderDispatcher} is initialized or immediately if the dispatcher
* class is already loaded
* @param <E> the {@link BlockEntity}
*/
<E extends BlockEntity> void register(BlockEntityType<E> blockEntityType, BlockEntityRendererFactory<? super E> blockEntityRendererFactory);
}

View file

@ -1,52 +0,0 @@
/*
* 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.api.client.rendereregistry.v1;
import net.minecraft.client.model.TexturedModelData;
import net.minecraft.client.render.entity.model.EntityModelLayer;
/**
* A helpers for registering entity model layers and providers for the layer's textured model data.
*
* @deprecated This module has been moved into fabric-rendering-v1. Use {@link net.fabricmc.fabric.api.client.rendering.v1.EntityModelLayerRegistry} instead.
*/
@Deprecated
public final class EntityModelLayerRegistry {
/**
* Registers an entity model layer and registers a provider for a {@linkplain TexturedModelData}.
*
* @param modelLayer the entity model layer
* @param provider the provider for the textured model data
*/
public static void registerModelLayer(EntityModelLayer modelLayer, TexturedModelDataProvider provider) {
net.fabricmc.fabric.api.client.rendering.v1.EntityModelLayerRegistry.registerModelLayer(modelLayer, provider::createModelData);
}
private EntityModelLayerRegistry() {
}
@FunctionalInterface
@Deprecated
public interface TexturedModelDataProvider {
/**
* Creates the textured model data for use in a {@link EntityModelLayer}.
*
* @return the textured model data for the entity model layer.
*/
TexturedModelData createModelData();
}
}

View file

@ -1,49 +0,0 @@
/*
* 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.api.client.rendereregistry.v1;
import net.minecraft.client.render.entity.EntityRenderDispatcher;
import net.minecraft.client.render.entity.EntityRenderer;
import net.minecraft.client.render.entity.EntityRendererFactory;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityType;
/**
* Helper class for registering EntityRenderers.
*
* @deprecated This module has been moved into fabric-rendering-v1. Use {@link net.fabricmc.fabric.api.client.rendering.v1.EntityRendererRegistry} instead
*/
@Deprecated
public interface EntityRendererRegistry {
EntityRendererRegistry INSTANCE = new EntityRendererRegistry() {
@Override
public <T extends Entity> void register(EntityType<? extends T> entityType, EntityRendererFactory<T> factory) {
net.fabricmc.fabric.api.client.rendering.v1.EntityRendererRegistry.register(entityType, factory);
}
};
/**
* Register a BlockEntityRenderer for a BlockEntityType. Can be called clientside before the world is rendered.
*
* @param entityType the {@link EntityType} to register a renderer for
* @param entityRendererFactory a {@link EntityRendererFactory} that creates a {@link EntityRenderer}, called
* when {@link EntityRenderDispatcher} is initialized or immediately if the dispatcher
* class is already loaded
* @param <E> the {@link Entity}
*/
<E extends Entity> void register(EntityType<? extends E> entityType, EntityRendererFactory<E> entityRendererFactory);
}

View file

@ -1,91 +0,0 @@
/*
* 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.api.client.rendereregistry.v1;
import net.minecraft.client.render.entity.EntityRendererFactory;
import net.minecraft.client.render.entity.LivingEntityRenderer;
import net.minecraft.client.render.entity.feature.Deadmau5FeatureRenderer;
import net.minecraft.client.render.entity.feature.FeatureRenderer;
import net.minecraft.client.render.entity.model.EntityModel;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.LivingEntity;
import net.fabricmc.fabric.api.event.Event;
import net.fabricmc.fabric.api.event.EventFactory;
/**
* Called when {@link FeatureRenderer feature renderers} for a {@link LivingEntityRenderer living entity renderer} are registered.
*
* <p>Feature renderers are typically used for rendering additional objects on an entity, such as armor, an elytra or {@link Deadmau5FeatureRenderer Deadmau5's ears}.
* This callback lets developers add additional feature renderers for use in entity rendering.
* Listeners should filter out the specific entity renderer they want to hook into, usually through {@code instanceof} checks or filtering by entity type.
* Once listeners find a suitable entity renderer, they should register their feature renderer via the registration helper.
*
* <p>For example, to register a feature renderer for a player model, the example below may used:
* <blockquote><pre>
* LivingEntityFeatureRendererRegistrationCallback.EVENT.register((entityType, entityRenderer, registrationHelper) -> {
* if (entityRenderer instanceof PlayerEntityModel) {
* registrationHelper.register(new MyFeatureRenderer((PlayerEntityModel) entityRenderer));
* }
* });
* </pre></blockquote>
*
* @deprecated This module has been moved into fabric-rendering-v1. Use {@link net.fabricmc.fabric.api.client.rendering.v1.LivingEntityFeatureRendererRegistrationCallback} instead
*/
@FunctionalInterface
@Deprecated
public interface LivingEntityFeatureRendererRegistrationCallback {
Event<LivingEntityFeatureRendererRegistrationCallback> EVENT = createEvent();
/**
* Called when feature renderers may be registered.
*
* @param entityType the entity type of the renderer
* @param entityRenderer the entity renderer
*/
void registerRenderers(EntityType<? extends LivingEntity> entityType, LivingEntityRenderer<?, ?> entityRenderer, RegistrationHelper registrationHelper, EntityRendererFactory.Context context);
private static Event<LivingEntityFeatureRendererRegistrationCallback> createEvent() {
Event<LivingEntityFeatureRendererRegistrationCallback> event = EventFactory.createArrayBacked(LivingEntityFeatureRendererRegistrationCallback.class, callbacks -> (entityType, entityRenderer, registrationHelper, context) -> {
for (LivingEntityFeatureRendererRegistrationCallback callback : callbacks) {
callback.registerRenderers(entityType, entityRenderer, registrationHelper, context);
}
});
net.fabricmc.fabric.api.client.rendering.v1.LivingEntityFeatureRendererRegistrationCallback.EVENT.register((entityType, entityRenderer, registrationHelper, context) -> {
LivingEntityFeatureRendererRegistrationCallback.EVENT.invoker().registerRenderers(entityType, entityRenderer, registrationHelper::register, context);
});
return event;
}
/**
* A delegate object used to help register feature renderers for an entity renderer.
*
* <p>This is not meant for implementation by users of the API.
*
* @deprecated This module has been moved into fabric-rendering-v1. Use {@link net.fabricmc.fabric.api.client.rendering.v1.LivingEntityFeatureRendererRegistrationCallback.RegistrationHelper} instead
*/
@Deprecated
interface RegistrationHelper {
/**
* Adds a feature renderer to the entity renderer.
*
* @param featureRenderer the feature renderer
* @param <T> the type of entity
*/
<T extends LivingEntity> void register(FeatureRenderer<T, ? extends EntityModel<T>> featureRenderer);
}
}

View file

@ -1,28 +0,0 @@
{
"schemaVersion": 1,
"id": "fabric-renderer-registries-v1",
"name": "Fabric Renderer Registries (v1)",
"version": "${version}",
"environment": "client",
"license": "Apache-2.0",
"icon": "assets/renderer-registries-v1/icon.png",
"contact": {
"homepage": "https://fabricmc.net",
"irc": "irc://irc.esper.net:6667/fabric",
"issues": "https://github.com/FabricMC/fabric/issues",
"sources": "https://github.com/FabricMC/fabric"
},
"authors": [
"FabricMC"
],
"depends": {
"fabricloader": ">=0.15.11",
"minecraft": ">=1.15-alpha.19.39.a",
"fabric-api-base": "*",
"fabric-rendering-v1": "*"
},
"description": "Registries for entity and block renderers.",
"custom": {
"fabric-api:module-lifecycle": "deprecated"
}
}

View file

@ -1,7 +1,7 @@
{ {
"required": true, "required": true,
"package": "net.fabricmc.fabric.mixin.rendering.data.client", "package": "net.fabricmc.fabric.mixin.rendering.data.client",
"compatibilityLevel": "JAVA_17", "compatibilityLevel": "JAVA_21",
"client": [ "client": [
"ChunkRendererRegionMixin" "ChunkRendererRegionMixin"
], ],

View file

@ -1,7 +1,7 @@
{ {
"required": true, "required": true,
"package": "net.fabricmc.fabric.mixin.rendering.data", "package": "net.fabricmc.fabric.mixin.rendering.data",
"compatibilityLevel": "JAVA_17", "compatibilityLevel": "JAVA_21",
"mixins": [ "mixins": [
"BlockEntityMixin", "BlockEntityMixin",
"WorldViewMixin" "WorldViewMixin"

View file

@ -16,7 +16,7 @@
"FabricMC" "FabricMC"
], ],
"depends": { "depends": {
"fabricloader": ">=0.15.11", "fabricloader": ">=0.16.2",
"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.11", "fabricloader": ">=0.16.2",
"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.11" "fabricloader": ">=0.16.2"
}, },
"description": "Contains the essentials for Fabric API modules.", "description": "Contains the essentials for Fabric API modules.",
"custom": { "custom": {

View file

@ -1,7 +1,7 @@
{ {
"required": true, "required": true,
"package": "net.fabricmc.fabric.test.base.client.mixin", "package": "net.fabricmc.fabric.test.base.client.mixin",
"compatibilityLevel": "JAVA_17", "compatibilityLevel": "JAVA_21",
"client": [ "client": [
"CyclingButtonWidgetAccessor", "CyclingButtonWidgetAccessor",
"ScreenAccessor" "ScreenAccessor"

View file

@ -7,5 +7,6 @@ moduleDependencies(project, [
testDependencies(project, [ testDependencies(project, [
':fabric-rendering-v1', ':fabric-rendering-v1',
':fabric-object-builder-api-v1' ':fabric-object-builder-api-v1',
':fabric-transitive-access-wideners-v1'
]) ])

View file

@ -31,6 +31,7 @@ import org.slf4j.LoggerFactory;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityType; import net.minecraft.entity.EntityType;
import net.minecraft.entity.SpawnReason;
import net.minecraft.predicate.entity.EntityPredicates; import net.minecraft.predicate.entity.EntityPredicates;
import net.minecraft.registry.Registries; import net.minecraft.registry.Registries;
import net.minecraft.server.MinecraftServer; import net.minecraft.server.MinecraftServer;
@ -70,7 +71,7 @@ public class EntityApiLookupImpl<A, C> implements EntityApiLookup<A, C> {
synchronized (REGISTERED_SELVES) { synchronized (REGISTERED_SELVES) {
REGISTERED_SELVES.forEach((apiClass, entityTypes) -> { REGISTERED_SELVES.forEach((apiClass, entityTypes) -> {
for (EntityType<?> entityType : entityTypes) { for (EntityType<?> entityType : entityTypes) {
Entity entity = entityType.create(server.getOverworld()); Entity entity = entityType.create(server.getOverworld(), SpawnReason.LOAD);
if (entity == null) { if (entity == null) {
String errorMessage = String.format( String errorMessage = String.format(

View file

@ -1,7 +1,7 @@
{ {
"required": true, "required": true,
"package": "net.fabricmc.fabric.mixin.lookup", "package": "net.fabricmc.fabric.mixin.lookup",
"compatibilityLevel": "JAVA_17", "compatibilityLevel": "JAVA_21",
"mixins": [ "mixins": [
"BlockEntityTypeAccessor", "BlockEntityTypeAccessor",
"ServerWorldMixin" "ServerWorldMixin"

View file

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

View file

@ -22,8 +22,8 @@ import net.minecraft.entity.Entity;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
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.ActionResult;
import net.minecraft.util.Hand; import net.minecraft.util.Hand;
import net.minecraft.util.ItemActionResult;
import net.minecraft.util.hit.BlockHitResult; import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
@ -38,7 +38,7 @@ public class InspectorBlock extends Block {
} }
@Override @Override
public ItemActionResult onUseWithItem(ItemStack stack, BlockState blockState, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult blockHitResult) { public ActionResult onUseWithItem(ItemStack stack, BlockState blockState, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult blockHitResult) {
Inspectable inspectable = FabricItemApiLookupTest.INSPECTABLE.find(stack, null); Inspectable inspectable = FabricItemApiLookupTest.INSPECTABLE.find(stack, null);
if (inspectable != null) { if (inspectable != null) {
@ -46,10 +46,10 @@ public class InspectorBlock extends Block {
player.sendMessage(inspectable.inspect(), true); player.sendMessage(inspectable.inspect(), true);
} }
return ItemActionResult.success(world.isClient()); return ActionResult.SUCCESS;
} }
return ItemActionResult.PASS_TO_DEFAULT_BLOCK_INTERACTION; return ActionResult.PASS_TO_DEFAULT_BLOCK_ACTION;
} }
@Override @Override

View file

@ -19,9 +19,7 @@ package net.fabricmc.fabric.test.lookup.item;
import static net.fabricmc.fabric.test.lookup.FabricApiLookupTest.ensureException; import static net.fabricmc.fabric.test.lookup.FabricApiLookupTest.ensureException;
import net.minecraft.component.DataComponentTypes; import net.minecraft.component.DataComponentTypes;
import net.minecraft.item.Item;
import net.minecraft.item.Items; import net.minecraft.item.Items;
import net.minecraft.item.ToolItem;
import net.minecraft.registry.Registries; import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry; import net.minecraft.registry.Registry;
import net.minecraft.text.Text; import net.minecraft.text.Text;
@ -50,16 +48,6 @@ public class FabricItemApiLookupTest {
}, Items.DIAMOND, Items.DIAMOND_BLOCK); }, Items.DIAMOND, Items.DIAMOND_BLOCK);
// Test registerSelf // Test registerSelf
INSPECTABLE.registerSelf(HELLO_ITEM); INSPECTABLE.registerSelf(HELLO_ITEM);
// Tools report their mining level
INSPECTABLE.registerFallback((stack, ignored) -> {
Item item = stack.getItem();
if (item instanceof ToolItem) {
return () -> Text.literal("Tool mining level: " + ((ToolItem) item).getMaterial());
} else {
return null;
}
});
testSelfRegistration(); testSelfRegistration();
} }

View file

@ -18,7 +18,7 @@ package net.fabricmc.fabric.test.lookup.client.entity;
import net.minecraft.client.render.entity.EntityRendererFactory; import net.minecraft.client.render.entity.EntityRendererFactory;
import net.minecraft.client.render.entity.PigEntityRenderer; import net.minecraft.client.render.entity.PigEntityRenderer;
import net.minecraft.entity.passive.PigEntity; import net.minecraft.client.render.entity.state.PigEntityRenderState;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
public class InspectablePigEntityRenderer extends PigEntityRenderer { public class InspectablePigEntityRenderer extends PigEntityRenderer {
@ -29,7 +29,7 @@ public class InspectablePigEntityRenderer extends PigEntityRenderer {
} }
@Override @Override
public Identifier getTexture(PigEntity pigEntity) { public Identifier getTexture(PigEntityRenderState context) {
return TEXTURE; return TEXTURE;
} }
} }

View file

@ -316,33 +316,16 @@ public interface BiomeModificationContext {
void addFeature(GenerationStep.Feature step, RegistryKey<PlacedFeature> placedFeatureKey); void addFeature(GenerationStep.Feature step, RegistryKey<PlacedFeature> placedFeatureKey);
/** /**
* Adds a configured carver to one of this biomes generation steps. * Adds a configured carver to this biome.
*/ */
void addCarver(GenerationStep.Carver step, RegistryKey<ConfiguredCarver<?>> carverKey); void addCarver(RegistryKey<ConfiguredCarver<?>> carverKey);
/** /**
* Removes all carvers with the given key from one of this biomes generation steps. * Removes all carvers with the given key from this biome.
* *
* @return True if any carvers were removed. * @return True if any carvers were removed.
*/ */
boolean removeCarver(GenerationStep.Carver step, RegistryKey<ConfiguredCarver<?>> configuredCarverKey); boolean removeCarver(RegistryKey<ConfiguredCarver<?>> configuredCarverKey);
/**
* Removes all carvers with the given key from all of this biomes generation steps.
*
* @return True if any carvers were removed.
*/
default boolean removeCarver(RegistryKey<ConfiguredCarver<?>> configuredCarverKey) {
boolean anyFound = false;
for (GenerationStep.Carver step : GenerationStep.Carver.values()) {
if (removeCarver(step, configuredCarverKey)) {
anyFound = true;
}
}
return anyFound;
}
} }
interface SpawnSettingsContext { interface SpawnSettingsContext {

View file

@ -55,9 +55,9 @@ public final class BiomeModifications {
* *
* @see BiomeSelectors * @see BiomeSelectors
*/ */
public static void addCarver(Predicate<BiomeSelectionContext> biomeSelector, GenerationStep.Carver step, RegistryKey<ConfiguredCarver<?>> configuredCarverKey) { public static void addCarver(Predicate<BiomeSelectionContext> biomeSelector, RegistryKey<ConfiguredCarver<?>> configuredCarverKey) {
create(configuredCarverKey.getValue()).add(ModificationPhase.ADDITIONS, biomeSelector, context -> { create(configuredCarverKey.getValue()).add(ModificationPhase.ADDITIONS, biomeSelector, context -> {
context.getGenerationSettings().addCarver(step, configuredCarverKey); context.getGenerationSettings().addCarver(configuredCarverKey);
}); });
} }

View file

@ -205,19 +205,11 @@ public class BiomeModificationContextImpl implements BiomeModificationContext {
* possible step if they're dense lists. * possible step if they're dense lists.
*/ */
GenerationSettingsContextImpl() { GenerationSettingsContextImpl() {
unfreezeCarvers();
unfreezeFeatures(); unfreezeFeatures();
rebuildFeatures = false; rebuildFeatures = false;
} }
private void unfreezeCarvers() {
Map<GenerationStep.Carver, RegistryEntryList<ConfiguredCarver<?>>> carversByStep = new EnumMap<>(GenerationStep.Carver.class);
carversByStep.putAll(generationSettings.carvers);
generationSettings.carvers = carversByStep;
}
private void unfreezeFeatures() { private void unfreezeFeatures() {
generationSettings.features = new ArrayList<>(generationSettings.features); generationSettings.features = new ArrayList<>(generationSettings.features);
} }
@ -226,7 +218,6 @@ public class BiomeModificationContextImpl implements BiomeModificationContext {
* Re-freeze the lists in the generation settings to immutable variants, also fixes the flower features. * Re-freeze the lists in the generation settings to immutable variants, also fixes the flower features.
*/ */
public void freeze() { public void freeze() {
freezeCarvers();
freezeFeatures(); freezeFeatures();
if (rebuildFeatures) { if (rebuildFeatures) {
@ -234,10 +225,6 @@ public class BiomeModificationContextImpl implements BiomeModificationContext {
} }
} }
private void freezeCarvers() {
generationSettings.carvers = ImmutableMap.copyOf(generationSettings.carvers);
}
private void freezeFeatures() { private void freezeFeatures() {
generationSettings.features = ImmutableList.copyOf(generationSettings.features); generationSettings.features = ImmutableList.copyOf(generationSettings.features);
// Replace the supplier to force a rebuild next time its called. // Replace the supplier to force a rebuild next time its called.
@ -296,22 +283,18 @@ public class BiomeModificationContextImpl implements BiomeModificationContext {
} }
@Override @Override
public void addCarver(GenerationStep.Carver step, RegistryKey<ConfiguredCarver<?>> entry) { public void addCarver(RegistryKey<ConfiguredCarver<?>> entry) {
// We do not need to delay evaluation of this since the registries are already fully built // We do not need to delay evaluation of this since the registries are already fully built
generationSettings.carvers.put(step, plus(generationSettings.carvers.get(step), getEntry(carvers, entry))); generationSettings.carvers = plus(generationSettings.carvers, getEntry(carvers, entry));
} }
@Override @Override
public boolean removeCarver(GenerationStep.Carver step, RegistryKey<ConfiguredCarver<?>> configuredCarverKey) { public boolean removeCarver(RegistryKey<ConfiguredCarver<?>> configuredCarverKey) {
ConfiguredCarver<?> carver = getEntry(carvers, configuredCarverKey).value(); ConfiguredCarver<?> carver = getEntry(carvers, configuredCarverKey).value();
RegistryEntryList<ConfiguredCarver<?>> carvers = generationSettings.carvers.get(step); List<RegistryEntry<ConfiguredCarver<?>>> genCarvers = new ArrayList<>(generationSettings.carvers.stream().toList());
if (carvers == null) return false;
List<RegistryEntry<ConfiguredCarver<?>>> genCarvers = new ArrayList<>(carvers.stream().toList());
if (genCarvers.removeIf(entry -> entry.value() == carver)) { if (genCarvers.removeIf(entry -> entry.value() == carver)) {
generationSettings.carvers.put(step, RegistryEntryList.of(genCarvers)); generationSettings.carvers = RegistryEntryList.of(genCarvers);
return true; return true;
} }

View file

@ -47,8 +47,8 @@ mutable field net/minecraft/world/biome/SpawnSettings spawnCosts Ljava/util/Map;
accessible method net/minecraft/world/biome/SpawnSettings$SpawnDensity <init> (DD)V accessible method net/minecraft/world/biome/SpawnSettings$SpawnDensity <init> (DD)V
# Generation Settings # Generation Settings
accessible field net/minecraft/world/biome/GenerationSettings carvers Ljava/util/Map; accessible field net/minecraft/world/biome/GenerationSettings carvers Lnet/minecraft/registry/entry/RegistryEntryList;
mutable field net/minecraft/world/biome/GenerationSettings carvers Ljava/util/Map; mutable field net/minecraft/world/biome/GenerationSettings carvers Lnet/minecraft/registry/entry/RegistryEntryList;
accessible field net/minecraft/world/biome/GenerationSettings features Ljava/util/List; accessible field net/minecraft/world/biome/GenerationSettings features Ljava/util/List;
mutable field net/minecraft/world/biome/GenerationSettings features Ljava/util/List; mutable field net/minecraft/world/biome/GenerationSettings features Ljava/util/List;
accessible field net/minecraft/world/biome/GenerationSettings flowerFeatures Ljava/util/function/Supplier; accessible field net/minecraft/world/biome/GenerationSettings flowerFeatures Ljava/util/function/Supplier;

View file

@ -1,7 +1,7 @@
{ {
"required": true, "required": true,
"package": "net.fabricmc.fabric.mixin.biome", "package": "net.fabricmc.fabric.mixin.biome",
"compatibilityLevel": "JAVA_17", "compatibilityLevel": "JAVA_21",
"mixins": [ "mixins": [
"BiomeSourceMixin", "BiomeSourceMixin",
"ChunkNoiseSamplerMixin", "ChunkNoiseSamplerMixin",

View file

@ -16,7 +16,7 @@
"FabricMC" "FabricMC"
], ],
"depends": { "depends": {
"fabricloader": ">=0.15.11", "fabricloader": ">=0.16.2",
"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

@ -1,11 +1,9 @@
{ {
"carvers": { "carvers": [
"air": [ "minecraft:cave",
"minecraft:cave", "minecraft:cave_extra_underground",
"minecraft:cave_extra_underground", "minecraft:canyon"
"minecraft:canyon" ],
]
},
"downfall": 0.4, "downfall": 0.4,
"effects": { "effects": {
"fog_color": 12638463, "fog_color": 12638463,

View file

@ -1,5 +1,5 @@
{ {
"carvers": {}, "carvers": [],
"downfall": 0.4, "downfall": 0.4,
"effects": { "effects": {
"fog_color": 12638463, "fog_color": 12638463,

View file

@ -1,7 +1,5 @@
{ {
"carvers": { "carvers": "minecraft:nether_cave",
"air": "minecraft:nether_cave"
},
"downfall": 0.0, "downfall": 0.0,
"effects": { "effects": {
"additions_sound": { "additions_sound": {

View file

@ -1,5 +1,5 @@
{ {
"carvers": {}, "carvers": [],
"downfall": 0.5, "downfall": 0.5,
"effects": { "effects": {
"fog_color": 10518688, "fog_color": 10518688,

View file

@ -1,5 +1,5 @@
{ {
"carvers": {}, "carvers": [],
"downfall": 0.5, "downfall": 0.5,
"effects": { "effects": {
"fog_color": 10518688, "fog_color": 10518688,

View file

@ -1,5 +1,5 @@
{ {
"carvers": {}, "carvers": [],
"downfall": 0.5, "downfall": 0.5,
"effects": { "effects": {
"fog_color": 10518688, "fog_color": 10518688,

View file

@ -1,7 +1,7 @@
{ {
"required": true, "required": true,
"package": "net.fabricmc.fabric.mixin.block", "package": "net.fabricmc.fabric.mixin.block",
"compatibilityLevel": "JAVA_17", "compatibilityLevel": "JAVA_21",
"mixins": [ "mixins": [
"BlockMixin", "BlockMixin",
"BlockStateMixin", "BlockStateMixin",

View file

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

View file

@ -1,7 +1,7 @@
{ {
"required": true, "required": true,
"package": "net.fabricmc.fabric.mixin.blockview.client", "package": "net.fabricmc.fabric.mixin.blockview.client",
"compatibilityLevel": "JAVA_17", "compatibilityLevel": "JAVA_21",
"client": [ "client": [
"ChunkRendererRegionMixin", "ChunkRendererRegionMixin",
"ChunkRendererRegionBuilderMixin" "ChunkRendererRegionBuilderMixin"

View file

@ -1,7 +1,7 @@
{ {
"required": true, "required": true,
"package": "net.fabricmc.fabric.mixin.blockview", "package": "net.fabricmc.fabric.mixin.blockview",
"compatibilityLevel": "JAVA_17", "compatibilityLevel": "JAVA_21",
"mixins": [ "mixins": [
"BlockEntityMixin", "BlockEntityMixin",
"BlockViewMixin" "BlockViewMixin"

View file

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

View file

@ -1,7 +1,7 @@
{ {
"required": true, "required": true,
"package": "net.fabricmc.fabric.mixin.blockrenderlayer", "package": "net.fabricmc.fabric.mixin.blockrenderlayer",
"compatibilityLevel": "JAVA_17", "compatibilityLevel": "JAVA_21",
"client": [ "client": [
"RenderLayersMixin" "RenderLayersMixin"
], ],

View file

@ -16,7 +16,7 @@
"FabricMC" "FabricMC"
], ],
"depends": { "depends": {
"fabricloader": ">=0.15.11", "fabricloader": ">=0.16.2",
"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.11" "fabricloader": ">=0.16.2"
}, },
"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

@ -1,7 +1,7 @@
{ {
"required": true, "required": true,
"package": "net.fabricmc.fabric.mixin.command.client", "package": "net.fabricmc.fabric.mixin.command.client",
"compatibilityLevel": "JAVA_17", "compatibilityLevel": "JAVA_21",
"client": [ "client": [
"ClientCommandSourceMixin", "ClientCommandSourceMixin",
"ClientPlayNetworkHandlerMixin" "ClientPlayNetworkHandlerMixin"

View file

@ -1,7 +1,7 @@
{ {
"required": true, "required": true,
"package": "net.fabricmc.fabric.mixin.command", "package": "net.fabricmc.fabric.mixin.command",
"compatibilityLevel": "JAVA_17", "compatibilityLevel": "JAVA_21",
"mixins": [ "mixins": [
"ArgumentTypesAccessor", "ArgumentTypesAccessor",
"CommandManagerMixin", "CommandManagerMixin",

View file

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

View file

@ -1,27 +0,0 @@
/*
* 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.api.registry;
import net.fabricmc.fabric.api.util.Item2ObjectMap;
import net.fabricmc.fabric.impl.content.registry.FuelRegistryImpl;
/**
* Registry of items to 0-32767 fuel burn time values, in in-game ticks.
*/
public interface FuelRegistry extends Item2ObjectMap<Integer> {
FuelRegistry INSTANCE = new FuelRegistryImpl();
}

View file

@ -16,16 +16,11 @@
package net.fabricmc.fabric.api.registry; package net.fabricmc.fabric.api.registry;
import java.util.List;
import java.util.Map;
import java.util.Objects; import java.util.Objects;
import java.util.Set;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import net.minecraft.entity.passive.VillagerEntity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemConvertible; import net.minecraft.item.ItemConvertible;
import net.minecraft.loot.LootTable; import net.minecraft.loot.LootTable;
import net.minecraft.registry.RegistryKey; import net.minecraft.registry.RegistryKey;
@ -33,10 +28,8 @@ import net.minecraft.registry.RegistryKeys;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import net.minecraft.village.VillagerProfession; import net.minecraft.village.VillagerProfession;
import net.fabricmc.fabric.impl.content.registry.util.ImmutableCollectionUtils; import net.fabricmc.fabric.impl.content.registry.VillagerInteractionRegistriesImpl;
import net.fabricmc.fabric.mixin.content.registry.FarmerWorkTaskAccessor;
import net.fabricmc.fabric.mixin.content.registry.GiveGiftsToHeroTaskAccessor; import net.fabricmc.fabric.mixin.content.registry.GiveGiftsToHeroTaskAccessor;
import net.fabricmc.fabric.mixin.content.registry.VillagerEntityAccessor;
/** /**
* Registries for modifying villager interactions that * Registries for modifying villager interactions that
@ -53,10 +46,12 @@ public final class VillagerInteractionRegistries {
* by any profession villagers. * by any profession villagers.
* *
* @param item the item to register * @param item the item to register
* @deprecated Add items to the {@linkplain net.minecraft.tag.ItemTags#VILLAGER_PICKS_UP {@code <#789950127774105602>:villager_picks_up} item tag} instead
*/ */
@Deprecated
public static void registerCollectable(ItemConvertible item) { public static void registerCollectable(ItemConvertible item) {
Objects.requireNonNull(item.asItem(), "Item cannot be null!"); Objects.requireNonNull(item.asItem(), "Item cannot be null!");
getCollectableRegistry().add(item.asItem()); VillagerInteractionRegistriesImpl.getCollectableRegistry().add(item.asItem());
} }
/** /**
@ -65,7 +60,7 @@ public final class VillagerInteractionRegistries {
*/ */
public static void registerCompostable(ItemConvertible item) { public static void registerCompostable(ItemConvertible item) {
Objects.requireNonNull(item.asItem(), "Item cannot be null!"); Objects.requireNonNull(item.asItem(), "Item cannot be null!");
getCompostableRegistry().add(item.asItem()); VillagerInteractionRegistriesImpl.getCompostableRegistry().add(item.asItem());
} }
/** /**
@ -75,7 +70,7 @@ public final class VillagerInteractionRegistries {
*/ */
public static void registerFood(ItemConvertible item, int foodValue) { public static void registerFood(ItemConvertible item, int foodValue) {
Objects.requireNonNull(item.asItem(), "Item cannot be null!"); Objects.requireNonNull(item.asItem(), "Item cannot be null!");
Integer oldValue = getFoodRegistry().put(item.asItem(), foodValue); Integer oldValue = VillagerInteractionRegistriesImpl.getFoodRegistry().put(item.asItem(), foodValue);
if (oldValue != null) { if (oldValue != null) {
LOGGER.info("Overriding previous food value of {}, was: {}, now: {}", item.asItem().toString(), oldValue, foodValue); LOGGER.info("Overriding previous food value of {}, was: {}, now: {}", item.asItem().toString(), oldValue, foodValue);
@ -104,16 +99,4 @@ public final class VillagerInteractionRegistries {
LOGGER.info("Overriding previous gift loot table of {} profession, was: {}, now: {}", profession.id(), oldValue, lootTable); LOGGER.info("Overriding previous gift loot table of {} profession, was: {}, now: {}", profession.id(), oldValue, lootTable);
} }
} }
private static Set<Item> getCollectableRegistry() {
return ImmutableCollectionUtils.getAsMutableSet(VillagerEntityAccessor::fabric_getGatherableItems, VillagerEntityAccessor::fabric_setGatherableItems);
}
private static List<Item> getCompostableRegistry() {
return ImmutableCollectionUtils.getAsMutableList(FarmerWorkTaskAccessor::fabric_getCompostable, FarmerWorkTaskAccessor::fabric_setCompostables);
}
private static Map<Item, Integer> getFoodRegistry() {
return ImmutableCollectionUtils.getAsMutableMap(() -> VillagerEntity.ITEM_FOOD_VALUES, VillagerEntityAccessor::fabric_setItemFoodValues);
}
} }

View file

@ -1,132 +0,0 @@
/*
* 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.impl.content.registry;
import java.util.Map;
import it.unimi.dsi.fastutil.objects.Object2IntLinkedOpenHashMap;
import it.unimi.dsi.fastutil.objects.Object2IntMap;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import net.minecraft.block.entity.AbstractFurnaceBlockEntity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemConvertible;
import net.minecraft.registry.Registries;
import net.minecraft.registry.entry.RegistryEntry;
import net.minecraft.registry.tag.TagKey;
import net.fabricmc.fabric.api.registry.FuelRegistry;
// TODO: Clamp values to 32767 (+ add hook for mods which extend the limit to disable the check?)
public final class FuelRegistryImpl implements FuelRegistry {
private static final Logger LOGGER = LoggerFactory.getLogger(FuelRegistryImpl.class);
private final Object2IntMap<ItemConvertible> itemCookTimes = new Object2IntLinkedOpenHashMap<>();
private final Object2IntMap<TagKey<Item>> tagCookTimes = new Object2IntLinkedOpenHashMap<>();
public FuelRegistryImpl() {
}
public Map<Item, Integer> getFuelTimes() {
// Cached by vanilla now
return AbstractFurnaceBlockEntity.createFuelTimeMap();
}
@Override
public Integer get(ItemConvertible item) {
return getFuelTimes().get(item.asItem());
}
@Override
public void add(ItemConvertible item, Integer cookTime) {
if (cookTime > 32767) {
LOGGER.warn("Tried to register an overly high cookTime: " + cookTime + " > 32767! (" + item + ")");
}
itemCookTimes.put(item, cookTime.intValue());
resetCache();
}
@Override
public void add(TagKey<Item> tag, Integer cookTime) {
if (cookTime > 32767) {
LOGGER.warn("Tried to register an overly high cookTime: " + cookTime + " > 32767! (" + getTagName(tag) + ")");
}
tagCookTimes.put(tag, cookTime.intValue());
resetCache();
}
@Override
public void remove(ItemConvertible item) {
add(item, 0);
resetCache();
}
@Override
public void remove(TagKey<Item> tag) {
add(tag, 0);
resetCache();
}
@Override
public void clear(ItemConvertible item) {
itemCookTimes.removeInt(item);
resetCache();
}
@Override
public void clear(TagKey<Item> tag) {
tagCookTimes.removeInt(tag);
resetCache();
}
public void apply(Map<Item, Integer> map) {
// tags take precedence before blocks
for (TagKey<Item> tag : tagCookTimes.keySet()) {
int time = tagCookTimes.getInt(tag);
if (time <= 0) {
for (RegistryEntry<Item> key : Registries.ITEM.iterateEntries(tag)) {
final Item item = key.value();
map.remove(item);
}
} else {
AbstractFurnaceBlockEntity.addFuel(map, tag, time);
}
}
for (ItemConvertible item : itemCookTimes.keySet()) {
int time = itemCookTimes.getInt(item);
if (time <= 0) {
map.remove(item.asItem());
} else {
AbstractFurnaceBlockEntity.addFuel(map, item, time);
}
}
}
private static String getTagName(TagKey<?> tag) {
return tag.id().toString();
}
public void resetCache() {
// Note: tag reload is already handled by vanilla, see DataPackContents#refresh
AbstractFurnaceBlockEntity.clearFuelTimes();
}
}

View file

@ -0,0 +1,48 @@
/*
* 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.impl.content.registry;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import net.minecraft.entity.passive.VillagerEntity;
import net.minecraft.item.Item;
import net.fabricmc.fabric.impl.content.registry.util.ImmutableCollectionUtils;
import net.fabricmc.fabric.mixin.content.registry.FarmerWorkTaskAccessor;
import net.fabricmc.fabric.mixin.content.registry.VillagerEntityAccessor;
public final class VillagerInteractionRegistriesImpl {
private static final Set<Item> GATHERABLE_ITEMS = new HashSet<>();
private VillagerInteractionRegistriesImpl() {
}
public static Set<Item> getCollectableRegistry() {
return GATHERABLE_ITEMS;
}
public static List<Item> getCompostableRegistry() {
return ImmutableCollectionUtils.getAsMutableList(FarmerWorkTaskAccessor::fabric_getCompostable, FarmerWorkTaskAccessor::fabric_setCompostables);
}
public static Map<Item, Integer> getFoodRegistry() {
return ImmutableCollectionUtils.getAsMutableMap(() -> VillagerEntity.ITEM_FOOD_VALUES, VillagerEntityAccessor::fabric_setItemFoodValues);
}
}

View file

@ -1,49 +0,0 @@
/*
* 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.content.registry;
import java.util.Map;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import net.minecraft.block.entity.AbstractFurnaceBlockEntity;
import net.minecraft.item.Item;
import net.fabricmc.fabric.api.registry.FuelRegistry;
import net.fabricmc.fabric.impl.content.registry.FuelRegistryImpl;
@Mixin(AbstractFurnaceBlockEntity.class)
public class AbstractFurnaceBlockEntityMixin {
@Inject(at = @At("RETURN"), method = "createFuelTimeMap")
private static void fuelTimeMapHook(CallbackInfoReturnable<Map<Item, Integer>> info) {
((FuelRegistryImpl) FuelRegistry.INSTANCE).apply(info.getReturnValue());
}
@Redirect(method = "canUseAsFuel", at = @At(value = "INVOKE", target = "Lnet/minecraft/block/entity/AbstractFurnaceBlockEntity;createFuelTimeMap()Ljava/util/Map;"))
private static Map<Item, Integer> canUseAsFuelRedirect() {
return ((FuelRegistryImpl) FuelRegistry.INSTANCE).getFuelTimes();
}
@Redirect(method = "getFuelTime", at = @At(value = "INVOKE", target = "Lnet/minecraft/block/entity/AbstractFurnaceBlockEntity;createFuelTimeMap()Ljava/util/Map;"))
private Map<Item, Integer> getFuelTimeRedirect() {
return ((FuelRegistryImpl) FuelRegistry.INSTANCE).getFuelTimes();
}
}

View file

@ -17,7 +17,6 @@
package net.fabricmc.fabric.mixin.content.registry; package net.fabricmc.fabric.mixin.content.registry;
import java.util.Map; import java.util.Map;
import java.util.Set;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Mutable; import org.spongepowered.asm.mixin.Mutable;
@ -33,15 +32,4 @@ public interface VillagerEntityAccessor {
static void fabric_setItemFoodValues(Map<Item, Integer> items) { static void fabric_setItemFoodValues(Map<Item, Integer> items) {
throw new AssertionError("Untransformed @Accessor"); throw new AssertionError("Untransformed @Accessor");
} }
@Mutable
@Accessor("GATHERABLE_ITEMS")
static void fabric_setGatherableItems(Set<Item> items) {
throw new AssertionError("Untransformed @Accessor");
}
@Accessor("GATHERABLE_ITEMS")
static Set<Item> fabric_getGatherableItems() {
throw new AssertionError("Untransformed @Accessor");
}
} }

View file

@ -0,0 +1,37 @@
/*
* 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.content.registry;
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import net.minecraft.entity.passive.VillagerEntity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.registry.tag.TagKey;
import net.fabricmc.fabric.impl.content.registry.VillagerInteractionRegistriesImpl;
@Mixin(VillagerEntity.class)
public class VillagerEntityMixin {
@WrapOperation(method = "canGather", at = @At(value = "INVOKE", target = "Lnet/minecraft/item/ItemStack;isIn(Lnet/minecraft/registry/tag/TagKey;)Z"))
private boolean useGatherableItemsSet(ItemStack stack, TagKey<Item> tag, Operation<Boolean> original) {
return VillagerInteractionRegistriesImpl.getCollectableRegistry().contains(stack.getItem()) || original.call(stack, tag);
}
}

View file

@ -1,6 +1,3 @@
accessWidener v1 named accessWidener v1 named
accessible method net/minecraft/block/entity/AbstractFurnaceBlockEntity addFuel (Ljava/util/Map;Lnet/minecraft/registry/tag/TagKey;I)V
accessible method net/minecraft/block/entity/AbstractFurnaceBlockEntity addFuel (Ljava/util/Map;Lnet/minecraft/item/ItemConvertible;I)V
accessible method net/minecraft/recipe/BrewingRecipeRegistry$Recipe <init> (Lnet/minecraft/registry/entry/RegistryEntry;Lnet/minecraft/recipe/Ingredient;Lnet/minecraft/registry/entry/RegistryEntry;)V accessible method net/minecraft/recipe/BrewingRecipeRegistry$Recipe <init> (Lnet/minecraft/registry/entry/RegistryEntry;Lnet/minecraft/recipe/Ingredient;Lnet/minecraft/registry/entry/RegistryEntry;)V

View file

@ -1,7 +1,7 @@
{ {
"required": true, "required": true,
"package": "net.fabricmc.fabric.mixin.content.registry", "package": "net.fabricmc.fabric.mixin.content.registry",
"compatibilityLevel": "JAVA_17", "compatibilityLevel": "JAVA_21",
"mixins": [ "mixins": [
"AxeItemAccessor", "AxeItemAccessor",
"BrewingRecipeRegistryBuilderMixin", "BrewingRecipeRegistryBuilderMixin",
@ -11,11 +11,11 @@
"HoeItemAccessor", "HoeItemAccessor",
"HoneycombItemMixin", "HoneycombItemMixin",
"LandPathNodeMakerMixin", "LandPathNodeMakerMixin",
"AbstractFurnaceBlockEntityMixin",
"FireBlockMixin", "FireBlockMixin",
"OxidizableMixin", "OxidizableMixin",
"ShovelItemAccessor", "ShovelItemAccessor",
"VillagerEntityAccessor" "VillagerEntityAccessor",
"VillagerEntityMixin"
], ],
"injectors": { "injectors": {
"defaultRequire": 1 "defaultRequire": 1

View file

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

View file

@ -20,10 +20,7 @@ import java.util.function.Consumer;
import net.minecraft.block.Blocks; import net.minecraft.block.Blocks;
import net.minecraft.block.ComposterBlock; import net.minecraft.block.ComposterBlock;
import net.minecraft.block.HopperBlock;
import net.minecraft.block.entity.AbstractFurnaceBlockEntity;
import net.minecraft.block.entity.BrewingStandBlockEntity; import net.minecraft.block.entity.BrewingStandBlockEntity;
import net.minecraft.block.entity.HopperBlockEntity;
import net.minecraft.component.DataComponentTypes; import net.minecraft.component.DataComponentTypes;
import net.minecraft.component.type.PotionContentsComponent; import net.minecraft.component.type.PotionContentsComponent;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
@ -34,7 +31,6 @@ import net.minecraft.test.GameTest;
import net.minecraft.test.TestContext; import net.minecraft.test.TestContext;
import net.minecraft.util.Hand; import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.world.GameMode; import net.minecraft.world.GameMode;
import net.fabricmc.fabric.api.gametest.v1.FabricGameTest; import net.fabricmc.fabric.api.gametest.v1.FabricGameTest;
@ -67,35 +63,6 @@ public class ContentRegistryGameTest {
context.complete(); context.complete();
} }
@GameTest(templateName = FabricGameTest.EMPTY_STRUCTURE, tickLimit = 110)
public void testFuelRegistry(TestContext context) {
BlockPos pos = new BlockPos(0, 1, 0);
// Use blast furnace to make it cook faster (100 ticks / 200 ticks)
context.setBlockState(pos, Blocks.BLAST_FURNACE);
if (!(context.getBlockEntity(pos) instanceof AbstractFurnaceBlockEntity furnace)) {
throw new AssertionError("Furnace was not placed");
}
furnace.setStack(0, new ItemStack(Items.RAW_IRON, 1));
// Ensure hopper inserts fuel to the furnace
context.setBlockState(pos.east(), Blocks.HOPPER.getDefaultState().with(HopperBlock.FACING, Direction.WEST));
if (!(context.getBlockEntity(pos.east()) instanceof HopperBlockEntity hopper)) {
throw new AssertionError("Hopper was not placed");
}
// 100 ticks/1 smelted item worth of fuel.
hopper.setStack(0, new ItemStack(Items.OBSIDIAN, 2));
hopper.setStack(1, new ItemStack(Items.DIRT));
context.waitAndRun(105, () -> {
context.assertTrue(hopper.isEmpty(), "fuel hopper should have been emptied");
context.assertTrue(ItemStack.areEqual(furnace.getStack(2), new ItemStack(Items.IRON_INGOT, 1)), "one iron ingot should have been smelted");
context.complete();
});
}
@GameTest(templateName = FabricGameTest.EMPTY_STRUCTURE) @GameTest(templateName = FabricGameTest.EMPTY_STRUCTURE)
public void testStrippableBlockRegistry(TestContext context) { public void testStrippableBlockRegistry(TestContext context) {
BlockPos pos = new BlockPos(0, 1, 0); BlockPos pos = new BlockPos(0, 1, 0);

View file

@ -54,7 +54,6 @@ import net.fabricmc.fabric.api.registry.CompostingChanceRegistry;
import net.fabricmc.fabric.api.registry.FabricBrewingRecipeRegistryBuilder; import net.fabricmc.fabric.api.registry.FabricBrewingRecipeRegistryBuilder;
import net.fabricmc.fabric.api.registry.FlammableBlockRegistry; import net.fabricmc.fabric.api.registry.FlammableBlockRegistry;
import net.fabricmc.fabric.api.registry.FlattenableBlockRegistry; import net.fabricmc.fabric.api.registry.FlattenableBlockRegistry;
import net.fabricmc.fabric.api.registry.FuelRegistry;
import net.fabricmc.fabric.api.registry.LandPathNodeTypesRegistry; import net.fabricmc.fabric.api.registry.LandPathNodeTypesRegistry;
import net.fabricmc.fabric.api.registry.OxidizableBlocksRegistry; import net.fabricmc.fabric.api.registry.OxidizableBlocksRegistry;
import net.fabricmc.fabric.api.registry.SculkSensorFrequencyRegistry; import net.fabricmc.fabric.api.registry.SculkSensorFrequencyRegistry;
@ -94,8 +93,6 @@ public final class ContentRegistryTest implements ModInitializer {
FlammableBlockRegistry.getDefaultInstance().add(Blocks.DIAMOND_BLOCK, 4, 4); FlammableBlockRegistry.getDefaultInstance().add(Blocks.DIAMOND_BLOCK, 4, 4);
FlammableBlockRegistry.getDefaultInstance().add(BlockTags.SAND, 4, 4); FlammableBlockRegistry.getDefaultInstance().add(BlockTags.SAND, 4, 4);
FlattenableBlockRegistry.register(Blocks.RED_WOOL, Blocks.YELLOW_WOOL.getDefaultState()); FlattenableBlockRegistry.register(Blocks.RED_WOOL, Blocks.YELLOW_WOOL.getDefaultState());
FuelRegistry.INSTANCE.add(Items.OBSIDIAN, 50);
FuelRegistry.INSTANCE.add(ItemTags.DIRT, 100);
LandPathNodeTypesRegistry.register(Blocks.DEAD_BUSH, PathNodeType.DAMAGE_OTHER, PathNodeType.DANGER_OTHER); LandPathNodeTypesRegistry.register(Blocks.DEAD_BUSH, PathNodeType.DAMAGE_OTHER, PathNodeType.DANGER_OTHER);
StrippableBlockRegistry.register(Blocks.QUARTZ_PILLAR, Blocks.HAY_BLOCK); StrippableBlockRegistry.register(Blocks.QUARTZ_PILLAR, Blocks.HAY_BLOCK);
@ -134,12 +131,9 @@ public final class ContentRegistryTest implements ModInitializer {
LOGGER.info("OxidizableBlocksRegistry test passed!"); LOGGER.info("OxidizableBlocksRegistry test passed!");
} }
VillagerInteractionRegistries.registerCollectable(Items.APPLE);
VillagerInteractionRegistries.registerFood(Items.APPLE, 4); VillagerInteractionRegistries.registerFood(Items.APPLE, 4);
VillagerInteractionRegistries.registerCompostable(Items.APPLE); VillagerInteractionRegistries.registerCompostable(Items.APPLE);
VillagerInteractionRegistries.registerCollectable(Items.OAK_SAPLING);
VillagerInteractionRegistries.registerGiftLootTable(VillagerProfession.NITWIT, RegistryKey.of(RegistryKeys.LOOT_TABLE, Identifier.ofVanilla("fake_loot_table"))); VillagerInteractionRegistries.registerGiftLootTable(VillagerProfession.NITWIT, RegistryKey.of(RegistryKeys.LOOT_TABLE, Identifier.ofVanilla("fake_loot_table")));
Registry.register(Registries.BLOCK, TEST_EVENT_ID, new TestEventBlock(AbstractBlock.Settings.copy(Blocks.STONE))); Registry.register(Registries.BLOCK, TEST_EVENT_ID, new TestEventBlock(AbstractBlock.Settings.copy(Blocks.STONE)));
@ -162,8 +156,8 @@ public final class ContentRegistryTest implements ModInitializer {
* This testmod uses an accessor due to Loom limitations that prevent TAWs from applying across Gradle subproject boundaries */ * This testmod uses an accessor due to Loom limitations that prevent TAWs from applying across Gradle subproject boundaries */
FabricBrewingRecipeRegistryBuilder.BUILD.register(builder -> { FabricBrewingRecipeRegistryBuilder.BUILD.register(builder -> {
builder.registerPotionType(dirtyPotion); builder.registerPotionType(dirtyPotion);
builder.registerItemRecipe(Items.POTION, Ingredient.fromTag(ItemTags.DIRT), dirtyPotion); builder.registerItemRecipe(Items.POTION, Ingredient.fromTag(Registries.ITEM.getEntryList(ItemTags.DIRT).get()), dirtyPotion);
builder.registerPotionRecipe(Potions.AWKWARD, Ingredient.fromTag(ItemTags.SMALL_FLOWERS), Potions.HEALING); builder.registerPotionRecipe(Potions.AWKWARD, Ingredient.fromTag(Registries.ITEM.getEntryList(ItemTags.SMALL_FLOWERS).get()), Potions.HEALING);
if (builder.getEnabledFeatures().contains(FeatureFlags.BUNDLE)) { if (builder.getEnabledFeatures().contains(FeatureFlags.BUNDLE)) {
builder.registerPotionRecipe(Potions.AWKWARD, Ingredient.ofItems(Items.BUNDLE), Potions.LUCK); builder.registerPotionRecipe(Potions.AWKWARD, Ingredient.ofItems(Items.BUNDLE), Potions.LUCK);

View file

@ -1,7 +1,7 @@
{ {
"required": true, "required": true,
"package": "net.fabricmc.fabric.test.mixin.content.registry", "package": "net.fabricmc.fabric.test.mixin.content.registry",
"compatibilityLevel": "JAVA_17", "compatibilityLevel": "JAVA_21",
"mixins": [ "mixins": [
], ],
"injectors": { "injectors": {

View file

@ -16,7 +16,7 @@
"FabricMC" "FabricMC"
], ],
"depends": { "depends": {
"fabricloader": ">=0.15.11", "fabricloader": ">=0.16.2",
"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

@ -81,12 +81,12 @@ public class TranslationConventionLogWarnings implements ModInitializer {
List<TagKey<Item>> untranslatedItemTags = new ObjectArrayList<>(); List<TagKey<Item>> untranslatedItemTags = new ObjectArrayList<>();
itemRegistry.streamTags().forEach(itemTagKey -> { itemRegistry.streamTags().forEach(itemTagKey -> {
// We do not translate vanilla's tags at this moment. // We do not translate vanilla's tags at this moment.
if (itemTagKey.id().getNamespace().equals(Identifier.DEFAULT_NAMESPACE)) { if (itemTagKey.getTag().id().getNamespace().equals(Identifier.DEFAULT_NAMESPACE)) {
return; return;
} }
if (!language.hasTranslation(itemTagKey.getTranslationKey())) { if (!language.hasTranslation(itemTagKey.getTag().getTranslationKey())) {
untranslatedItemTags.add(itemTagKey); untranslatedItemTags.add(itemTagKey.getTag());
} }
}); });

View file

@ -1,7 +1,7 @@
{ {
"required": true, "required": true,
"package": "net.fabricmc.fabric.mixin.tag", "package": "net.fabricmc.fabric.mixin.tag",
"compatibilityLevel": "JAVA_17", "compatibilityLevel": "JAVA_21",
"mixins": [ "mixins": [
"TagKeyMixin" "TagKeyMixin"
], ],

View file

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

View file

@ -1,7 +1,7 @@
{ {
"required": true, "required": true,
"package": "net.fabricmc.fabric.mixin.crash.report.info", "package": "net.fabricmc.fabric.mixin.crash.report.info",
"compatibilityLevel": "JAVA_17", "compatibilityLevel": "JAVA_21",
"mixins": [ "mixins": [
"SystemDetailsMixin" "SystemDetailsMixin"
], ],

View file

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

View file

@ -1,7 +1,7 @@
{ {
"required": true, "required": true,
"package": "net.fabricmc.fabric.mixin.attachment.client", "package": "net.fabricmc.fabric.mixin.attachment.client",
"compatibilityLevel": "JAVA_17", "compatibilityLevel": "JAVA_21",
"mixins": [ "mixins": [
], ],
"injectors": { "injectors": {

View file

@ -16,55 +16,72 @@
package net.fabricmc.fabric.mixin.attachment; package net.fabricmc.fabric.mixin.attachment;
import com.llamalad7.mixinextras.injector.ModifyExpressionValue; import com.llamalad7.mixinextras.sugar.Share;
import com.llamalad7.mixinextras.sugar.ref.LocalRef;
import org.jetbrains.annotations.Nullable;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import net.minecraft.nbt.NbtCompound; import net.minecraft.nbt.NbtCompound;
import net.minecraft.nbt.NbtElement;
import net.minecraft.registry.DynamicRegistryManager;
import net.minecraft.server.world.ServerWorld; import net.minecraft.server.world.ServerWorld;
import net.minecraft.util.math.ChunkPos; import net.minecraft.util.math.ChunkPos;
import net.minecraft.world.ChunkSerializer; import net.minecraft.world.ChunkSerializer;
import net.minecraft.world.HeightLimitView;
import net.minecraft.world.chunk.Chunk; import net.minecraft.world.chunk.Chunk;
import net.minecraft.world.chunk.ProtoChunk; import net.minecraft.world.chunk.ProtoChunk;
import net.minecraft.world.chunk.WorldChunk;
import net.minecraft.world.poi.PointOfInterestStorage; import net.minecraft.world.poi.PointOfInterestStorage;
import net.minecraft.world.storage.StorageKey; import net.minecraft.world.storage.StorageKey;
import net.fabricmc.fabric.api.attachment.v1.AttachmentTarget;
import net.fabricmc.fabric.impl.attachment.AttachmentTargetImpl; import net.fabricmc.fabric.impl.attachment.AttachmentTargetImpl;
@Mixin(ChunkSerializer.class) @Mixin(ChunkSerializer.class)
abstract class ChunkSerializerMixin { abstract class ChunkSerializerMixin {
@ModifyExpressionValue( // Adding a mutable record field like this is likely a bad idea, but I cannot see a better way.
at = @At( @Unique
value = "NEW", @Nullable
target = "net/minecraft/world/chunk/WorldChunk" private NbtCompound attachmentNbtData;
),
method = "deserialize" @Inject(method = "method_61794", at = @At("RETURN"))
) private static void storeAttachmentNbtData(HeightLimitView heightLimitView, DynamicRegistryManager dynamicRegistryManager, NbtCompound nbt, CallbackInfoReturnable<ChunkSerializer> cir, @Share("attachmentDataNbt") LocalRef<NbtCompound> attachmentDataNbt) {
private static WorldChunk readWorldChunkAttachments(WorldChunk chunk, ServerWorld world, PointOfInterestStorage poiStorage, StorageKey storageKey, ChunkPos chunkPos, NbtCompound nbt) { final ChunkSerializer serializer = cir.getReturnValue();
((AttachmentTargetImpl) chunk).fabric_readAttachmentsFromNbt(nbt, world.getRegistryManager());
return chunk; if (serializer == null) {
return;
}
if (nbt.contains(AttachmentTarget.NBT_ATTACHMENT_KEY, NbtElement.COMPOUND_TYPE)) {
((ChunkSerializerMixin) (Object) serializer).attachmentNbtData = nbt.getCompound(AttachmentTarget.NBT_ATTACHMENT_KEY);
}
} }
@ModifyExpressionValue( @Inject(method = "deserialize", at = @At("RETURN"))
at = @At( private void setAttachmentDataInChunk(ServerWorld serverWorld, PointOfInterestStorage pointOfInterestStorage, StorageKey storageKey, ChunkPos chunkPos, CallbackInfoReturnable<ProtoChunk> cir) {
value = "NEW", ProtoChunk chunk = cir.getReturnValue();
target = "net/minecraft/world/chunk/ProtoChunk"
), if (chunk != null && attachmentNbtData != null) {
method = "deserialize" var nbt = new NbtCompound();
) nbt.put(AttachmentTarget.NBT_ATTACHMENT_KEY, attachmentNbtData);
private static ProtoChunk readProtoChunkAttachments(ProtoChunk chunk, ServerWorld world, PointOfInterestStorage poiStorage, StorageKey storageKey, ChunkPos chunkPos, NbtCompound nbt) { ((AttachmentTargetImpl) chunk).fabric_readAttachmentsFromNbt(nbt, serverWorld.getRegistryManager());
((AttachmentTargetImpl) chunk).fabric_readAttachmentsFromNbt(nbt, world.getRegistryManager()); }
return chunk;
} }
@Inject( @Inject(method = "method_61793", at = @At("RETURN"))
at = @At("RETURN"), private static void storeAttachmentNbtData(ServerWorld world, Chunk chunk, CallbackInfoReturnable<ChunkSerializer> cir) {
method = "serialize" var nbt = new NbtCompound();
) ((AttachmentTargetImpl) chunk).fabric_writeAttachmentsToNbt(nbt, world.getRegistryManager());
private static void writeChunkAttachments(ServerWorld world, Chunk chunk, CallbackInfoReturnable<NbtCompound> cir) { ((ChunkSerializerMixin) (Object) cir.getReturnValue()).attachmentNbtData = nbt.getCompound(AttachmentTarget.NBT_ATTACHMENT_KEY);
((AttachmentTargetImpl) chunk).fabric_writeAttachmentsToNbt(cir.getReturnValue(), world.getRegistryManager()); }
@Inject(method = "serialize", at = @At("RETURN"))
private void writeChunkAttachments(CallbackInfoReturnable<NbtCompound> cir) {
if (attachmentNbtData != null) {
cir.getReturnValue().put(AttachmentTarget.NBT_ATTACHMENT_KEY, attachmentNbtData);
}
} }
} }

View file

@ -1,7 +1,7 @@
{ {
"required": true, "required": true,
"package": "net.fabricmc.fabric.mixin.attachment", "package": "net.fabricmc.fabric.mixin.attachment",
"compatibilityLevel": "JAVA_17", "compatibilityLevel": "JAVA_21",
"mixins": [ "mixins": [
"AttachmentTargetsMixin", "AttachmentTargetsMixin",
"BannerBlockEntityMixin", "BannerBlockEntityMixin",

View file

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

View file

@ -21,6 +21,7 @@ import java.util.function.IntSupplier;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityType; import net.minecraft.entity.EntityType;
import net.minecraft.entity.SpawnReason;
import net.minecraft.entity.mob.MobEntity; import net.minecraft.entity.mob.MobEntity;
import net.minecraft.server.MinecraftServer; import net.minecraft.server.MinecraftServer;
import net.minecraft.server.world.ServerWorld; import net.minecraft.server.world.ServerWorld;
@ -52,7 +53,7 @@ public class AttachmentCopyTests implements FabricGameTest {
ServerWorld end = server.getWorld(World.END); ServerWorld end = server.getWorld(World.END);
// using overworld and end to avoid portal code related to the nether // using overworld and end to avoid portal code related to the nether
Entity entity = EntityType.PIG.create(overworld); Entity entity = EntityType.PIG.create(overworld, SpawnReason.SPAWN_EGG);
Objects.requireNonNull(entity, "entity was null"); Objects.requireNonNull(entity, "entity was null");
entity.setAttached(DUMMY, () -> 10); entity.setAttached(DUMMY, () -> 10);
entity.setAttached(COPY_ON_DEATH, () -> 10); entity.setAttached(COPY_ON_DEATH, () -> 10);
@ -73,7 +74,7 @@ public class AttachmentCopyTests implements FabricGameTest {
@GameTest(templateName = FabricGameTest.EMPTY_STRUCTURE) @GameTest(templateName = FabricGameTest.EMPTY_STRUCTURE)
public void testMobConversion(TestContext context) { public void testMobConversion(TestContext context) {
MobEntity mob = Objects.requireNonNull(EntityType.ZOMBIE.create(context.getWorld())); MobEntity mob = Objects.requireNonNull(EntityType.ZOMBIE.create(context.getWorld(), SpawnReason.SPAWN_EGG));
mob.setAttached(DUMMY, () -> 42); mob.setAttached(DUMMY, () -> 42);
mob.setAttached(COPY_ON_DEATH, () -> 42); mob.setAttached(COPY_ON_DEATH, () -> 42);
MobEntity converted = mob.convertTo(EntityType.DROWNED, false); MobEntity converted = mob.convertTo(EntityType.DROWNED, false);

View file

@ -1,7 +1,7 @@
{ {
"required": true, "required": true,
"package": "net.fabricmc.fabric.test.attachment.mixin", "package": "net.fabricmc.fabric.test.attachment.mixin",
"compatibilityLevel": "JAVA_17", "compatibilityLevel": "JAVA_21",
"mixins": [ "mixins": [
"BlockEntityTypeAccessor" "BlockEntityTypeAccessor"
], ],

View file

@ -83,7 +83,7 @@ task generateAccessWidener() {
def classes = getClasses(inputJar) def classes = getClasses(inputJar)
visitMethods(classes["net/minecraft/data/server/recipe/RecipeProvider"]) { name, desc, owner -> visitMethods(classes["net/minecraft/data/server/recipe/RecipeGenerator"]) { name, desc, owner ->
if (it.name == "generate") if (it.name == "generate")
return return

View file

@ -1,7 +1,7 @@
{ {
"required": true, "required": true,
"package": "net.fabricmc.fabric.mixin.datagen.client", "package": "net.fabricmc.fabric.mixin.datagen.client",
"compatibilityLevel": "JAVA_17", "compatibilityLevel": "JAVA_21",
"client": [ "client": [
"MinecraftClientMixin" "MinecraftClientMixin"
], ],

View file

@ -30,14 +30,16 @@ import org.jetbrains.annotations.Nullable;
import net.minecraft.advancement.Advancement; import net.minecraft.advancement.Advancement;
import net.minecraft.advancement.AdvancementEntry; import net.minecraft.advancement.AdvancementEntry;
import net.minecraft.data.DataOutput;
import net.minecraft.data.DataProvider; import net.minecraft.data.DataProvider;
import net.minecraft.data.DataWriter; import net.minecraft.data.DataWriter;
import net.minecraft.data.server.recipe.CraftingRecipeJsonBuilder; import net.minecraft.data.server.recipe.CraftingRecipeJsonBuilder;
import net.minecraft.data.server.recipe.RecipeExporter; import net.minecraft.data.server.recipe.RecipeExporter;
import net.minecraft.data.server.recipe.RecipeProvider; import net.minecraft.data.server.recipe.RecipeGenerator;
import net.minecraft.data.server.recipe.ShapedRecipeJsonBuilder; import net.minecraft.data.server.recipe.ShapedRecipeJsonBuilder;
import net.minecraft.data.server.recipe.ShapelessRecipeJsonBuilder; import net.minecraft.data.server.recipe.ShapelessRecipeJsonBuilder;
import net.minecraft.recipe.Recipe; import net.minecraft.recipe.Recipe;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.registry.RegistryOps; import net.minecraft.registry.RegistryOps;
import net.minecraft.registry.RegistryWrapper; import net.minecraft.registry.RegistryWrapper;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
@ -48,23 +50,25 @@ import net.fabricmc.fabric.api.resource.conditions.v1.ResourceCondition;
import net.fabricmc.fabric.impl.datagen.FabricDataGenHelper; import net.fabricmc.fabric.impl.datagen.FabricDataGenHelper;
/** /**
* Extend this class and implement {@link FabricRecipeProvider#generate}. * Extend this class and implement {@link FabricRecipeProvider#getRecipeGenerator}.
* *
* <p>Register an instance of the class with {@link FabricDataGenerator.Pack#addProvider} in a {@link net.fabricmc.fabric.api.datagen.v1.DataGeneratorEntrypoint}. * <p>Register an instance of the class with {@link FabricDataGenerator.Pack#addProvider} in a {@link net.fabricmc.fabric.api.datagen.v1.DataGeneratorEntrypoint}.
*/ */
public abstract class FabricRecipeProvider extends RecipeProvider { public abstract class FabricRecipeProvider extends RecipeGenerator.RecipeProvider {
protected final FabricDataOutput output; protected final FabricDataOutput output;
private final CompletableFuture<RegistryWrapper.WrapperLookup> registriesFuture;
public FabricRecipeProvider(FabricDataOutput output, CompletableFuture<RegistryWrapper.WrapperLookup> registriesFuture) { public FabricRecipeProvider(FabricDataOutput output, CompletableFuture<RegistryWrapper.WrapperLookup> registriesFuture) {
super(output, registriesFuture); super(output, registriesFuture);
this.output = output; this.output = output;
this.registriesFuture = registriesFuture;
} }
/** /**
* Implement this method and then use the range of methods in {@link RecipeProvider} or from one of the recipe json factories such as {@link ShapedRecipeJsonBuilder} or {@link ShapelessRecipeJsonBuilder}. * Implement this method and then use the range of methods in {@link RecipeGenerator} or from one of the recipe json factories such as {@link ShapedRecipeJsonBuilder} or {@link ShapelessRecipeJsonBuilder}.
*/ */
@Override @Override
public abstract void generate(RecipeExporter exporter); protected abstract RecipeGenerator getRecipeGenerator(RegistryWrapper.WrapperLookup registryLookup, RecipeExporter exporter);
/** /**
* Return a new exporter that applies the specified conditions to any recipe json provider it receives. * Return a new exporter that applies the specified conditions to any recipe json provider it receives.
@ -82,43 +86,56 @@ public abstract class FabricRecipeProvider extends RecipeProvider {
public Advancement.Builder getAdvancementBuilder() { public Advancement.Builder getAdvancementBuilder() {
return exporter.getAdvancementBuilder(); return exporter.getAdvancementBuilder();
} }
@Override
public void addRootAdvancement() {
}
}; };
} }
@Override @Override
public CompletableFuture<?> run(DataWriter writer, RegistryWrapper.WrapperLookup wrapperLookup) { public CompletableFuture<?> run(DataWriter writer) {
Set<Identifier> generatedRecipes = Sets.newHashSet(); return registriesFuture.thenCompose((wrapperLookup -> {
List<CompletableFuture<?>> list = new ArrayList<>(); Set<Identifier> generatedRecipes = Sets.newHashSet();
generate(new RecipeExporter() { List<CompletableFuture<?>> list = new ArrayList<>();
@Override getRecipeGenerator(wrapperLookup, new RecipeExporter() {
public void accept(Identifier recipeId, Recipe<?> recipe, @Nullable AdvancementEntry advancement) { @Override
Identifier identifier = getRecipeIdentifier(recipeId); public void accept(Identifier recipeId, Recipe<?> recipe, @Nullable AdvancementEntry advancement) {
Identifier identifier = getRecipeIdentifier(recipeId);
if (!generatedRecipes.add(identifier)) { if (!generatedRecipes.add(identifier)) {
throw new IllegalStateException("Duplicate recipe " + identifier); throw new IllegalStateException("Duplicate recipe " + identifier);
}
RegistryOps<JsonElement> registryOps = wrapperLookup.getOps(JsonOps.INSTANCE);
JsonObject recipeJson = Recipe.CODEC.encodeStart(registryOps, recipe).getOrThrow(IllegalStateException::new).getAsJsonObject();
ResourceCondition[] conditions = FabricDataGenHelper.consumeConditions(recipe);
FabricDataGenHelper.addConditions(recipeJson, conditions);
final DataOutput.PathResolver recipesPathResolver = output.getResolver(RegistryKeys.RECIPE);
final DataOutput.PathResolver advancementsPathResolver = output.getResolver(RegistryKeys.ADVANCEMENT);
list.add(DataProvider.writeToPath(writer, recipeJson, recipesPathResolver.resolveJson(identifier)));
if (advancement != null) {
JsonObject advancementJson = Advancement.CODEC.encodeStart(registryOps, advancement.value()).getOrThrow(IllegalStateException::new).getAsJsonObject();
FabricDataGenHelper.addConditions(advancementJson, conditions);
list.add(DataProvider.writeToPath(writer, advancementJson, advancementsPathResolver.resolveJson(getRecipeIdentifier(advancement.id()))));
}
} }
RegistryOps<JsonElement> registryOps = wrapperLookup.getOps(JsonOps.INSTANCE); @Override
JsonObject recipeJson = Recipe.CODEC.encodeStart(registryOps, recipe).getOrThrow(IllegalStateException::new).getAsJsonObject(); public Advancement.Builder getAdvancementBuilder() {
ResourceCondition[] conditions = FabricDataGenHelper.consumeConditions(recipe); //noinspection removal
FabricDataGenHelper.addConditions(recipeJson, conditions); return Advancement.Builder.createUntelemetered().parent(CraftingRecipeJsonBuilder.ROOT);
list.add(DataProvider.writeToPath(writer, recipeJson, recipesPathResolver.resolveJson(identifier)));
if (advancement != null) {
JsonObject advancementJson = Advancement.CODEC.encodeStart(registryOps, advancement.value()).getOrThrow(IllegalStateException::new).getAsJsonObject();
FabricDataGenHelper.addConditions(advancementJson, conditions);
list.add(DataProvider.writeToPath(writer, advancementJson, advancementsPathResolver.resolveJson(getRecipeIdentifier(advancement.id()))));
} }
}
@Override @Override
public Advancement.Builder getAdvancementBuilder() { public void addRootAdvancement() {
//noinspection removal }
return Advancement.Builder.createUntelemetered().parent(CraftingRecipeJsonBuilder.ROOT); });
} return CompletableFuture.allOf(list.toArray(CompletableFuture[]::new));
}); }));
return CompletableFuture.allOf(list.toArray(CompletableFuture[]::new));
} }
/** /**

View file

@ -16,8 +16,6 @@
package net.fabricmc.fabric.mixin.datagen.server; package net.fabricmc.fabric.mixin.datagen.server;
import java.io.IOException;
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.Inject; import org.spongepowered.asm.mixin.injection.Inject;
@ -30,7 +28,7 @@ import net.fabricmc.fabric.impl.datagen.FabricDataGenHelper;
@Mixin(Main.class) @Mixin(Main.class)
public class MainMixin { public class MainMixin {
@Inject(method = "main", at = @At(value = "NEW", target = "net/minecraft/server/dedicated/ServerPropertiesLoader"), cancellable = true) @Inject(method = "main", at = @At(value = "NEW", target = "net/minecraft/server/dedicated/ServerPropertiesLoader"), cancellable = true)
private static void main(String[] args, CallbackInfo info) throws IOException { private static void main(String[] args, CallbackInfo info) {
if (FabricDataGenHelper.ENABLED) { if (FabricDataGenHelper.ENABLED) {
FabricDataGenHelper.run(); FabricDataGenHelper.run();
info.cancel(); info.cancel();

View file

@ -6,8 +6,8 @@ accessWidener v2 named
accessible field net/minecraft/data/DataGenerator output Lnet/minecraft/data/DataOutput; accessible field net/minecraft/data/DataGenerator output Lnet/minecraft/data/DataOutput;
mutable field net/minecraft/data/DataGenerator output Lnet/minecraft/data/DataOutput; mutable field net/minecraft/data/DataGenerator output Lnet/minecraft/data/DataOutput;
accessible field net/minecraft/data/server/recipe/RecipeProvider recipesPathResolver Lnet/minecraft/data/DataOutput$PathResolver; accessible class net/minecraft/data/server/recipe/RecipeGenerator$RecipeProvider
accessible field net/minecraft/data/server/recipe/RecipeProvider advancementsPathResolver Lnet/minecraft/data/DataOutput$PathResolver; extendable method net/minecraft/data/server/recipe/RecipeGenerator$RecipeProvider run (Lnet/minecraft/data/DataWriter;)Ljava/util/concurrent/CompletableFuture;
accessible field net/minecraft/data/server/tag/TagProvider$ProvidedTagBuilder builder Lnet/minecraft/registry/tag/TagBuilder; accessible field net/minecraft/data/server/tag/TagProvider$ProvidedTagBuilder builder Lnet/minecraft/registry/tag/TagBuilder;
extendable method net/minecraft/data/server/tag/TagProvider$ProvidedTagBuilder add (Lnet/minecraft/registry/RegistryKey;)Lnet/minecraft/data/server/tag/TagProvider$ProvidedTagBuilder; extendable method net/minecraft/data/server/tag/TagProvider$ProvidedTagBuilder add (Lnet/minecraft/registry/RegistryKey;)Lnet/minecraft/data/server/tag/TagProvider$ProvidedTagBuilder;
@ -54,89 +54,92 @@ 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_SHEARS Lnet/minecraft/loot/condition/LootCondition$Builder;
### Generated access wideners below ### Generated access wideners below
transitive-accessible method net/minecraft/data/server/recipe/RecipeProvider run (Lnet/minecraft/data/DataWriter;Lnet/minecraft/registry/RegistryWrapper$WrapperLookup;)Ljava/util/concurrent/CompletableFuture; transitive-accessible method net/minecraft/data/server/recipe/RecipeGenerator generate ()V
transitive-accessible method net/minecraft/data/server/recipe/RecipeProvider saveRecipeAdvancement (Lnet/minecraft/data/DataWriter;Lnet/minecraft/registry/RegistryWrapper$WrapperLookup;Lnet/minecraft/advancement/AdvancementEntry;)Ljava/util/concurrent/CompletableFuture; transitive-accessible method net/minecraft/data/server/recipe/RecipeGenerator generateFamilies (Lnet/minecraft/resource/featuretoggle/FeatureSet;)V
transitive-accessible method net/minecraft/data/server/recipe/RecipeProvider generate (Lnet/minecraft/data/server/recipe/RecipeExporter;)V transitive-accessible method net/minecraft/data/server/recipe/RecipeGenerator offerSingleOutputShapelessRecipe (Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;Ljava/lang/String;)V
transitive-accessible method net/minecraft/data/server/recipe/RecipeProvider generateFamilies (Lnet/minecraft/data/server/recipe/RecipeExporter;Lnet/minecraft/resource/featuretoggle/FeatureSet;)V transitive-accessible method net/minecraft/data/server/recipe/RecipeGenerator offerShapelessRecipe (Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;Ljava/lang/String;I)V
transitive-accessible method net/minecraft/data/server/recipe/RecipeProvider offerSingleOutputShapelessRecipe (Lnet/minecraft/data/server/recipe/RecipeExporter;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;Ljava/lang/String;)V transitive-accessible method net/minecraft/data/server/recipe/RecipeGenerator offerSmelting (Ljava/util/List;Lnet/minecraft/recipe/book/RecipeCategory;Lnet/minecraft/item/ItemConvertible;FILjava/lang/String;)V
transitive-accessible method net/minecraft/data/server/recipe/RecipeProvider offerShapelessRecipe (Lnet/minecraft/data/server/recipe/RecipeExporter;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;Ljava/lang/String;I)V transitive-accessible method net/minecraft/data/server/recipe/RecipeGenerator offerBlasting (Ljava/util/List;Lnet/minecraft/recipe/book/RecipeCategory;Lnet/minecraft/item/ItemConvertible;FILjava/lang/String;)V
transitive-accessible method net/minecraft/data/server/recipe/RecipeProvider offerSmelting (Lnet/minecraft/data/server/recipe/RecipeExporter;Ljava/util/List;Lnet/minecraft/recipe/book/RecipeCategory;Lnet/minecraft/item/ItemConvertible;FILjava/lang/String;)V transitive-accessible method net/minecraft/data/server/recipe/RecipeGenerator offerMultipleOptions (Lnet/minecraft/recipe/RecipeSerializer;Lnet/minecraft/recipe/AbstractCookingRecipe$RecipeFactory;Ljava/util/List;Lnet/minecraft/recipe/book/RecipeCategory;Lnet/minecraft/item/ItemConvertible;FILjava/lang/String;Ljava/lang/String;)V
transitive-accessible method net/minecraft/data/server/recipe/RecipeProvider offerBlasting (Lnet/minecraft/data/server/recipe/RecipeExporter;Ljava/util/List;Lnet/minecraft/recipe/book/RecipeCategory;Lnet/minecraft/item/ItemConvertible;FILjava/lang/String;)V transitive-accessible method net/minecraft/data/server/recipe/RecipeGenerator offerNetheriteUpgradeRecipe (Lnet/minecraft/item/Item;Lnet/minecraft/recipe/book/RecipeCategory;Lnet/minecraft/item/Item;)V
transitive-accessible method net/minecraft/data/server/recipe/RecipeProvider offerMultipleOptions (Lnet/minecraft/data/server/recipe/RecipeExporter;Lnet/minecraft/recipe/RecipeSerializer;Lnet/minecraft/recipe/AbstractCookingRecipe$RecipeFactory;Ljava/util/List;Lnet/minecraft/recipe/book/RecipeCategory;Lnet/minecraft/item/ItemConvertible;FILjava/lang/String;Ljava/lang/String;)V transitive-accessible method net/minecraft/data/server/recipe/RecipeGenerator offerSmithingTrimRecipe (Lnet/minecraft/item/Item;Lnet/minecraft/util/Identifier;)V
transitive-accessible method net/minecraft/data/server/recipe/RecipeProvider offerNetheriteUpgradeRecipe (Lnet/minecraft/data/server/recipe/RecipeExporter;Lnet/minecraft/item/Item;Lnet/minecraft/recipe/book/RecipeCategory;Lnet/minecraft/item/Item;)V transitive-accessible method net/minecraft/data/server/recipe/RecipeGenerator offer2x2CompactingRecipe (Lnet/minecraft/recipe/book/RecipeCategory;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;)V
transitive-accessible method net/minecraft/data/server/recipe/RecipeProvider offerSmithingTrimRecipe (Lnet/minecraft/data/server/recipe/RecipeExporter;Lnet/minecraft/item/Item;Lnet/minecraft/util/Identifier;)V transitive-accessible method net/minecraft/data/server/recipe/RecipeGenerator offerCompactingRecipe (Lnet/minecraft/recipe/book/RecipeCategory;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;Ljava/lang/String;)V
transitive-accessible method net/minecraft/data/server/recipe/RecipeProvider offer2x2CompactingRecipe (Lnet/minecraft/data/server/recipe/RecipeExporter;Lnet/minecraft/recipe/book/RecipeCategory;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;)V transitive-accessible method net/minecraft/data/server/recipe/RecipeGenerator offerCompactingRecipe (Lnet/minecraft/recipe/book/RecipeCategory;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;)V
transitive-accessible method net/minecraft/data/server/recipe/RecipeProvider offerCompactingRecipe (Lnet/minecraft/data/server/recipe/RecipeExporter;Lnet/minecraft/recipe/book/RecipeCategory;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;Ljava/lang/String;)V transitive-accessible method net/minecraft/data/server/recipe/RecipeGenerator offerPlanksRecipe2 (Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/registry/tag/TagKey;I)V
transitive-accessible method net/minecraft/data/server/recipe/RecipeProvider offerCompactingRecipe (Lnet/minecraft/data/server/recipe/RecipeExporter;Lnet/minecraft/recipe/book/RecipeCategory;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;)V transitive-accessible method net/minecraft/data/server/recipe/RecipeGenerator offerPlanksRecipe (Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/registry/tag/TagKey;I)V
transitive-accessible method net/minecraft/data/server/recipe/RecipeProvider offerPlanksRecipe2 (Lnet/minecraft/data/server/recipe/RecipeExporter;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/registry/tag/TagKey;I)V transitive-accessible method net/minecraft/data/server/recipe/RecipeGenerator offerBarkBlockRecipe (Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;)V
transitive-accessible method net/minecraft/data/server/recipe/RecipeProvider offerPlanksRecipe (Lnet/minecraft/data/server/recipe/RecipeExporter;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/registry/tag/TagKey;I)V transitive-accessible method net/minecraft/data/server/recipe/RecipeGenerator offerBoatRecipe (Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;)V
transitive-accessible method net/minecraft/data/server/recipe/RecipeProvider offerBarkBlockRecipe (Lnet/minecraft/data/server/recipe/RecipeExporter;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;)V transitive-accessible method net/minecraft/data/server/recipe/RecipeGenerator offerChestBoatRecipe (Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;)V
transitive-accessible method net/minecraft/data/server/recipe/RecipeProvider offerBoatRecipe (Lnet/minecraft/data/server/recipe/RecipeExporter;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;)V transitive-accessible method net/minecraft/data/server/recipe/RecipeGenerator createButtonRecipe (Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/recipe/Ingredient;)Lnet/minecraft/data/server/recipe/CraftingRecipeJsonBuilder;
transitive-accessible method net/minecraft/data/server/recipe/RecipeProvider offerChestBoatRecipe (Lnet/minecraft/data/server/recipe/RecipeExporter;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;)V transitive-accessible method net/minecraft/data/server/recipe/RecipeGenerator createDoorRecipe (Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/recipe/Ingredient;)Lnet/minecraft/data/server/recipe/CraftingRecipeJsonBuilder;
transitive-accessible method net/minecraft/data/server/recipe/RecipeProvider createTransmutationRecipe (Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/recipe/Ingredient;)Lnet/minecraft/data/server/recipe/CraftingRecipeJsonBuilder; transitive-accessible method net/minecraft/data/server/recipe/RecipeGenerator createFenceRecipe (Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/recipe/Ingredient;)Lnet/minecraft/data/server/recipe/CraftingRecipeJsonBuilder;
transitive-accessible method net/minecraft/data/server/recipe/RecipeProvider createDoorRecipe (Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/recipe/Ingredient;)Lnet/minecraft/data/server/recipe/CraftingRecipeJsonBuilder; transitive-accessible method net/minecraft/data/server/recipe/RecipeGenerator createFenceGateRecipe (Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/recipe/Ingredient;)Lnet/minecraft/data/server/recipe/CraftingRecipeJsonBuilder;
transitive-accessible method net/minecraft/data/server/recipe/RecipeProvider createFenceRecipe (Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/recipe/Ingredient;)Lnet/minecraft/data/server/recipe/CraftingRecipeJsonBuilder; transitive-accessible method net/minecraft/data/server/recipe/RecipeGenerator offerPressurePlateRecipe (Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;)V
transitive-accessible method net/minecraft/data/server/recipe/RecipeProvider createFenceGateRecipe (Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/recipe/Ingredient;)Lnet/minecraft/data/server/recipe/CraftingRecipeJsonBuilder; transitive-accessible method net/minecraft/data/server/recipe/RecipeGenerator createPressurePlateRecipe (Lnet/minecraft/recipe/book/RecipeCategory;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/recipe/Ingredient;)Lnet/minecraft/data/server/recipe/CraftingRecipeJsonBuilder;
transitive-accessible method net/minecraft/data/server/recipe/RecipeProvider offerPressurePlateRecipe (Lnet/minecraft/data/server/recipe/RecipeExporter;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;)V transitive-accessible method net/minecraft/data/server/recipe/RecipeGenerator offerSlabRecipe (Lnet/minecraft/recipe/book/RecipeCategory;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;)V
transitive-accessible method net/minecraft/data/server/recipe/RecipeProvider createPressurePlateRecipe (Lnet/minecraft/recipe/book/RecipeCategory;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/recipe/Ingredient;)Lnet/minecraft/data/server/recipe/CraftingRecipeJsonBuilder; transitive-accessible method net/minecraft/data/server/recipe/RecipeGenerator createSlabRecipe (Lnet/minecraft/recipe/book/RecipeCategory;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/recipe/Ingredient;)Lnet/minecraft/data/server/recipe/CraftingRecipeJsonBuilder;
transitive-accessible method net/minecraft/data/server/recipe/RecipeProvider offerSlabRecipe (Lnet/minecraft/data/server/recipe/RecipeExporter;Lnet/minecraft/recipe/book/RecipeCategory;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;)V transitive-accessible method net/minecraft/data/server/recipe/RecipeGenerator createStairsRecipe (Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/recipe/Ingredient;)Lnet/minecraft/data/server/recipe/CraftingRecipeJsonBuilder;
transitive-accessible method net/minecraft/data/server/recipe/RecipeProvider createSlabRecipe (Lnet/minecraft/recipe/book/RecipeCategory;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/recipe/Ingredient;)Lnet/minecraft/data/server/recipe/CraftingRecipeJsonBuilder; transitive-accessible method net/minecraft/data/server/recipe/RecipeGenerator createTrapdoorRecipe (Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/recipe/Ingredient;)Lnet/minecraft/data/server/recipe/CraftingRecipeJsonBuilder;
transitive-accessible method net/minecraft/data/server/recipe/RecipeProvider createStairsRecipe (Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/recipe/Ingredient;)Lnet/minecraft/data/server/recipe/CraftingRecipeJsonBuilder; transitive-accessible method net/minecraft/data/server/recipe/RecipeGenerator createSignRecipe (Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/recipe/Ingredient;)Lnet/minecraft/data/server/recipe/CraftingRecipeJsonBuilder;
transitive-accessible method net/minecraft/data/server/recipe/RecipeProvider createTrapdoorRecipe (Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/recipe/Ingredient;)Lnet/minecraft/data/server/recipe/CraftingRecipeJsonBuilder; transitive-accessible method net/minecraft/data/server/recipe/RecipeGenerator offerHangingSignRecipe (Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;)V
transitive-accessible method net/minecraft/data/server/recipe/RecipeProvider createSignRecipe (Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/recipe/Ingredient;)Lnet/minecraft/data/server/recipe/CraftingRecipeJsonBuilder; transitive-accessible method net/minecraft/data/server/recipe/RecipeGenerator offerDyeableRecipes (Ljava/util/List;Ljava/util/List;Ljava/lang/String;)V
transitive-accessible method net/minecraft/data/server/recipe/RecipeProvider offerHangingSignRecipe (Lnet/minecraft/data/server/recipe/RecipeExporter;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;)V transitive-accessible method net/minecraft/data/server/recipe/RecipeGenerator offerDyeablesRecipes (Ljava/util/List;Ljava/util/List;Lnet/minecraft/item/Item;Ljava/lang/String;Lnet/minecraft/recipe/book/RecipeCategory;)V
transitive-accessible method net/minecraft/data/server/recipe/RecipeProvider offerDyeableRecipes (Lnet/minecraft/data/server/recipe/RecipeExporter;Ljava/util/List;Ljava/util/List;Ljava/lang/String;)V transitive-accessible method net/minecraft/data/server/recipe/RecipeGenerator offerCarpetRecipe (Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;)V
transitive-accessible method net/minecraft/data/server/recipe/RecipeProvider offerCarpetRecipe (Lnet/minecraft/data/server/recipe/RecipeExporter;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;)V transitive-accessible method net/minecraft/data/server/recipe/RecipeGenerator offerBedRecipe (Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;)V
transitive-accessible method net/minecraft/data/server/recipe/RecipeProvider offerBedRecipe (Lnet/minecraft/data/server/recipe/RecipeExporter;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;)V transitive-accessible method net/minecraft/data/server/recipe/RecipeGenerator offerBannerRecipe (Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;)V
transitive-accessible method net/minecraft/data/server/recipe/RecipeProvider offerBannerRecipe (Lnet/minecraft/data/server/recipe/RecipeExporter;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;)V transitive-accessible method net/minecraft/data/server/recipe/RecipeGenerator offerStainedGlassDyeingRecipe (Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;)V
transitive-accessible method net/minecraft/data/server/recipe/RecipeProvider offerStainedGlassDyeingRecipe (Lnet/minecraft/data/server/recipe/RecipeExporter;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;)V transitive-accessible method net/minecraft/data/server/recipe/RecipeGenerator offerStainedGlassPaneRecipe (Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;)V
transitive-accessible method net/minecraft/data/server/recipe/RecipeProvider offerStainedGlassPaneRecipe (Lnet/minecraft/data/server/recipe/RecipeExporter;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;)V transitive-accessible method net/minecraft/data/server/recipe/RecipeGenerator offerStainedGlassPaneDyeingRecipe (Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;)V
transitive-accessible method net/minecraft/data/server/recipe/RecipeProvider offerStainedGlassPaneDyeingRecipe (Lnet/minecraft/data/server/recipe/RecipeExporter;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;)V transitive-accessible method net/minecraft/data/server/recipe/RecipeGenerator offerTerracottaDyeingRecipe (Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;)V
transitive-accessible method net/minecraft/data/server/recipe/RecipeProvider offerTerracottaDyeingRecipe (Lnet/minecraft/data/server/recipe/RecipeExporter;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;)V transitive-accessible method net/minecraft/data/server/recipe/RecipeGenerator offerConcretePowderDyeingRecipe (Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;)V
transitive-accessible method net/minecraft/data/server/recipe/RecipeProvider offerConcretePowderDyeingRecipe (Lnet/minecraft/data/server/recipe/RecipeExporter;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;)V transitive-accessible method net/minecraft/data/server/recipe/RecipeGenerator offerCandleDyeingRecipe (Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;)V
transitive-accessible method net/minecraft/data/server/recipe/RecipeProvider offerCandleDyeingRecipe (Lnet/minecraft/data/server/recipe/RecipeExporter;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;)V transitive-accessible method net/minecraft/data/server/recipe/RecipeGenerator offerWallRecipe (Lnet/minecraft/recipe/book/RecipeCategory;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;)V
transitive-accessible method net/minecraft/data/server/recipe/RecipeProvider offerWallRecipe (Lnet/minecraft/data/server/recipe/RecipeExporter;Lnet/minecraft/recipe/book/RecipeCategory;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;)V transitive-accessible method net/minecraft/data/server/recipe/RecipeGenerator getWallRecipe (Lnet/minecraft/recipe/book/RecipeCategory;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/recipe/Ingredient;)Lnet/minecraft/data/server/recipe/CraftingRecipeJsonBuilder;
transitive-accessible method net/minecraft/data/server/recipe/RecipeProvider getWallRecipe (Lnet/minecraft/recipe/book/RecipeCategory;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/recipe/Ingredient;)Lnet/minecraft/data/server/recipe/CraftingRecipeJsonBuilder; transitive-accessible method net/minecraft/data/server/recipe/RecipeGenerator offerPolishedStoneRecipe (Lnet/minecraft/recipe/book/RecipeCategory;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;)V
transitive-accessible method net/minecraft/data/server/recipe/RecipeProvider offerPolishedStoneRecipe (Lnet/minecraft/data/server/recipe/RecipeExporter;Lnet/minecraft/recipe/book/RecipeCategory;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;)V transitive-accessible method net/minecraft/data/server/recipe/RecipeGenerator createCondensingRecipe (Lnet/minecraft/recipe/book/RecipeCategory;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/recipe/Ingredient;)Lnet/minecraft/data/server/recipe/CraftingRecipeJsonBuilder;
transitive-accessible method net/minecraft/data/server/recipe/RecipeProvider createCondensingRecipe (Lnet/minecraft/recipe/book/RecipeCategory;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/recipe/Ingredient;)Lnet/minecraft/data/server/recipe/CraftingRecipeJsonBuilder; transitive-accessible method net/minecraft/data/server/recipe/RecipeGenerator offerCutCopperRecipe (Lnet/minecraft/recipe/book/RecipeCategory;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;)V
transitive-accessible method net/minecraft/data/server/recipe/RecipeProvider offerCutCopperRecipe (Lnet/minecraft/data/server/recipe/RecipeExporter;Lnet/minecraft/recipe/book/RecipeCategory;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;)V transitive-accessible method net/minecraft/data/server/recipe/RecipeGenerator createCutCopperRecipe (Lnet/minecraft/recipe/book/RecipeCategory;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/recipe/Ingredient;)Lnet/minecraft/data/server/recipe/ShapedRecipeJsonBuilder;
transitive-accessible method net/minecraft/data/server/recipe/RecipeProvider createCutCopperRecipe (Lnet/minecraft/recipe/book/RecipeCategory;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/recipe/Ingredient;)Lnet/minecraft/data/server/recipe/ShapedRecipeJsonBuilder; transitive-accessible method net/minecraft/data/server/recipe/RecipeGenerator offerChiseledBlockRecipe (Lnet/minecraft/recipe/book/RecipeCategory;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;)V
transitive-accessible method net/minecraft/data/server/recipe/RecipeProvider offerChiseledBlockRecipe (Lnet/minecraft/data/server/recipe/RecipeExporter;Lnet/minecraft/recipe/book/RecipeCategory;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;)V transitive-accessible method net/minecraft/data/server/recipe/RecipeGenerator offerMosaicRecipe (Lnet/minecraft/recipe/book/RecipeCategory;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;)V
transitive-accessible method net/minecraft/data/server/recipe/RecipeProvider offerMosaicRecipe (Lnet/minecraft/data/server/recipe/RecipeExporter;Lnet/minecraft/recipe/book/RecipeCategory;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;)V transitive-accessible method net/minecraft/data/server/recipe/RecipeGenerator createChiseledBlockRecipe (Lnet/minecraft/recipe/book/RecipeCategory;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/recipe/Ingredient;)Lnet/minecraft/data/server/recipe/ShapedRecipeJsonBuilder;
transitive-accessible method net/minecraft/data/server/recipe/RecipeProvider createChiseledBlockRecipe (Lnet/minecraft/recipe/book/RecipeCategory;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/recipe/Ingredient;)Lnet/minecraft/data/server/recipe/ShapedRecipeJsonBuilder; transitive-accessible method net/minecraft/data/server/recipe/RecipeGenerator offerStonecuttingRecipe (Lnet/minecraft/recipe/book/RecipeCategory;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;)V
transitive-accessible method net/minecraft/data/server/recipe/RecipeProvider offerStonecuttingRecipe (Lnet/minecraft/data/server/recipe/RecipeExporter;Lnet/minecraft/recipe/book/RecipeCategory;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;)V transitive-accessible method net/minecraft/data/server/recipe/RecipeGenerator offerStonecuttingRecipe (Lnet/minecraft/recipe/book/RecipeCategory;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;I)V
transitive-accessible method net/minecraft/data/server/recipe/RecipeProvider offerStonecuttingRecipe (Lnet/minecraft/data/server/recipe/RecipeExporter;Lnet/minecraft/recipe/book/RecipeCategory;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;I)V transitive-accessible method net/minecraft/data/server/recipe/RecipeGenerator offerCrackingRecipe (Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;)V
transitive-accessible method net/minecraft/data/server/recipe/RecipeProvider offerCrackingRecipe (Lnet/minecraft/data/server/recipe/RecipeExporter;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;)V transitive-accessible method net/minecraft/data/server/recipe/RecipeGenerator offerReversibleCompactingRecipes (Lnet/minecraft/recipe/book/RecipeCategory;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/recipe/book/RecipeCategory;Lnet/minecraft/item/ItemConvertible;)V
transitive-accessible method net/minecraft/data/server/recipe/RecipeProvider offerReversibleCompactingRecipes (Lnet/minecraft/data/server/recipe/RecipeExporter;Lnet/minecraft/recipe/book/RecipeCategory;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/recipe/book/RecipeCategory;Lnet/minecraft/item/ItemConvertible;)V transitive-accessible method net/minecraft/data/server/recipe/RecipeGenerator offerReversibleCompactingRecipesWithCompactingRecipeGroup (Lnet/minecraft/recipe/book/RecipeCategory;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/recipe/book/RecipeCategory;Lnet/minecraft/item/ItemConvertible;Ljava/lang/String;Ljava/lang/String;)V
transitive-accessible method net/minecraft/data/server/recipe/RecipeProvider offerReversibleCompactingRecipesWithCompactingRecipeGroup (Lnet/minecraft/data/server/recipe/RecipeExporter;Lnet/minecraft/recipe/book/RecipeCategory;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/recipe/book/RecipeCategory;Lnet/minecraft/item/ItemConvertible;Ljava/lang/String;Ljava/lang/String;)V transitive-accessible method net/minecraft/data/server/recipe/RecipeGenerator offerReversibleCompactingRecipesWithReverseRecipeGroup (Lnet/minecraft/recipe/book/RecipeCategory;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/recipe/book/RecipeCategory;Lnet/minecraft/item/ItemConvertible;Ljava/lang/String;Ljava/lang/String;)V
transitive-accessible method net/minecraft/data/server/recipe/RecipeProvider offerReversibleCompactingRecipesWithReverseRecipeGroup (Lnet/minecraft/data/server/recipe/RecipeExporter;Lnet/minecraft/recipe/book/RecipeCategory;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/recipe/book/RecipeCategory;Lnet/minecraft/item/ItemConvertible;Ljava/lang/String;Ljava/lang/String;)V transitive-accessible method net/minecraft/data/server/recipe/RecipeGenerator offerReversibleCompactingRecipes (Lnet/minecraft/recipe/book/RecipeCategory;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/recipe/book/RecipeCategory;Lnet/minecraft/item/ItemConvertible;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
transitive-accessible method net/minecraft/data/server/recipe/RecipeProvider offerReversibleCompactingRecipes (Lnet/minecraft/data/server/recipe/RecipeExporter;Lnet/minecraft/recipe/book/RecipeCategory;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/recipe/book/RecipeCategory;Lnet/minecraft/item/ItemConvertible;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V transitive-accessible method net/minecraft/data/server/recipe/RecipeGenerator offerSmithingTemplateCopyingRecipe (Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;)V
transitive-accessible method net/minecraft/data/server/recipe/RecipeProvider offerSmithingTemplateCopyingRecipe (Lnet/minecraft/data/server/recipe/RecipeExporter;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/registry/tag/TagKey;)V transitive-accessible method net/minecraft/data/server/recipe/RecipeGenerator offerSmithingTemplateCopyingRecipe (Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/recipe/Ingredient;)V
transitive-accessible method net/minecraft/data/server/recipe/RecipeProvider offerSmithingTemplateCopyingRecipe (Lnet/minecraft/data/server/recipe/RecipeExporter;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;)V transitive-accessible method net/minecraft/data/server/recipe/RecipeGenerator generateCookingRecipes (Ljava/lang/String;Lnet/minecraft/recipe/RecipeSerializer;Lnet/minecraft/recipe/AbstractCookingRecipe$RecipeFactory;I)V
transitive-accessible method net/minecraft/data/server/recipe/RecipeProvider offerSmithingTemplateCopyingRecipe (Lnet/minecraft/data/server/recipe/RecipeExporter;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/recipe/Ingredient;)V transitive-accessible method net/minecraft/data/server/recipe/RecipeGenerator offerFoodCookingRecipe (Ljava/lang/String;Lnet/minecraft/recipe/RecipeSerializer;Lnet/minecraft/recipe/AbstractCookingRecipe$RecipeFactory;ILnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;F)V
transitive-accessible method net/minecraft/data/server/recipe/RecipeProvider generateCookingRecipes (Lnet/minecraft/data/server/recipe/RecipeExporter;Ljava/lang/String;Lnet/minecraft/recipe/RecipeSerializer;Lnet/minecraft/recipe/AbstractCookingRecipe$RecipeFactory;I)V transitive-accessible method net/minecraft/data/server/recipe/RecipeGenerator offerWaxingRecipes (Lnet/minecraft/resource/featuretoggle/FeatureSet;)V
transitive-accessible method net/minecraft/data/server/recipe/RecipeProvider offerFoodCookingRecipe (Lnet/minecraft/data/server/recipe/RecipeExporter;Ljava/lang/String;Lnet/minecraft/recipe/RecipeSerializer;Lnet/minecraft/recipe/AbstractCookingRecipe$RecipeFactory;ILnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;F)V transitive-accessible method net/minecraft/data/server/recipe/RecipeGenerator offerGrateRecipe (Lnet/minecraft/block/Block;Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/server/recipe/RecipeProvider offerWaxingRecipes (Lnet/minecraft/data/server/recipe/RecipeExporter;Lnet/minecraft/resource/featuretoggle/FeatureSet;)V transitive-accessible method net/minecraft/data/server/recipe/RecipeGenerator offerBulbRecipe (Lnet/minecraft/block/Block;Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/server/recipe/RecipeProvider offerGrateRecipe (Lnet/minecraft/data/server/recipe/RecipeExporter;Lnet/minecraft/block/Block;Lnet/minecraft/block/Block;)V transitive-accessible method net/minecraft/data/server/recipe/RecipeGenerator offerSuspiciousStewRecipe (Lnet/minecraft/item/Item;Lnet/minecraft/block/SuspiciousStewIngredient;)V
transitive-accessible method net/minecraft/data/server/recipe/RecipeProvider offerBulbRecipe (Lnet/minecraft/data/server/recipe/RecipeExporter;Lnet/minecraft/block/Block;Lnet/minecraft/block/Block;)V transitive-accessible method net/minecraft/data/server/recipe/RecipeGenerator generateFamily (Lnet/minecraft/data/family/BlockFamily;Lnet/minecraft/resource/featuretoggle/FeatureSet;)V
transitive-accessible method net/minecraft/data/server/recipe/RecipeProvider generateFamily (Lnet/minecraft/data/server/recipe/RecipeExporter;Lnet/minecraft/data/family/BlockFamily;Lnet/minecraft/resource/featuretoggle/FeatureSet;)V transitive-accessible method net/minecraft/data/server/recipe/RecipeGenerator getVariantRecipeInput (Lnet/minecraft/data/family/BlockFamily;Lnet/minecraft/data/family/BlockFamily$Variant;)Lnet/minecraft/block/Block;
transitive-accessible method net/minecraft/data/server/recipe/RecipeProvider getVariantRecipeInput (Lnet/minecraft/data/family/BlockFamily;Lnet/minecraft/data/family/BlockFamily$Variant;)Lnet/minecraft/block/Block; transitive-accessible method net/minecraft/data/server/recipe/RecipeGenerator requireEnteringFluid (Lnet/minecraft/block/Block;)Lnet/minecraft/advancement/AdvancementCriterion;
transitive-accessible method net/minecraft/data/server/recipe/RecipeProvider requireEnteringFluid (Lnet/minecraft/block/Block;)Lnet/minecraft/advancement/AdvancementCriterion; transitive-accessible method net/minecraft/data/server/recipe/RecipeGenerator conditionsFromItem (Lnet/minecraft/predicate/NumberRange$IntRange;Lnet/minecraft/item/ItemConvertible;)Lnet/minecraft/advancement/AdvancementCriterion;
transitive-accessible method net/minecraft/data/server/recipe/RecipeProvider conditionsFromItem (Lnet/minecraft/predicate/NumberRange$IntRange;Lnet/minecraft/item/ItemConvertible;)Lnet/minecraft/advancement/AdvancementCriterion; transitive-accessible method net/minecraft/data/server/recipe/RecipeGenerator conditionsFromItem (Lnet/minecraft/item/ItemConvertible;)Lnet/minecraft/advancement/AdvancementCriterion;
transitive-accessible method net/minecraft/data/server/recipe/RecipeProvider conditionsFromItem (Lnet/minecraft/item/ItemConvertible;)Lnet/minecraft/advancement/AdvancementCriterion; transitive-accessible method net/minecraft/data/server/recipe/RecipeGenerator conditionsFromTag (Lnet/minecraft/registry/tag/TagKey;)Lnet/minecraft/advancement/AdvancementCriterion;
transitive-accessible method net/minecraft/data/server/recipe/RecipeProvider conditionsFromTag (Lnet/minecraft/registry/tag/TagKey;)Lnet/minecraft/advancement/AdvancementCriterion; transitive-accessible method net/minecraft/data/server/recipe/RecipeGenerator conditionsFromPredicates ([Lnet/minecraft/predicate/item/ItemPredicate$Builder;)Lnet/minecraft/advancement/AdvancementCriterion;
transitive-accessible method net/minecraft/data/server/recipe/RecipeProvider conditionsFromPredicates ([Lnet/minecraft/predicate/item/ItemPredicate$Builder;)Lnet/minecraft/advancement/AdvancementCriterion; transitive-accessible method net/minecraft/data/server/recipe/RecipeGenerator conditionsFromItemPredicates ([Lnet/minecraft/predicate/item/ItemPredicate;)Lnet/minecraft/advancement/AdvancementCriterion;
transitive-accessible method net/minecraft/data/server/recipe/RecipeProvider conditionsFromItemPredicates ([Lnet/minecraft/predicate/item/ItemPredicate;)Lnet/minecraft/advancement/AdvancementCriterion; transitive-accessible method net/minecraft/data/server/recipe/RecipeGenerator hasItem (Lnet/minecraft/item/ItemConvertible;)Ljava/lang/String;
transitive-accessible method net/minecraft/data/server/recipe/RecipeProvider hasItem (Lnet/minecraft/item/ItemConvertible;)Ljava/lang/String; transitive-accessible method net/minecraft/data/server/recipe/RecipeGenerator getItemPath (Lnet/minecraft/item/ItemConvertible;)Ljava/lang/String;
transitive-accessible method net/minecraft/data/server/recipe/RecipeProvider getItemPath (Lnet/minecraft/item/ItemConvertible;)Ljava/lang/String; transitive-accessible method net/minecraft/data/server/recipe/RecipeGenerator getRecipeName (Lnet/minecraft/item/ItemConvertible;)Ljava/lang/String;
transitive-accessible method net/minecraft/data/server/recipe/RecipeProvider getRecipeName (Lnet/minecraft/item/ItemConvertible;)Ljava/lang/String; transitive-accessible method net/minecraft/data/server/recipe/RecipeGenerator convertBetween (Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;)Ljava/lang/String;
transitive-accessible method net/minecraft/data/server/recipe/RecipeProvider convertBetween (Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;)Ljava/lang/String; transitive-accessible method net/minecraft/data/server/recipe/RecipeGenerator getSmeltingItemPath (Lnet/minecraft/item/ItemConvertible;)Ljava/lang/String;
transitive-accessible method net/minecraft/data/server/recipe/RecipeProvider getSmeltingItemPath (Lnet/minecraft/item/ItemConvertible;)Ljava/lang/String; transitive-accessible method net/minecraft/data/server/recipe/RecipeGenerator getBlastingItemPath (Lnet/minecraft/item/ItemConvertible;)Ljava/lang/String;
transitive-accessible method net/minecraft/data/server/recipe/RecipeProvider getBlastingItemPath (Lnet/minecraft/item/ItemConvertible;)Ljava/lang/String; transitive-accessible method net/minecraft/data/server/recipe/RecipeGenerator ingredientFromTag (Lnet/minecraft/registry/tag/TagKey;)Lnet/minecraft/recipe/Ingredient;
transitive-accessible method net/minecraft/data/server/recipe/RecipeGenerator createShaped (Lnet/minecraft/recipe/book/RecipeCategory;Lnet/minecraft/item/ItemConvertible;)Lnet/minecraft/data/server/recipe/ShapedRecipeJsonBuilder;
transitive-accessible method net/minecraft/data/server/recipe/RecipeGenerator createShaped (Lnet/minecraft/recipe/book/RecipeCategory;Lnet/minecraft/item/ItemConvertible;I)Lnet/minecraft/data/server/recipe/ShapedRecipeJsonBuilder;
transitive-accessible method net/minecraft/data/server/recipe/RecipeGenerator createShapeless (Lnet/minecraft/recipe/book/RecipeCategory;Lnet/minecraft/item/ItemStack;)Lnet/minecraft/data/server/recipe/ShapelessRecipeJsonBuilder;
transitive-accessible method net/minecraft/data/server/recipe/RecipeGenerator createShapeless (Lnet/minecraft/recipe/book/RecipeCategory;Lnet/minecraft/item/ItemConvertible;)Lnet/minecraft/data/server/recipe/ShapelessRecipeJsonBuilder;
transitive-accessible method net/minecraft/data/server/recipe/RecipeGenerator createShapeless (Lnet/minecraft/recipe/book/RecipeCategory;Lnet/minecraft/item/ItemConvertible;I)Lnet/minecraft/data/server/recipe/ShapelessRecipeJsonBuilder;
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator createStoneState (Lnet/minecraft/block/Block;Lnet/minecraft/util/Identifier;Lnet/minecraft/data/client/TextureMap;Ljava/util/function/BiConsumer;)Lnet/minecraft/data/client/BlockStateSupplier; transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator createStoneState (Lnet/minecraft/block/Block;Lnet/minecraft/util/Identifier;Lnet/minecraft/data/client/TextureMap;Ljava/util/function/BiConsumer;)Lnet/minecraft/data/client/BlockStateSupplier;
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator createMudBrickState (Lnet/minecraft/block/Block;Lnet/minecraft/util/Identifier;Lnet/minecraft/data/client/TextureMap;Ljava/util/function/BiConsumer;)Lnet/minecraft/data/client/BlockStateSupplier; transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator createMudBrickState (Lnet/minecraft/block/Block;Lnet/minecraft/util/Identifier;Lnet/minecraft/data/client/TextureMap;Ljava/util/function/BiConsumer;)Lnet/minecraft/data/client/BlockStateSupplier;
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator createDeepslateState (Lnet/minecraft/block/Block;Lnet/minecraft/util/Identifier;Lnet/minecraft/data/client/TextureMap;Ljava/util/function/BiConsumer;)Lnet/minecraft/data/client/BlockStateSupplier; transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator createDeepslateState (Lnet/minecraft/block/Block;Lnet/minecraft/util/Identifier;Lnet/minecraft/data/client/TextureMap;Ljava/util/function/BiConsumer;)Lnet/minecraft/data/client/BlockStateSupplier;
@ -256,6 +259,7 @@ transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator
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 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 createWithoutSilkTouchCondition ()Lnet/minecraft/loot/condition/LootCondition$Builder;
transitive-accessible method net/minecraft/data/server/loottable/BlockLootTableGenerator createWithShearsCondition ()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 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 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;
@ -327,5 +331,4 @@ transitive-extendable method net/minecraft/data/report/RegistryDumpProvider getN
transitive-extendable method net/minecraft/data/server/DynamicRegistriesProvider getName ()Ljava/lang/String; transitive-extendable method net/minecraft/data/server/DynamicRegistriesProvider getName ()Ljava/lang/String;
transitive-extendable method net/minecraft/data/server/advancement/AdvancementProvider getName ()Ljava/lang/String; transitive-extendable method net/minecraft/data/server/advancement/AdvancementProvider getName ()Ljava/lang/String;
transitive-extendable method net/minecraft/data/server/loottable/LootTableProvider getName ()Ljava/lang/String; transitive-extendable method net/minecraft/data/server/loottable/LootTableProvider getName ()Ljava/lang/String;
transitive-extendable method net/minecraft/data/server/recipe/RecipeProvider getName ()Ljava/lang/String;
transitive-extendable method net/minecraft/data/server/tag/TagProvider getName ()Ljava/lang/String; transitive-extendable method net/minecraft/data/server/tag/TagProvider getName ()Ljava/lang/String;

View file

@ -1,7 +1,7 @@
{ {
"required": true, "required": true,
"package": "net.fabricmc.fabric.mixin.datagen", "package": "net.fabricmc.fabric.mixin.datagen",
"compatibilityLevel": "JAVA_17", "compatibilityLevel": "JAVA_21",
"mixins": [ "mixins": [
"DataProviderMixin", "DataProviderMixin",
"ModelProviderMixin", "ModelProviderMixin",

View file

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

View file

@ -50,7 +50,7 @@ import net.minecraft.data.DataOutput;
import net.minecraft.data.client.BlockStateModelGenerator; import net.minecraft.data.client.BlockStateModelGenerator;
import net.minecraft.data.client.ItemModelGenerator; import net.minecraft.data.client.ItemModelGenerator;
import net.minecraft.data.server.recipe.RecipeExporter; import net.minecraft.data.server.recipe.RecipeExporter;
import net.minecraft.data.server.recipe.ShapelessRecipeJsonBuilder; import net.minecraft.data.server.recipe.RecipeGenerator;
import net.minecraft.entity.EntityType; import net.minecraft.entity.EntityType;
import net.minecraft.entity.attribute.EntityAttributes; import net.minecraft.entity.attribute.EntityAttributes;
import net.minecraft.item.Items; import net.minecraft.item.Items;
@ -170,80 +170,90 @@ public class DataGeneratorTestEntrypoint implements DataGeneratorEntrypoint {
} }
@Override @Override
public void generate(RecipeExporter exporter) { protected RecipeGenerator getRecipeGenerator(RegistryWrapper.WrapperLookup registryLookup, RecipeExporter exporter) {
offerPlanksRecipe2(exporter, SIMPLE_BLOCK, ItemTags.ACACIA_LOGS, 1); return new RecipeGenerator(registryLookup, exporter) {
@Override
public void generate() {
offerPlanksRecipe2(SIMPLE_BLOCK, ItemTags.ACACIA_LOGS, 1);
ShapelessRecipeJsonBuilder.create(RecipeCategory.MISC, Items.DIAMOND_ORE, 4).input(Items.ITEM_FRAME) createShapeless(RecipeCategory.MISC, Items.DIAMOND_ORE, 4).input(Items.ITEM_FRAME)
.criterion("has_frame", conditionsFromItem(Items.ITEM_FRAME)) .criterion("has_frame", conditionsFromItem(Items.ITEM_FRAME))
.offerTo(withConditions(exporter, ResourceConditions.registryContains(RegistryKeys.ITEM, Registries.ITEM.getId(Items.DIAMOND_BLOCK)))); .offerTo(withConditions(exporter, ResourceConditions.registryContains(RegistryKeys.ITEM, Registries.ITEM.getId(Items.DIAMOND_BLOCK))));
ShapelessRecipeJsonBuilder.create(RecipeCategory.MISC, Items.EMERALD, 4).input(Items.ITEM_FRAME, 2) createShapeless(RecipeCategory.MISC, Items.EMERALD, 4).input(Items.ITEM_FRAME, 2)
.criterion("has_frame", conditionsFromItem(Items.ITEM_FRAME)) .criterion("has_frame", conditionsFromItem(Items.ITEM_FRAME))
.offerTo(withConditions(exporter, ResourceConditions.registryContains(BiomeKeys.PLAINS, BiomeKeys.BADLANDS))); .offerTo(withConditions(exporter, ResourceConditions.registryContains(BiomeKeys.PLAINS, BiomeKeys.BADLANDS)));
ShapelessRecipeJsonBuilder.create(RecipeCategory.MISC, Items.GOLD_INGOT).input(Items.DIRT).criterion("has_dirt", conditionsFromItem(Items.DIRT)).offerTo(withConditions(exporter, NEVER_LOADED)); createShapeless(RecipeCategory.MISC, Items.GOLD_INGOT).input(Items.DIRT).criterion("has_dirt", conditionsFromItem(Items.DIRT)).offerTo(withConditions(exporter, NEVER_LOADED));
ShapelessRecipeJsonBuilder.create(RecipeCategory.MISC, Items.DIAMOND).input(Items.STICK).criterion("has_stick", conditionsFromItem(Items.STICK)).offerTo(withConditions(exporter, ALWAYS_LOADED)); createShapeless(RecipeCategory.MISC, Items.DIAMOND).input(Items.STICK).criterion("has_stick", conditionsFromItem(Items.STICK)).offerTo(withConditions(exporter, ALWAYS_LOADED));
/* Generate test recipes using all types of custom ingredients for easy testing */ /* Generate test recipes using all types of custom ingredients for easy testing */
// Testing procedure for vanilla and fabric clients: // Testing procedure for vanilla and fabric clients:
// - Create a new fabric server with the ingredient API. // - Create a new fabric server with the ingredient API.
// - Copy the generated recipes to a datapack, for example to world/datapacks/<packname>/data/test/recipe/. // - Copy the generated recipes to a datapack, for example to world/datapacks/<packname>/data/test/recipe/.
// - Remember to also include a pack.mcmeta file in world/datapacks/<packname>. // - Remember to also include a pack.mcmeta file in world/datapacks/<packname>.
// (see https://minecraft.wiki/w/Tutorials/Creating_a_data_pack) // (see https://minecraft.wiki/w/Tutorials/Creating_a_data_pack)
// - Start the server and connect to it with a vanilla client. // - Start the server and connect to it with a vanilla client.
// - Test all the following recipes // - Test all the following recipes
// Test partial NBT // Test partial NBT
// 1 undamaged pickaxe + 8 pickaxes with any damage value to test shapeless matching logic. // 1 undamaged pickaxe + 8 pickaxes with any damage value to test shapeless matching logic.
// Interesting test cases: // Interesting test cases:
// - 9 damaged pickaxes should not match. // - 9 damaged pickaxes should not match.
// - 9 undamaged pickaxes should match. // - 9 undamaged pickaxes should match.
// - 1 undamaged pickaxe + 8 damaged pickaxes should match (regardless of the position). // - 1 undamaged pickaxe + 8 damaged pickaxes should match (regardless of the position).
// - 1 undamaged renamed pickaxe + 8 damaged pickaxes should match (components are not strictly matched here). // - 1 undamaged renamed pickaxe + 8 damaged pickaxes should match (components are not strictly matched here).
ShapelessRecipeJsonBuilder.create(RecipeCategory.MISC, Items.DIAMOND_BLOCK) createShapeless(RecipeCategory.MISC, Items.DIAMOND_BLOCK)
.input(Ingredient.ofItems(Items.DIAMOND_PICKAXE)) .input(Ingredient.ofItems(Items.DIAMOND_PICKAXE))
.input(Ingredient.ofItems(Items.DIAMOND_PICKAXE)) .input(Ingredient.ofItems(Items.DIAMOND_PICKAXE))
.input(Ingredient.ofItems(Items.DIAMOND_PICKAXE)) .input(Ingredient.ofItems(Items.DIAMOND_PICKAXE))
.input(Ingredient.ofItems(Items.DIAMOND_PICKAXE)) .input(Ingredient.ofItems(Items.DIAMOND_PICKAXE))
.input(DefaultCustomIngredients.components( .input(DefaultCustomIngredients.components(
Ingredient.ofItems(Items.DIAMOND_PICKAXE), Ingredient.ofItems(Items.DIAMOND_PICKAXE),
ComponentChanges.builder() ComponentChanges.builder()
.add(DataComponentTypes.DAMAGE, 0) .add(DataComponentTypes.DAMAGE, 0)
.build() .build()
)
) )
) .input(Ingredient.ofItems(Items.DIAMOND_PICKAXE))
.input(Ingredient.ofItems(Items.DIAMOND_PICKAXE)) .input(Ingredient.ofItems(Items.DIAMOND_PICKAXE))
.input(Ingredient.ofItems(Items.DIAMOND_PICKAXE)) .input(Ingredient.ofItems(Items.DIAMOND_PICKAXE))
.input(Ingredient.ofItems(Items.DIAMOND_PICKAXE)) .input(Ingredient.ofItems(Items.DIAMOND_PICKAXE))
.input(Ingredient.ofItems(Items.DIAMOND_PICKAXE)) .criterion("has_pickaxe", conditionsFromItem(Items.DIAMOND_PICKAXE))
.criterion("has_pickaxe", conditionsFromItem(Items.DIAMOND_PICKAXE)) .offerTo(exporter);
.offerTo(exporter);
// Test AND // Test AND
// To test: charcoal should give a torch, but coal should not. // To test: charcoal should give a torch, but coal should not.
ShapelessRecipeJsonBuilder.create(RecipeCategory.MISC, Items.TORCH) createShapeless(RecipeCategory.MISC, Items.TORCH)
// charcoal only // charcoal only
.input(DefaultCustomIngredients.all(Ingredient.fromTag(ItemTags.COALS), Ingredient.ofItems(Items.CHARCOAL))) .input(DefaultCustomIngredients.all(ingredientFromTag(ItemTags.COALS), Ingredient.ofItems(Items.CHARCOAL)))
.criterion("has_charcoal", conditionsFromItem(Items.CHARCOAL)) .criterion("has_charcoal", conditionsFromItem(Items.CHARCOAL))
.offerTo(exporter); .offerTo(exporter);
// Test OR // Test OR
// To test: a golden pickaxe or a golden shovel should give a block of gold. // To test: a golden pickaxe or a golden shovel should give a block of gold.
ShapelessRecipeJsonBuilder.create(RecipeCategory.MISC, Items.GOLD_BLOCK) createShapeless(RecipeCategory.MISC, Items.GOLD_BLOCK)
.input(DefaultCustomIngredients.any(Ingredient.ofItems(Items.GOLDEN_PICKAXE), Ingredient.ofItems(Items.GOLDEN_SHOVEL))) .input(DefaultCustomIngredients.any(Ingredient.ofItems(Items.GOLDEN_PICKAXE), Ingredient.ofItems(Items.GOLDEN_SHOVEL)))
.criterion("has_pickaxe", conditionsFromItem(Items.GOLDEN_PICKAXE)) .criterion("has_pickaxe", conditionsFromItem(Items.GOLDEN_PICKAXE))
.criterion("has_shovel", conditionsFromItem(Items.GOLDEN_SHOVEL)) .criterion("has_shovel", conditionsFromItem(Items.GOLDEN_SHOVEL))
.offerTo(exporter); .offerTo(exporter);
// Test difference // Test difference
// To test: only copper, netherite and emerald should match the recipe. // To test: only copper, netherite and emerald should match the recipe.
ShapelessRecipeJsonBuilder.create(RecipeCategory.MISC, Items.BEACON) createShapeless(RecipeCategory.MISC, Items.BEACON)
.input(DefaultCustomIngredients.difference( .input(DefaultCustomIngredients.difference(
DefaultCustomIngredients.any( DefaultCustomIngredients.any(
Ingredient.fromTag(ItemTags.BEACON_PAYMENT_ITEMS), ingredientFromTag(ItemTags.BEACON_PAYMENT_ITEMS),
Ingredient.ofItems(Items.COPPER_INGOT)), Ingredient.ofItems(Items.COPPER_INGOT)),
Ingredient.ofItems(Items.IRON_INGOT, Items.GOLD_INGOT, Items.DIAMOND))) Ingredient.ofItems(Items.IRON_INGOT, Items.GOLD_INGOT, Items.DIAMOND)))
.criterion("has_payment", conditionsFromTag(ItemTags.BEACON_PAYMENT_ITEMS)) .criterion("has_payment", conditionsFromTag(ItemTags.BEACON_PAYMENT_ITEMS))
.offerTo(exporter); .offerTo(exporter);
}
};
}
@Override
public String getName() {
return "Test Recipes";
} }
} }
@ -257,7 +267,7 @@ public class DataGeneratorTestEntrypoint implements DataGeneratorEntrypoint {
translationBuilder.add(SIMPLE_BLOCK, "Simple Block"); translationBuilder.add(SIMPLE_BLOCK, "Simple Block");
translationBuilder.add(Identifier.of(MOD_ID, "identifier_test"), "Identifier Test"); translationBuilder.add(Identifier.of(MOD_ID, "identifier_test"), "Identifier Test");
translationBuilder.add(EntityType.ALLAY, "Allay"); translationBuilder.add(EntityType.ALLAY, "Allay");
translationBuilder.add(EntityAttributes.GENERIC_ARMOR, "Generic Armor"); translationBuilder.add(EntityAttributes.ARMOR, "Generic Armor");
try { try {
Optional<Path> path = dataOutput.getModContainer().findPath("assets/testmod/lang/en_us.base.json"); Optional<Path> path = dataOutput.getModContainer().findPath("assets/testmod/lang/en_us.base.json");

View file

@ -1,8 +1,8 @@
accessible field net/minecraft/data/DataGenerator output Lnet/minecraft/data/DataOutput; accessible field net/minecraft/data/DataGenerator output Lnet/minecraft/data/DataOutput;
mutable field net/minecraft/data/DataGenerator output Lnet/minecraft/data/DataOutput; mutable field net/minecraft/data/DataGenerator output Lnet/minecraft/data/DataOutput;
accessible field net/minecraft/data/server/recipe/RecipeProvider recipesPathResolver Lnet/minecraft/data/DataOutput$PathResolver; accessible class net/minecraft/data/server/recipe/RecipeGenerator$RecipeProvider
accessible field net/minecraft/data/server/recipe/RecipeProvider advancementsPathResolver Lnet/minecraft/data/DataOutput$PathResolver; extendable method net/minecraft/data/server/recipe/RecipeGenerator$RecipeProvider run (Lnet/minecraft/data/DataWriter;)Ljava/util/concurrent/CompletableFuture;
accessible field net/minecraft/data/server/tag/TagProvider$ProvidedTagBuilder builder Lnet/minecraft/registry/tag/TagBuilder; accessible field net/minecraft/data/server/tag/TagProvider$ProvidedTagBuilder builder Lnet/minecraft/registry/tag/TagBuilder;
extendable method net/minecraft/data/server/tag/TagProvider$ProvidedTagBuilder add (Lnet/minecraft/registry/RegistryKey;)Lnet/minecraft/data/server/tag/TagProvider$ProvidedTagBuilder; extendable method net/minecraft/data/server/tag/TagProvider$ProvidedTagBuilder add (Lnet/minecraft/registry/RegistryKey;)Lnet/minecraft/data/server/tag/TagProvider$ProvidedTagBuilder;
@ -49,6 +49,4 @@ 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_SHEARS Lnet/minecraft/loot/condition/LootCondition$Builder;
### Generated access wideners below ### Generated access wideners below

View file

@ -1,7 +1,7 @@
{ {
"required": true, "required": true,
"package": "net.fabricmc.fabric.mixin.dimension", "package": "net.fabricmc.fabric.mixin.dimension",
"compatibilityLevel": "JAVA_17", "compatibilityLevel": "JAVA_21",
"mixins": [ "mixins": [
"DimensionOptionsRegistryHolderMixin", "DimensionOptionsRegistryHolderMixin",
"Schema2832Mixin", "Schema2832Mixin",

View file

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

View file

@ -35,7 +35,6 @@ import net.minecraft.world.biome.BiomeKeys;
import net.minecraft.world.biome.source.BiomeAccess; import net.minecraft.world.biome.source.BiomeAccess;
import net.minecraft.world.biome.source.FixedBiomeSource; import net.minecraft.world.biome.source.FixedBiomeSource;
import net.minecraft.world.chunk.Chunk; import net.minecraft.world.chunk.Chunk;
import net.minecraft.world.gen.GenerationStep;
import net.minecraft.world.gen.StructureAccessor; import net.minecraft.world.gen.StructureAccessor;
import net.minecraft.world.gen.chunk.Blender; import net.minecraft.world.gen.chunk.Blender;
import net.minecraft.world.gen.chunk.ChunkGenerator; import net.minecraft.world.gen.chunk.ChunkGenerator;
@ -57,7 +56,7 @@ public class VoidChunkGenerator extends ChunkGenerator {
} }
@Override @Override
public void carve(ChunkRegion chunkRegion, long l, NoiseConfig noiseConfig, BiomeAccess biomeAccess, StructureAccessor structureAccessor, Chunk chunk, GenerationStep.Carver carver) { public void carve(ChunkRegion chunkRegion, long seed, NoiseConfig noiseConfig, BiomeAccess biomeAccess, StructureAccessor structureAccessor, Chunk chunk) {
} }
@Override @Override

View file

@ -1,7 +1,7 @@
{ {
"required": true, "required": true,
"package": "net.fabricmc.fabric.mixin.client.entity.event", "package": "net.fabricmc.fabric.mixin.client.entity.event",
"compatibilityLevel": "JAVA_17", "compatibilityLevel": "JAVA_21",
"client": [ "client": [
"elytra.ClientPlayerEntityMixin" "elytra.ClientPlayerEntityMixin"
], ],

View file

@ -16,17 +16,13 @@
package net.fabricmc.fabric.mixin.entity.event; package net.fabricmc.fabric.mixin.entity.event;
import java.util.Set;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.Inject;
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 net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.network.packet.s2c.play.PositionFlag;
import net.minecraft.server.world.ServerWorld; import net.minecraft.server.world.ServerWorld;
import net.minecraft.world.TeleportTarget; import net.minecraft.world.TeleportTarget;
import net.minecraft.world.World; import net.minecraft.world.World;
@ -47,13 +43,4 @@ abstract class EntityMixin {
ServerEntityWorldChangeEvents.AFTER_ENTITY_CHANGE_WORLD.invoker().afterChangeWorld((Entity) (Object) this, ret, (ServerWorld) this.world, (ServerWorld) ret.getWorld()); ServerEntityWorldChangeEvents.AFTER_ENTITY_CHANGE_WORLD.invoker().afterChangeWorld((Entity) (Object) this, ret, (ServerWorld) this.world, (ServerWorld) ret.getWorld());
} }
} }
/**
* We need to fire the change world event for entities that are teleported using the `/teleport` command.
*/
@Inject(method = "teleport(Lnet/minecraft/server/world/ServerWorld;DDDLjava/util/Set;FF)Z", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/Entity;setRemoved(Lnet/minecraft/entity/Entity$RemovalReason;)V"), locals = LocalCapture.CAPTURE_FAILHARD)
private void afterEntityTeleportedToWorld(ServerWorld destination, double x, double y, double z, Set<PositionFlag> flags, float yaw, float pitch, CallbackInfoReturnable<Boolean> cir, float i, Entity newEntity) {
Entity originalEntity = (Entity) (Object) this;
ServerEntityWorldChangeEvents.AFTER_ENTITY_CHANGE_WORLD.invoker().afterChangeWorld(originalEntity, newEntity, ((ServerWorld) originalEntity.getWorld()), destination);
}
} }

View file

@ -1,7 +1,7 @@
{ {
"required": true, "required": true,
"package": "net.fabricmc.fabric.mixin.entity.event", "package": "net.fabricmc.fabric.mixin.entity.event",
"compatibilityLevel": "JAVA_17", "compatibilityLevel": "JAVA_21",
"mixins": [ "mixins": [
"EntityMixin", "EntityMixin",
"LivingEntityMixin", "LivingEntityMixin",

View file

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

View file

@ -16,8 +16,6 @@
package net.fabricmc.fabric.test.entity.event.client; package net.fabricmc.fabric.test.entity.event.client;
import net.minecraft.entity.EquipmentSlot;
import net.fabricmc.api.ClientModInitializer; import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.client.rendering.v1.LivingEntityFeatureRenderEvents; import net.fabricmc.fabric.api.client.rendering.v1.LivingEntityFeatureRenderEvents;
import net.fabricmc.fabric.test.entity.event.EntityEventTests; import net.fabricmc.fabric.test.entity.event.EntityEventTests;
@ -25,8 +23,8 @@ import net.fabricmc.fabric.test.entity.event.EntityEventTests;
public class EntityEventTestsClient implements ClientModInitializer { public class EntityEventTestsClient implements ClientModInitializer {
@Override @Override
public void onInitializeClient() { public void onInitializeClient() {
LivingEntityFeatureRenderEvents.ALLOW_CAPE_RENDER.register(player -> { LivingEntityFeatureRenderEvents.ALLOW_CAPE_RENDER.register(state -> {
return !player.getEquippedStack(EquipmentSlot.CHEST).isOf(EntityEventTests.DIAMOND_ELYTRA); return !state.equippedChestStack.isOf(EntityEventTests.DIAMOND_ELYTRA);
}); });
} }
} }

View file

@ -35,14 +35,12 @@ import net.minecraft.client.network.SequencedPacketCreator;
import net.minecraft.client.world.ClientWorld; import net.minecraft.client.world.ClientWorld;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.network.packet.c2s.play.PlayerActionC2SPacket; import net.minecraft.network.packet.c2s.play.PlayerActionC2SPacket;
import net.minecraft.network.packet.c2s.play.PlayerInteractBlockC2SPacket; import net.minecraft.network.packet.c2s.play.PlayerInteractBlockC2SPacket;
import net.minecraft.network.packet.c2s.play.PlayerInteractEntityC2SPacket; import net.minecraft.network.packet.c2s.play.PlayerInteractEntityC2SPacket;
import net.minecraft.network.packet.c2s.play.PlayerInteractItemC2SPacket; import net.minecraft.network.packet.c2s.play.PlayerInteractItemC2SPacket;
import net.minecraft.util.ActionResult; import net.minecraft.util.ActionResult;
import net.minecraft.util.Hand; import net.minecraft.util.Hand;
import net.minecraft.util.TypedActionResult;
import net.minecraft.util.hit.BlockHitResult; import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction; import net.minecraft.util.math.Direction;
@ -121,15 +119,15 @@ public abstract class ClientPlayerInteractionManagerMixin {
public void interactItem(PlayerEntity player, Hand hand, CallbackInfoReturnable<ActionResult> info) { public void interactItem(PlayerEntity player, Hand hand, CallbackInfoReturnable<ActionResult> info) {
// hook interactBlock between the spectator check and sending the first packet to invoke the use item event first // hook interactBlock between the spectator check and sending the first packet to invoke the use item event first
// this needs to be in interactBlock to avoid sending a packet in line with the event javadoc // this needs to be in interactBlock to avoid sending a packet in line with the event javadoc
TypedActionResult<ItemStack> result = UseItemCallback.EVENT.invoker().interact(player, player.getWorld(), hand); ActionResult result = UseItemCallback.EVENT.invoker().interact(player, player.getWorld(), hand);
if (result.getResult() != ActionResult.PASS) { if (result != ActionResult.PASS) {
if (result.getResult() == ActionResult.SUCCESS) { if (result == ActionResult.SUCCESS) {
// send interaction packet to the server with a new sequentially assigned id // send interaction packet to the server with a new sequentially assigned id
sendSequencedPacket((ClientWorld) player.getWorld(), id -> new PlayerInteractItemC2SPacket(hand, id, player.getYaw(), player.getPitch())); sendSequencedPacket((ClientWorld) player.getWorld(), id -> new PlayerInteractItemC2SPacket(hand, id, player.getYaw(), player.getPitch()));
} }
info.setReturnValue(result.getResult()); info.setReturnValue(result);
} }
} }

View file

@ -171,8 +171,10 @@ public abstract class MinecraftClientMixin {
getNetworkHandler().sendPacket(PlayerInteractEntityC2SPacket.interactAt(entity, player.isSneaking(), hand, hitVec)); getNetworkHandler().sendPacket(PlayerInteractEntityC2SPacket.interactAt(entity, player.isSneaking(), hand, hitVec));
} }
if (result.shouldSwingHand()) { if (result instanceof ActionResult.Success success) {
player.swingHand(hand); if (success.swingSource() == ActionResult.SwingSource.CLIENT) {
player.swingHand(hand);
}
} }
ci.cancel(); ci.cancel();

View file

@ -1,7 +1,7 @@
{ {
"required": true, "required": true,
"package": "net.fabricmc.fabric.mixin.event.interaction.client", "package": "net.fabricmc.fabric.mixin.event.interaction.client",
"compatibilityLevel": "JAVA_17", "compatibilityLevel": "JAVA_21",
"client": [ "client": [
"ClientPlayerInteractionManagerMixin", "ClientPlayerInteractionManagerMixin",
"KeyBindingAccessor", "KeyBindingAccessor",

View file

@ -17,10 +17,8 @@
package net.fabricmc.fabric.api.event.player; package net.fabricmc.fabric.api.event.player;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ActionResult; import net.minecraft.util.ActionResult;
import net.minecraft.util.Hand; import net.minecraft.util.Hand;
import net.minecraft.util.TypedActionResult;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.fabricmc.fabric.api.event.Event; import net.fabricmc.fabric.api.event.Event;
@ -39,16 +37,16 @@ public interface UseItemCallback {
Event<UseItemCallback> EVENT = EventFactory.createArrayBacked(UseItemCallback.class, Event<UseItemCallback> EVENT = EventFactory.createArrayBacked(UseItemCallback.class,
listeners -> (player, world, hand) -> { listeners -> (player, world, hand) -> {
for (UseItemCallback event : listeners) { for (UseItemCallback event : listeners) {
TypedActionResult<ItemStack> result = event.interact(player, world, hand); ActionResult result = event.interact(player, world, hand);
if (result.getResult() != ActionResult.PASS) { if (result != ActionResult.PASS) {
return result; return result;
} }
} }
return TypedActionResult.pass(ItemStack.EMPTY); return ActionResult.PASS;
} }
); );
TypedActionResult<ItemStack> interact(PlayerEntity player, World world, Hand hand); ActionResult interact(PlayerEntity player, World world, Hand hand);
} }

View file

@ -38,7 +38,6 @@ import net.minecraft.server.network.ServerPlayerInteractionManager;
import net.minecraft.server.world.ServerWorld; import net.minecraft.server.world.ServerWorld;
import net.minecraft.util.ActionResult; import net.minecraft.util.ActionResult;
import net.minecraft.util.Hand; import net.minecraft.util.Hand;
import net.minecraft.util.TypedActionResult;
import net.minecraft.util.hit.BlockHitResult; import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction; import net.minecraft.util.math.Direction;
@ -95,10 +94,10 @@ public class ServerPlayerInteractionManagerMixin {
@Inject(at = @At("HEAD"), method = "interactItem", cancellable = true) @Inject(at = @At("HEAD"), method = "interactItem", cancellable = true)
public void interactItem(ServerPlayerEntity player, World world, ItemStack stack, Hand hand, CallbackInfoReturnable<ActionResult> info) { public void interactItem(ServerPlayerEntity player, World world, ItemStack stack, Hand hand, CallbackInfoReturnable<ActionResult> info) {
TypedActionResult<ItemStack> result = UseItemCallback.EVENT.invoker().interact(player, world, hand); ActionResult result = UseItemCallback.EVENT.invoker().interact(player, world, hand);
if (result.getResult() != ActionResult.PASS) { if (result != ActionResult.PASS) {
info.setReturnValue(result.getResult()); info.setReturnValue(result);
info.cancel(); info.cancel();
return; return;
} }

View file

@ -1,7 +1,7 @@
{ {
"required": true, "required": true,
"package": "net.fabricmc.fabric.mixin.event.interaction", "package": "net.fabricmc.fabric.mixin.event.interaction",
"compatibilityLevel": "JAVA_17", "compatibilityLevel": "JAVA_21",
"mixins": [ "mixins": [
"PlayerAdvancementTrackerMixin", "PlayerAdvancementTrackerMixin",
"ServerPlayerEntityMixin", "ServerPlayerEntityMixin",

View file

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

Some files were not shown because too many files have changed in this diff Show more