From 57632285faf5fd0b3adb0c295232ad4fea4a5449 Mon Sep 17 00:00:00 2001 From: haykam821 <24855774+haykam821@users.noreply.github.com> Date: Tue, 8 Oct 2024 13:00:08 -0400 Subject: [PATCH] Update mod to Minecraft 1.21.2 pre-release 1 (#4148) * Update mod to Minecraft 1.21.2 pre-release 1 * Bump version --------- Co-authored-by: modmuss50 --- .../datagen/generators/BiomeTagGenerator.java | 10 +- ...abric-data-generation-api-v1.accesswidener | 8 +- .../mixin/item/CraftingRecipeMixin.java | 4 +- .../test/item/gametest/RecipeGameTest.java | 4 +- .../sync/client/ClientRegistriesMixin.java | 2 +- .../registry/sync/FabricRegistryInit.java | 4 + .../api/renderer/v1/render/RenderContext.java | 2 +- .../render/AbstractBlockRenderContext.java | 2 +- .../renderer/render/ItemRenderContext.java | 2 +- .../indigo/renderer/ItemRendererMixin.java | 4 +- .../v1/BuiltinItemRendererRegistry.java | 2 +- .../BuiltinModelItemRendererMixin.java | 2 +- .../conditions/ConditionalResourcesTest.java | 4 +- .../loader/ResourceManagerHelperImpl.java | 2 +- .../KeyedResourceReloadListenerMixin.java | 6 +- ...xin.java => ServerRecipeManagerMixin.java} | 6 +- .../fabric-resource-loader-v0.mixins.json | 2 +- .../fabric/mixin/screen/KeyboardMixin.java | 66 +++++---- .../mixin/screen/MinecraftClientMixin.java | 8 +- .../fabric/mixin/screen/MouseMixin.java | 138 ++++++------------ ...ransitive-access-wideners-v1.accesswidener | 1 + gradle.properties | 48 +++--- 22 files changed, 147 insertions(+), 180 deletions(-) rename fabric-resource-loader-v0/src/main/java/net/fabricmc/fabric/mixin/resource/loader/{RecipeManagerMixin.java => ServerRecipeManagerMixin.java} (90%) diff --git a/fabric-convention-tags-v2/src/datagen/java/net/fabricmc/fabric/impl/tag/convention/datagen/generators/BiomeTagGenerator.java b/fabric-convention-tags-v2/src/datagen/java/net/fabricmc/fabric/impl/tag/convention/datagen/generators/BiomeTagGenerator.java index 83162805a4..710d95f07b 100644 --- a/fabric-convention-tags-v2/src/datagen/java/net/fabricmc/fabric/impl/tag/convention/datagen/generators/BiomeTagGenerator.java +++ b/fabric-convention-tags-v2/src/datagen/java/net/fabricmc/fabric/impl/tag/convention/datagen/generators/BiomeTagGenerator.java @@ -18,13 +18,13 @@ import java.util.concurrent.CompletableFuture; -import net.minecraft.class_10351; import net.minecraft.registry.RegistryKeys; import net.minecraft.registry.RegistryWrapper; import net.minecraft.registry.tag.BiomeTags; import net.minecraft.util.Identifier; import net.minecraft.world.biome.Biome; import net.minecraft.world.biome.BiomeKeys; +import net.minecraft.world.biome.WinterDropBuiltinBiomes; import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput; import net.fabricmc.fabric.api.datagen.v1.provider.FabricTagProvider; @@ -97,7 +97,7 @@ private void generateCategoryTags() { .add(BiomeKeys.OLD_GROWTH_BIRCH_FOREST); getOrCreateTagBuilder(ConventionalBiomeTags.IS_DARK_FOREST) .add(BiomeKeys.DARK_FOREST) - .addOptional(class_10351.PALE_GARDEN); + .addOptional(WinterDropBuiltinBiomes.PALE_GARDEN); getOrCreateTagBuilder(ConventionalBiomeTags.IS_OCEAN) .addOptionalTag(BiomeTags.IS_OCEAN) .addOptionalTag(ConventionalBiomeTags.IS_DEEP_OCEAN) @@ -179,7 +179,7 @@ private void generateClimateAndVegetationTags() { .add(BiomeKeys.SWAMP) .add(BiomeKeys.STONY_SHORE) .add(BiomeKeys.DARK_FOREST) - .addOptional(class_10351.PALE_GARDEN) + .addOptional(WinterDropBuiltinBiomes.PALE_GARDEN) .add(BiomeKeys.WINDSWEPT_FOREST) .add(BiomeKeys.BIRCH_FOREST) .add(BiomeKeys.OLD_GROWTH_BIRCH_FOREST) @@ -252,7 +252,7 @@ private void generateClimateAndVegetationTags() { getOrCreateTagBuilder(ConventionalBiomeTags.IS_VEGETATION_DENSE_OVERWORLD) .add(BiomeKeys.DARK_FOREST) - .addOptional(class_10351.PALE_GARDEN) + .addOptional(WinterDropBuiltinBiomes.PALE_GARDEN) .add(BiomeKeys.OLD_GROWTH_BIRCH_FOREST) .add(BiomeKeys.OLD_GROWTH_SPRUCE_TAIGA) .add(BiomeKeys.JUNGLE) @@ -285,7 +285,7 @@ private void generateClimateAndVegetationTags() { .add(BiomeKeys.FLOWER_FOREST) .add(BiomeKeys.BIRCH_FOREST) .add(BiomeKeys.DARK_FOREST) - .addOptional(class_10351.PALE_GARDEN) + .addOptional(WinterDropBuiltinBiomes.PALE_GARDEN) .add(BiomeKeys.OLD_GROWTH_BIRCH_FOREST); getOrCreateTagBuilder(ConventionalBiomeTags.IS_JUNGLE_TREE) .addOptionalTag(ConventionalBiomeTags.IS_JUNGLE); diff --git a/fabric-data-generation-api-v1/src/main/resources/fabric-data-generation-api-v1.accesswidener b/fabric-data-generation-api-v1/src/main/resources/fabric-data-generation-api-v1.accesswidener index 5d76d59e1f..8e0567d92f 100644 --- a/fabric-data-generation-api-v1/src/main/resources/fabric-data-generation-api-v1.accesswidener +++ b/fabric-data-generation-api-v1/src/main/resources/fabric-data-generation-api-v1.accesswidener @@ -178,7 +178,7 @@ transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator registerNorthDefaultHorizontalRotated (Lnet/minecraft/block/Block;Lnet/minecraft/data/client/TexturedModel$Factory;)V transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator createAxisRotatedBlockState (Lnet/minecraft/block/Block;Lnet/minecraft/util/Identifier;Lnet/minecraft/util/Identifier;)Lnet/minecraft/data/client/BlockStateSupplier; transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator registerAxisRotated (Lnet/minecraft/block/Block;Lnet/minecraft/data/client/TexturedModel$Factory;Lnet/minecraft/data/client/TexturedModel$Factory;)V -transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator method_64949 (Lnet/minecraft/block/Block;)V +transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator registerCreakingHeart (Lnet/minecraft/block/Block;)V transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator createSubModel (Lnet/minecraft/block/Block;Ljava/lang/String;Lnet/minecraft/data/client/Model;Ljava/util/function/Function;)Lnet/minecraft/util/Identifier; transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator createPressurePlateBlockState (Lnet/minecraft/block/Block;Lnet/minecraft/util/Identifier;Lnet/minecraft/util/Identifier;)Lnet/minecraft/data/client/BlockStateSupplier; transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator createSlabBlockState (Lnet/minecraft/block/Block;Lnet/minecraft/util/Identifier;Lnet/minecraft/util/Identifier;Lnet/minecraft/util/Identifier;)Lnet/minecraft/data/client/BlockStateSupplier; @@ -250,8 +250,8 @@ transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator getTurtleEggModel (ILjava/lang/String;Lnet/minecraft/data/client/TextureMap;)Lnet/minecraft/util/Identifier; transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator getTurtleEggModel (Ljava/lang/Integer;Ljava/lang/Integer;)Lnet/minecraft/util/Identifier; transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator registerWallPlant (Lnet/minecraft/block/Block;)V -transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator method_64940 (Lnet/minecraft/block/Block;)V -transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator method_64941 (Lnet/minecraft/block/Block;)V +transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator registerPaleMossCarpet (Lnet/minecraft/block/Block;)V +transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator registerHangingMoss (Lnet/minecraft/block/Block;)V transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator supplyChiseledBookshelfModels (Lnet/minecraft/data/client/MultipartBlockStateSupplier;Lnet/minecraft/data/client/When$PropertyCondition;Lnet/minecraft/data/client/VariantSettings$Rotation;)V transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator supplyChiseledBookshelfModel (Lnet/minecraft/data/client/MultipartBlockStateSupplier;Lnet/minecraft/data/client/When$PropertyCondition;Lnet/minecraft/data/client/VariantSettings$Rotation;Lnet/minecraft/state/property/BooleanProperty;Lnet/minecraft/data/client/Model;Z)V transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator registerShulkerBox (Lnet/minecraft/block/Block;)V @@ -292,7 +292,7 @@ transitive-accessible method net/minecraft/data/server/loottable/BlockLootTableG transitive-accessible method net/minecraft/data/server/loottable/BlockLootTableGenerator shortPlantDrops (Lnet/minecraft/block/Block;)Lnet/minecraft/loot/LootTable$Builder; transitive-accessible method net/minecraft/data/server/loottable/BlockLootTableGenerator dropsWithShears (Lnet/minecraft/item/ItemConvertible;)Lnet/minecraft/loot/LootTable$Builder; transitive-accessible method net/minecraft/data/server/loottable/BlockLootTableGenerator multifaceGrowthDrops (Lnet/minecraft/block/Block;Lnet/minecraft/loot/condition/LootCondition$Builder;)Lnet/minecraft/loot/LootTable$Builder; -transitive-accessible method net/minecraft/data/server/loottable/BlockLootTableGenerator method_64930 (Lnet/minecraft/block/Block;)Lnet/minecraft/loot/LootTable$Builder; +transitive-accessible method net/minecraft/data/server/loottable/BlockLootTableGenerator paleMossCarpetDrops (Lnet/minecraft/block/Block;)Lnet/minecraft/loot/LootTable$Builder; transitive-accessible method net/minecraft/data/server/loottable/BlockLootTableGenerator leavesDrops (Lnet/minecraft/block/Block;Lnet/minecraft/block/Block;[F)Lnet/minecraft/loot/LootTable$Builder; transitive-accessible method net/minecraft/data/server/loottable/BlockLootTableGenerator oakLeavesDrops (Lnet/minecraft/block/Block;Lnet/minecraft/block/Block;[F)Lnet/minecraft/loot/LootTable$Builder; transitive-accessible method net/minecraft/data/server/loottable/BlockLootTableGenerator mangroveLeavesDrops (Lnet/minecraft/block/Block;)Lnet/minecraft/loot/LootTable$Builder; diff --git a/fabric-item-api-v1/src/main/java/net/fabricmc/fabric/mixin/item/CraftingRecipeMixin.java b/fabric-item-api-v1/src/main/java/net/fabricmc/fabric/mixin/item/CraftingRecipeMixin.java index fa6674aad3..56c93b3616 100644 --- a/fabric-item-api-v1/src/main/java/net/fabricmc/fabric/mixin/item/CraftingRecipeMixin.java +++ b/fabric-item-api-v1/src/main/java/net/fabricmc/fabric/mixin/item/CraftingRecipeMixin.java @@ -30,13 +30,13 @@ @Mixin(CraftingRecipe.class) public interface CraftingRecipeMixin { - @WrapOperation(method = "method_64671", at = @At(value = "INVOKE", target = "Lnet/minecraft/item/ItemStack;getItem()Lnet/minecraft/item/Item;")) + @WrapOperation(method = "collectRecipeRemainders", at = @At(value = "INVOKE", target = "Lnet/minecraft/item/ItemStack;getItem()Lnet/minecraft/item/Item;")) private static Item captureStack(ItemStack stack, Operation operation) { RecipeRemainderHandler.REMAINDER_STACK.set(stack.getRecipeRemainder()); return operation.call(stack); } - @Redirect(method = "method_64671", at = @At(value = "INVOKE", target = "Lnet/minecraft/item/Item;getRecipeRemainder()Lnet/minecraft/item/ItemStack;")) + @Redirect(method = "collectRecipeRemainders", at = @At(value = "INVOKE", target = "Lnet/minecraft/item/Item;getRecipeRemainder()Lnet/minecraft/item/ItemStack;")) private static ItemStack getStackRemainder(Item item) { ItemStack remainder = RecipeRemainderHandler.REMAINDER_STACK.get(); RecipeRemainderHandler.REMAINDER_STACK.remove(); diff --git a/fabric-item-api-v1/src/testmod/java/net/fabricmc/fabric/test/item/gametest/RecipeGameTest.java b/fabric-item-api-v1/src/testmod/java/net/fabricmc/fabric/test/item/gametest/RecipeGameTest.java index a37a73e4d5..91639e2eb7 100644 --- a/fabric-item-api-v1/src/testmod/java/net/fabricmc/fabric/test/item/gametest/RecipeGameTest.java +++ b/fabric-item-api-v1/src/testmod/java/net/fabricmc/fabric/test/item/gametest/RecipeGameTest.java @@ -37,7 +37,7 @@ public void vanillaRemainderTest(TestContext context) { new ItemStack(Items.WATER_BUCKET), new ItemStack(Items.DIAMOND))); - DefaultedList remainderList = CraftingRecipe.method_64671(inventory); + DefaultedList remainderList = CraftingRecipe.collectRecipeRemainders(inventory); assertStackList(remainderList, "Testing vanilla recipe remainder.", new ItemStack(Items.BUCKET), @@ -54,7 +54,7 @@ public void fabricRemainderTest(TestContext context) { withDamage(new ItemStack(CustomDamageTest.WEIRD_PICK), 31), new ItemStack(Items.DIAMOND))); - DefaultedList remainderList = CraftingRecipe.method_64671(inventory); + DefaultedList remainderList = CraftingRecipe.collectRecipeRemainders(inventory); assertStackList(remainderList, "Testing fabric recipe remainder.", withDamage(new ItemStack(CustomDamageTest.WEIRD_PICK), 1), diff --git a/fabric-registry-sync-v0/src/client/java/net/fabricmc/fabric/mixin/registry/sync/client/ClientRegistriesMixin.java b/fabric-registry-sync-v0/src/client/java/net/fabricmc/fabric/mixin/registry/sync/client/ClientRegistriesMixin.java index 414e15b5ee..e312bddb9e 100644 --- a/fabric-registry-sync-v0/src/client/java/net/fabricmc/fabric/mixin/registry/sync/client/ClientRegistriesMixin.java +++ b/fabric-registry-sync-v0/src/client/java/net/fabricmc/fabric/mixin/registry/sync/client/ClientRegistriesMixin.java @@ -41,7 +41,7 @@ public class ClientRegistriesMixin { /** * Keep the pre-24w04a behavior of removing empty registries, even if the client knows that registry. */ - @WrapOperation(method = "method_62155", at = @At(value = "FIELD", target = "Lnet/minecraft/registry/RegistryLoader;SYNCED_REGISTRIES:Ljava/util/List;", opcode = Opcodes.GETSTATIC)) + @WrapOperation(method = "createRegistryManager", at = @At(value = "FIELD", target = "Lnet/minecraft/registry/RegistryLoader;SYNCED_REGISTRIES:Ljava/util/List;", opcode = Opcodes.GETSTATIC)) private List> skipEmptyRegistries(Operation>> operation, ResourceFactory resourceFactory, @Coerce ClientRegistriesDynamicRegistriesAccessor storage, boolean bl) { Map>, List> dynamicRegistries = storage.getDynamicRegistries(); diff --git a/fabric-registry-sync-v0/src/main/java/net/fabricmc/fabric/impl/registry/sync/FabricRegistryInit.java b/fabric-registry-sync-v0/src/main/java/net/fabricmc/fabric/impl/registry/sync/FabricRegistryInit.java index 249b8cc87d..e1d4cb99e0 100644 --- a/fabric-registry-sync-v0/src/main/java/net/fabricmc/fabric/impl/registry/sync/FabricRegistryInit.java +++ b/fabric-registry-sync-v0/src/main/java/net/fabricmc/fabric/impl/registry/sync/FabricRegistryInit.java @@ -215,5 +215,9 @@ public void onInitialize() { // Synced via PacketCodecs.registryValue RegistryAttributeHolder.get(Registries.SLOT_DISPLAY) .addAttribute(RegistryAttribute.SYNCED); + + // Synced via PacketCodecs.registryValue + RegistryAttributeHolder.get(Registries.field_54927) + .addAttribute(RegistryAttribute.SYNCED); } } diff --git a/fabric-renderer-api-v1/src/client/java/net/fabricmc/fabric/api/renderer/v1/render/RenderContext.java b/fabric-renderer-api-v1/src/client/java/net/fabricmc/fabric/api/renderer/v1/render/RenderContext.java index 2aaf318ec7..c4b717936a 100644 --- a/fabric-renderer-api-v1/src/client/java/net/fabricmc/fabric/api/renderer/v1/render/RenderContext.java +++ b/fabric-renderer-api-v1/src/client/java/net/fabricmc/fabric/api/renderer/v1/render/RenderContext.java @@ -20,7 +20,7 @@ import org.jetbrains.annotations.Nullable; -import net.minecraft.client.render.model.json.ModelTransformationMode; +import net.minecraft.item.ModelTransformationMode; import net.minecraft.util.math.Direction; import net.fabricmc.fabric.api.renderer.v1.mesh.Mesh; diff --git a/fabric-renderer-indigo/src/client/java/net/fabricmc/fabric/impl/client/indigo/renderer/render/AbstractBlockRenderContext.java b/fabric-renderer-indigo/src/client/java/net/fabricmc/fabric/impl/client/indigo/renderer/render/AbstractBlockRenderContext.java index a713ea5802..2c7f828c0d 100644 --- a/fabric-renderer-indigo/src/client/java/net/fabricmc/fabric/impl/client/indigo/renderer/render/AbstractBlockRenderContext.java +++ b/fabric-renderer-indigo/src/client/java/net/fabricmc/fabric/impl/client/indigo/renderer/render/AbstractBlockRenderContext.java @@ -27,7 +27,7 @@ import net.minecraft.client.render.RenderLayer; import net.minecraft.client.render.VertexConsumer; import net.minecraft.client.render.WorldRenderer; -import net.minecraft.client.render.model.json.ModelTransformationMode; +import net.minecraft.item.ModelTransformationMode; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; diff --git a/fabric-renderer-indigo/src/client/java/net/fabricmc/fabric/impl/client/indigo/renderer/render/ItemRenderContext.java b/fabric-renderer-indigo/src/client/java/net/fabricmc/fabric/impl/client/indigo/renderer/render/ItemRenderContext.java index aff59c13dd..2bbcd4b1da 100644 --- a/fabric-renderer-indigo/src/client/java/net/fabricmc/fabric/impl/client/indigo/renderer/render/ItemRenderContext.java +++ b/fabric-renderer-indigo/src/client/java/net/fabricmc/fabric/impl/client/indigo/renderer/render/ItemRenderContext.java @@ -29,9 +29,9 @@ import net.minecraft.client.render.VertexConsumerProvider; import net.minecraft.client.render.item.ItemRenderer; import net.minecraft.client.render.model.BakedModel; -import net.minecraft.client.render.model.json.ModelTransformationMode; import net.minecraft.client.util.math.MatrixStack; import net.minecraft.item.ItemStack; +import net.minecraft.item.ModelTransformationMode; import net.minecraft.util.math.Direction; import net.minecraft.util.math.MatrixUtil; import net.minecraft.util.math.random.Random; diff --git a/fabric-renderer-indigo/src/client/java/net/fabricmc/fabric/mixin/client/indigo/renderer/ItemRendererMixin.java b/fabric-renderer-indigo/src/client/java/net/fabricmc/fabric/mixin/client/indigo/renderer/ItemRendererMixin.java index 07283e3bb1..1f2d507f87 100644 --- a/fabric-renderer-indigo/src/client/java/net/fabricmc/fabric/mixin/client/indigo/renderer/ItemRendererMixin.java +++ b/fabric-renderer-indigo/src/client/java/net/fabricmc/fabric/mixin/client/indigo/renderer/ItemRendererMixin.java @@ -28,9 +28,9 @@ import net.minecraft.client.render.VertexConsumerProvider; import net.minecraft.client.render.item.ItemRenderer; import net.minecraft.client.render.model.BakedModel; -import net.minecraft.client.render.model.json.ModelTransformationMode; import net.minecraft.client.util.math.MatrixStack; import net.minecraft.item.ItemStack; +import net.minecraft.item.ModelTransformationMode; import net.fabricmc.fabric.impl.client.indigo.renderer.render.ItemRenderContext; @@ -43,7 +43,7 @@ public abstract class ItemRendererMixin { @Unique private final ThreadLocal fabric_contexts = ThreadLocal.withInitial(() -> new ItemRenderContext(colors)); - @Inject(method = "renderItem(Lnet/minecraft/item/ItemStack;Lnet/minecraft/client/render/model/json/ModelTransformationMode;Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;IILnet/minecraft/client/render/model/BakedModel;Z)V", at = @At(value = "HEAD"), cancellable = true) + @Inject(method = "renderItem(Lnet/minecraft/item/ItemStack;Lnet/minecraft/item/ModelTransformationMode;Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;IILnet/minecraft/client/render/model/BakedModel;Z)V", at = @At(value = "HEAD"), cancellable = true) public void hook_renderItem(ItemStack stack, ModelTransformationMode transformMode, MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int light, int overlay, BakedModel model, boolean notInHand, CallbackInfo ci) { if (!model.isVanillaAdapter()) { fabric_contexts.get().renderModel(stack, transformMode, matrixStack, vertexConsumerProvider, light, overlay, model); diff --git a/fabric-rendering-v1/src/client/java/net/fabricmc/fabric/api/client/rendering/v1/BuiltinItemRendererRegistry.java b/fabric-rendering-v1/src/client/java/net/fabricmc/fabric/api/client/rendering/v1/BuiltinItemRendererRegistry.java index 2c0b7be77e..be3f1d90fe 100644 --- a/fabric-rendering-v1/src/client/java/net/fabricmc/fabric/api/client/rendering/v1/BuiltinItemRendererRegistry.java +++ b/fabric-rendering-v1/src/client/java/net/fabricmc/fabric/api/client/rendering/v1/BuiltinItemRendererRegistry.java @@ -19,11 +19,11 @@ import org.jetbrains.annotations.Nullable; import net.minecraft.client.render.VertexConsumerProvider; -import net.minecraft.client.render.model.json.ModelTransformationMode; import net.minecraft.client.util.math.MatrixStack; import net.minecraft.item.Item; import net.minecraft.item.ItemConvertible; import net.minecraft.item.ItemStack; +import net.minecraft.item.ModelTransformationMode; import net.fabricmc.fabric.impl.client.rendering.BuiltinItemRendererRegistryImpl; diff --git a/fabric-rendering-v1/src/client/java/net/fabricmc/fabric/mixin/client/rendering/BuiltinModelItemRendererMixin.java b/fabric-rendering-v1/src/client/java/net/fabricmc/fabric/mixin/client/rendering/BuiltinModelItemRendererMixin.java index f656133f2a..7acb0cd172 100644 --- a/fabric-rendering-v1/src/client/java/net/fabricmc/fabric/mixin/client/rendering/BuiltinModelItemRendererMixin.java +++ b/fabric-rendering-v1/src/client/java/net/fabricmc/fabric/mixin/client/rendering/BuiltinModelItemRendererMixin.java @@ -24,9 +24,9 @@ import net.minecraft.client.render.VertexConsumerProvider; import net.minecraft.client.render.item.BuiltinModelItemRenderer; -import net.minecraft.client.render.model.json.ModelTransformationMode; import net.minecraft.client.util.math.MatrixStack; import net.minecraft.item.ItemStack; +import net.minecraft.item.ModelTransformationMode; import net.fabricmc.fabric.api.client.rendering.v1.BuiltinItemRendererRegistry; diff --git a/fabric-resource-conditions-api-v1/src/testmod/java/net/fabricmc/fabric/test/resource/conditions/ConditionalResourcesTest.java b/fabric-resource-conditions-api-v1/src/testmod/java/net/fabricmc/fabric/test/resource/conditions/ConditionalResourcesTest.java index 1f90a727b3..b6f6d9abcf 100644 --- a/fabric-resource-conditions-api-v1/src/testmod/java/net/fabricmc/fabric/test/resource/conditions/ConditionalResourcesTest.java +++ b/fabric-resource-conditions-api-v1/src/testmod/java/net/fabricmc/fabric/test/resource/conditions/ConditionalResourcesTest.java @@ -18,7 +18,7 @@ import net.minecraft.block.entity.BannerPattern; import net.minecraft.loot.LootTable; -import net.minecraft.recipe.RecipeManager; +import net.minecraft.recipe.ServerRecipeManager; import net.minecraft.registry.Registry; import net.minecraft.registry.RegistryEntryLookup; import net.minecraft.registry.RegistryKey; @@ -39,7 +39,7 @@ private static Identifier id(String path) { @GameTest(templateName = FabricGameTest.EMPTY_STRUCTURE) public void conditionalRecipes(TestContext context) { - RecipeManager manager = context.getWorld().getRecipeManager(); + ServerRecipeManager manager = context.getWorld().getRecipeManager(); if (manager.get(RegistryKey.of(RegistryKeys.RECIPE, id("not_loaded"))).isPresent()) { throw new AssertionError("not_loaded recipe should not have been loaded."); diff --git a/fabric-resource-loader-v0/src/main/java/net/fabricmc/fabric/impl/resource/loader/ResourceManagerHelperImpl.java b/fabric-resource-loader-v0/src/main/java/net/fabricmc/fabric/impl/resource/loader/ResourceManagerHelperImpl.java index 7516657dce..22ad6f5bcb 100644 --- a/fabric-resource-loader-v0/src/main/java/net/fabricmc/fabric/impl/resource/loader/ResourceManagerHelperImpl.java +++ b/fabric-resource-loader-v0/src/main/java/net/fabricmc/fabric/impl/resource/loader/ResourceManagerHelperImpl.java @@ -245,7 +245,7 @@ private RegistryWrapper.WrapperLookup getWrapperLookup(List li } } - throw new IllegalStateException("No RecipeManager found in listeners!"); + throw new IllegalStateException("No ServerRecipeManager found in listeners!"); } @Override diff --git a/fabric-resource-loader-v0/src/main/java/net/fabricmc/fabric/mixin/resource/loader/KeyedResourceReloadListenerMixin.java b/fabric-resource-loader-v0/src/main/java/net/fabricmc/fabric/mixin/resource/loader/KeyedResourceReloadListenerMixin.java index c3044b2442..f32b8726b5 100644 --- a/fabric-resource-loader-v0/src/main/java/net/fabricmc/fabric/mixin/resource/loader/KeyedResourceReloadListenerMixin.java +++ b/fabric-resource-loader-v0/src/main/java/net/fabricmc/fabric/mixin/resource/loader/KeyedResourceReloadListenerMixin.java @@ -22,7 +22,7 @@ import org.spongepowered.asm.mixin.Mixin; -import net.minecraft.recipe.RecipeManager; +import net.minecraft.recipe.ServerRecipeManager; import net.minecraft.server.ServerAdvancementLoader; import net.minecraft.server.function.FunctionLoader; import net.minecraft.util.Identifier; @@ -32,7 +32,7 @@ @Mixin({ /* public */ - RecipeManager.class, ServerAdvancementLoader.class, FunctionLoader.class + ServerRecipeManager.class, ServerAdvancementLoader.class, FunctionLoader.class /* private */ }) public abstract class KeyedResourceReloadListenerMixin implements IdentifiableResourceReloadListener { @@ -45,7 +45,7 @@ public Identifier getFabricId() { if (this.fabric$id == null) { Object self = this; - if (self instanceof RecipeManager) { + if (self instanceof ServerRecipeManager) { this.fabric$id = ResourceReloadListenerKeys.RECIPES; } else if (self instanceof ServerAdvancementLoader) { this.fabric$id = ResourceReloadListenerKeys.ADVANCEMENTS; diff --git a/fabric-resource-loader-v0/src/main/java/net/fabricmc/fabric/mixin/resource/loader/RecipeManagerMixin.java b/fabric-resource-loader-v0/src/main/java/net/fabricmc/fabric/mixin/resource/loader/ServerRecipeManagerMixin.java similarity index 90% rename from fabric-resource-loader-v0/src/main/java/net/fabricmc/fabric/mixin/resource/loader/RecipeManagerMixin.java rename to fabric-resource-loader-v0/src/main/java/net/fabricmc/fabric/mixin/resource/loader/ServerRecipeManagerMixin.java index f27c6b0fd5..7c175a2fad 100644 --- a/fabric-resource-loader-v0/src/main/java/net/fabricmc/fabric/mixin/resource/loader/RecipeManagerMixin.java +++ b/fabric-resource-loader-v0/src/main/java/net/fabricmc/fabric/mixin/resource/loader/ServerRecipeManagerMixin.java @@ -24,13 +24,13 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import net.minecraft.recipe.RecipeManager; +import net.minecraft.recipe.ServerRecipeManager; import net.minecraft.registry.RegistryWrapper; import net.fabricmc.fabric.impl.resource.loader.FabricRecipeManager; -@Mixin(RecipeManager.class) -public class RecipeManagerMixin implements FabricRecipeManager { +@Mixin(ServerRecipeManager.class) +public class ServerRecipeManagerMixin implements FabricRecipeManager { @Unique private RegistryWrapper.WrapperLookup registries; diff --git a/fabric-resource-loader-v0/src/main/resources/fabric-resource-loader-v0.mixins.json b/fabric-resource-loader-v0/src/main/resources/fabric-resource-loader-v0.mixins.json index 342411bc47..bbf3bcb1ac 100644 --- a/fabric-resource-loader-v0/src/main/resources/fabric-resource-loader-v0.mixins.json +++ b/fabric-resource-loader-v0/src/main/resources/fabric-resource-loader-v0.mixins.json @@ -10,10 +10,10 @@ "ResourceMixin", "ResourcePackManagerMixin", "ResourcePackProfileMixin", - "RecipeManagerMixin", "SelectKnownPacksC2SPacketMixin", "ServerConfigurationNetworkHandlerMixin", "ServerPropertiesHandlerMixin", + "ServerRecipeManagerMixin", "SimpleResourceReloadMixin", "SynchronizeRegistriesTaskMixin", "TestServerMixin" diff --git a/fabric-screen-api-v1/src/client/java/net/fabricmc/fabric/mixin/screen/KeyboardMixin.java b/fabric-screen-api-v1/src/client/java/net/fabricmc/fabric/mixin/screen/KeyboardMixin.java index cb293bc0f2..05acc6fba0 100644 --- a/fabric-screen-api-v1/src/client/java/net/fabricmc/fabric/mixin/screen/KeyboardMixin.java +++ b/fabric-screen-api-v1/src/client/java/net/fabricmc/fabric/mixin/screen/KeyboardMixin.java @@ -16,10 +16,10 @@ package net.fabricmc.fabric.mixin.screen; +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 org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import net.minecraft.client.Keyboard; import net.minecraft.client.gui.screen.Screen; @@ -28,39 +28,49 @@ @Mixin(Keyboard.class) abstract class KeyboardMixin { - // private synthetic method_1454(ILnet/minecraft/client/gui/screen/Screen;[ZIII)V - @Inject(method = "method_1454(ILnet/minecraft/client/gui/screen/Screen;[ZIII)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/Screen;keyPressed(III)Z"), cancellable = true) - private static void beforeKeyPressedEvent(int code, Screen screen, boolean[] resultHack, int key, int scancode, int modifiers, CallbackInfo ci) { - if (!ScreenKeyboardEvents.allowKeyPress(screen).invoker().allowKeyPress(screen, key, scancode, modifiers)) { - resultHack[0] = true; // Set this press action as handled. - ci.cancel(); // Exit the lambda - return; + @WrapOperation(method = "onKey", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/Screen;keyPressed(III)Z")) + private boolean invokeKeyPressedEvents(Screen screen, int key, int scancode, int modifiers, Operation operation) { + // The screen passed to events is the same as the screen the handler method is called on, + // regardless of whether the screen changes within the handler or event invocations. + + if (screen != null) { + if (!ScreenKeyboardEvents.allowKeyPress(screen).invoker().allowKeyPress(screen, key, scancode, modifiers)) { + // Set this press action as handled + return true; + } + + ScreenKeyboardEvents.beforeKeyPress(screen).invoker().beforeKeyPress(screen, key, scancode, modifiers); } - ScreenKeyboardEvents.beforeKeyPress(screen).invoker().beforeKeyPress(screen, key, scancode, modifiers); - } + boolean result = operation.call(screen, key, scancode, modifiers); + + if (screen != null) { + ScreenKeyboardEvents.afterKeyPress(screen).invoker().afterKeyPress(screen, key, scancode, modifiers); + } - // private synthetic method_1454(ILnet/minecraft/client/gui/screen/Screen;[ZIII)V - @Inject(method = "method_1454(ILnet/minecraft/client/gui/screen/Screen;[ZIII)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/Screen;keyPressed(III)Z", shift = At.Shift.AFTER)) - private static void afterKeyPressedEvent(int code, Screen screen, boolean[] resultHack, int key, int scancode, int modifiers, CallbackInfo ci) { - ScreenKeyboardEvents.afterKeyPress(screen).invoker().afterKeyPress(screen, key, scancode, modifiers); + return result; } - // private synthetic method_1454(ILnet/minecraft/client/gui/screen/Screen;[ZIII)V - @Inject(method = "method_1454(ILnet/minecraft/client/gui/screen/Screen;[ZIII)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/Screen;keyReleased(III)Z"), cancellable = true) - private static void beforeKeyReleasedEvent(int code, Screen screen, boolean[] resultHack, int key, int scancode, int modifiers, CallbackInfo ci) { - if (!ScreenKeyboardEvents.allowKeyRelease(screen).invoker().allowKeyRelease(screen, key, scancode, modifiers)) { - resultHack[0] = true; // Set this press action as handled. - ci.cancel(); // Exit the lambda - return; + @WrapOperation(method = "onKey", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/Screen;keyReleased(III)Z")) + private boolean invokeKeyReleasedEvents(Screen screen, int key, int scancode, int modifiers, Operation operation) { + // The screen passed to events is the same as the screen the handler method is called on, + // regardless of whether the screen changes within the handler or event invocations. + + if (screen != null) { + if (!ScreenKeyboardEvents.allowKeyRelease(screen).invoker().allowKeyRelease(screen, key, scancode, modifiers)) { + // Set this release action as handled + return true; + } + + ScreenKeyboardEvents.beforeKeyRelease(screen).invoker().beforeKeyRelease(screen, key, scancode, modifiers); } - ScreenKeyboardEvents.beforeKeyRelease(screen).invoker().beforeKeyRelease(screen, key, scancode, modifiers); - } + boolean result = operation.call(screen, key, scancode, modifiers); + + if (screen != null) { + ScreenKeyboardEvents.afterKeyRelease(screen).invoker().afterKeyRelease(screen, key, scancode, modifiers); + } - // private synthetic method_1454(ILnet/minecraft/client/gui/screen/Screen;[ZIII)V - @Inject(method = "method_1454(ILnet/minecraft/client/gui/screen/Screen;[ZIII)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/Screen;keyReleased(III)Z", shift = At.Shift.AFTER)) - private static void afterKeyReleasedEvent(int code, Screen screen, boolean[] resultHack, int key, int scancode, int modifiers, CallbackInfo ci) { - ScreenKeyboardEvents.afterKeyRelease(screen).invoker().afterKeyRelease(screen, key, scancode, modifiers); + return result; } } diff --git a/fabric-screen-api-v1/src/client/java/net/fabricmc/fabric/mixin/screen/MinecraftClientMixin.java b/fabric-screen-api-v1/src/client/java/net/fabricmc/fabric/mixin/screen/MinecraftClientMixin.java index 30207a8358..4370746954 100644 --- a/fabric-screen-api-v1/src/client/java/net/fabricmc/fabric/mixin/screen/MinecraftClientMixin.java +++ b/fabric-screen-api-v1/src/client/java/net/fabricmc/fabric/mixin/screen/MinecraftClientMixin.java @@ -66,9 +66,8 @@ private void onScreenRemoveBecauseStopping(CallbackInfo ci) { ScreenEvents.remove(this.currentScreen).invoker().onRemove(this.currentScreen); } - // Synthetic method in `tick` - // These two injections should be caught by "Screen#wrapScreenError" if anything fails in an event and then rethrown in the crash report - @Inject(method = "method_1572", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/Screen;tick()V")) + // These two injections should be caught by the try-catch block if anything fails in an event and then rethrown in the crash report + @Inject(method = "tick", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/Screen;tick()V")) private void beforeScreenTick(CallbackInfo ci) { // Store the screen in a variable in case someone tries to change the screen during this before tick event. // If someone changes the screen, the after tick event will likely have class cast exceptions or an NPE. @@ -76,8 +75,7 @@ private void beforeScreenTick(CallbackInfo ci) { ScreenEvents.beforeTick(this.tickingScreen).invoker().beforeTick(this.tickingScreen); } - // Synthetic method in `tick` - @Inject(method = "method_1572", at = @At("TAIL")) + @Inject(method = "tick", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/Screen;tick()V", shift = At.Shift.AFTER)) private void afterScreenTick(CallbackInfo ci) { ScreenEvents.afterTick(this.tickingScreen).invoker().afterTick(this.tickingScreen); // Finally set the currently ticking screen to null diff --git a/fabric-screen-api-v1/src/client/java/net/fabricmc/fabric/mixin/screen/MouseMixin.java b/fabric-screen-api-v1/src/client/java/net/fabricmc/fabric/mixin/screen/MouseMixin.java index 086e438118..aee2ec987f 100644 --- a/fabric-screen-api-v1/src/client/java/net/fabricmc/fabric/mixin/screen/MouseMixin.java +++ b/fabric-screen-api-v1/src/client/java/net/fabricmc/fabric/mixin/screen/MouseMixin.java @@ -16,16 +16,11 @@ package net.fabricmc.fabric.mixin.screen; -import org.spongepowered.asm.mixin.Final; +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.Shadow; -import org.spongepowered.asm.mixin.Unique; import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import org.spongepowered.asm.mixin.injection.callback.LocalCapture; -import net.minecraft.client.MinecraftClient; import net.minecraft.client.Mouse; import net.minecraft.client.gui.screen.Screen; @@ -33,113 +28,72 @@ @Mixin(Mouse.class) abstract class MouseMixin { - @Shadow - @Final - private MinecraftClient client; - @Unique - private Screen currentScreen; - - // private synthetic method_1611([ZDDI)V - @Inject(method = "method_1611([ZLnet/minecraft/client/gui/screen/Screen;DDI)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/Screen;mouseClicked(DDI)Z"), cancellable = true) - private static void beforeMouseClickedEvent(boolean[] resultHack, Screen screen, double mouseX, double mouseY, int button, CallbackInfo ci) { - @SuppressWarnings("resource") - MouseMixin thisRef = (MouseMixin) (Object) MinecraftClient.getInstance().mouse; - // Store the screen in a variable in case someone tries to change the screen during this before event. - // If someone changes the screen, the after event will likely have class cast exceptions or throw a NPE. - thisRef.currentScreen = thisRef.client.currentScreen; - - if (thisRef.currentScreen == null) { - return; + @WrapOperation(method = "onMouseButton", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/Screen;mouseClicked(DDI)Z")) + private boolean invokeMouseClickedEvents(Screen screen, double mouseX, double mouseY, int button, Operation operation) { + // The screen passed to events is the same as the screen the handler method is called on, + // regardless of whether the screen changes within the handler or event invocations. + + if (screen != null) { + if (!ScreenMouseEvents.allowMouseClick(screen).invoker().allowMouseClick(screen, mouseX, mouseY, button)) { + // Set this press action as handled + return true; + } + + ScreenMouseEvents.beforeMouseClick(screen).invoker().beforeMouseClick(screen, mouseX, mouseY, button); } - if (!ScreenMouseEvents.allowMouseClick(thisRef.currentScreen).invoker().allowMouseClick(thisRef.currentScreen, mouseX, mouseY, button)) { - resultHack[0] = true; // Set this press action as handled. - thisRef.currentScreen = null; - ci.cancel(); // Exit the lambda - return; - } - - ScreenMouseEvents.beforeMouseClick(thisRef.currentScreen).invoker().beforeMouseClick(thisRef.currentScreen, mouseX, mouseY, button); - } + boolean result = operation.call(screen, mouseX, mouseY, button); - // private synthetic method_1611([ZDDI)V - @Inject(method = "method_1611([ZLnet/minecraft/client/gui/screen/Screen;DDI)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/Screen;mouseClicked(DDI)Z", shift = At.Shift.AFTER)) - private static void afterMouseClickedEvent(boolean[] resultHack, Screen screen, double mouseX, double mouseY, int button, CallbackInfo ci) { - @SuppressWarnings("resource") - MouseMixin thisRef = (MouseMixin) (Object) MinecraftClient.getInstance().mouse; - - if (thisRef.currentScreen == null) { - return; + if (screen != null) { + ScreenMouseEvents.afterMouseClick(screen).invoker().afterMouseClick(screen, mouseX, mouseY, button); } - ScreenMouseEvents.afterMouseClick(thisRef.currentScreen).invoker().afterMouseClick(thisRef.currentScreen, mouseX, mouseY, button); - thisRef.currentScreen = null; + return result; } - // private synthetic method_1605([ZDDI)V - @Inject(method = "method_1605([ZLnet/minecraft/client/gui/screen/Screen;DDI)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/Screen;mouseReleased(DDI)Z"), cancellable = true) - private static void beforeMouseReleasedEvent(boolean[] resultHack, Screen screen, double mouseX, double mouseY, int button, CallbackInfo ci) { - @SuppressWarnings("resource") - MouseMixin thisRef = (MouseMixin) (Object) MinecraftClient.getInstance().mouse; - - // Store the screen in a variable in case someone tries to change the screen during this before event. - // If someone changes the screen, the after event will likely have class cast exceptions or throw a NPE. - thisRef.currentScreen = thisRef.client.currentScreen; + @WrapOperation(method = "onMouseButton", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/Screen;mouseReleased(DDI)Z")) + private boolean invokeMousePressedEvents(Screen screen, double mouseX, double mouseY, int button, Operation operation) { + // The screen passed to events is the same as the screen the handler method is called on, + // regardless of whether the screen changes within the handler or event invocations. - if (thisRef.currentScreen == null) { - return; - } + if (screen != null) { + if (!ScreenMouseEvents.allowMouseRelease(screen).invoker().allowMouseRelease(screen, mouseX, mouseY, button)) { + // Set this release action as handled + return true; + } - if (!ScreenMouseEvents.allowMouseRelease(thisRef.currentScreen).invoker().allowMouseRelease(thisRef.currentScreen, mouseX, mouseY, button)) { - resultHack[0] = true; // Set this press action as handled. - thisRef.currentScreen = null; - ci.cancel(); // Exit the lambda - return; + ScreenMouseEvents.beforeMouseRelease(screen).invoker().beforeMouseRelease(screen, mouseX, mouseY, button); } - ScreenMouseEvents.beforeMouseRelease(thisRef.currentScreen).invoker().beforeMouseRelease(thisRef.currentScreen, mouseX, mouseY, button); - } - - // private synthetic method_1605([ZDDI)V - @Inject(method = "method_1605([ZLnet/minecraft/client/gui/screen/Screen;DDI)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/Screen;mouseReleased(DDI)Z", shift = At.Shift.AFTER)) - private static void afterMouseReleasedEvent(boolean[] resultHack, Screen screen, double mouseX, double mouseY, int button, CallbackInfo ci) { - @SuppressWarnings("resource") - MouseMixin thisRef = (MouseMixin) (Object) MinecraftClient.getInstance().mouse; + boolean result = operation.call(screen, mouseX, mouseY, button); - if (thisRef.currentScreen == null) { - return; + if (screen != null) { + ScreenMouseEvents.afterMouseRelease(screen).invoker().afterMouseRelease(screen, mouseX, mouseY, button); } - ScreenMouseEvents.afterMouseRelease(thisRef.currentScreen).invoker().afterMouseRelease(thisRef.currentScreen, mouseX, mouseY, button); - thisRef.currentScreen = null; + return result; } - @Inject(method = "onMouseScroll", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/Screen;mouseScrolled(DDDD)Z"), locals = LocalCapture.CAPTURE_FAILHARD, cancellable = true) - private void beforeMouseScrollEvent(long window, double horizontal, double vertical, CallbackInfo ci, boolean sensitivity, double discreteScroll, double horizontalAmount, double verticalAmount, double mouseX, double mouseY) { - // Store the screen in a variable in case someone tries to change the screen during this before event. - // If someone changes the screen, the after event will likely have class cast exceptions or throw a NPE. - this.currentScreen = this.client.currentScreen; + @WrapOperation(method = "onMouseScroll", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/Screen;mouseScrolled(DDDD)Z")) + private boolean invokeMouseScrollEvents(Screen screen, double mouseX, double mouseY, double horizontalAmount, double verticalAmount, Operation operation) { + // The screen passed to events is the same as the screen the handler method is called on, + // regardless of whether the screen changes within the handler or event invocations. - if (this.currentScreen == null) { - return; - } + if (screen != null) { + if (!ScreenMouseEvents.allowMouseScroll(screen).invoker().allowMouseScroll(screen, mouseX, mouseY, horizontalAmount, verticalAmount)) { + // Set this scroll action as handled + return true; + } - if (!ScreenMouseEvents.allowMouseScroll(this.currentScreen).invoker().allowMouseScroll(this.currentScreen, mouseX, mouseY, horizontalAmount, verticalAmount)) { - this.currentScreen = null; - ci.cancel(); - return; + ScreenMouseEvents.beforeMouseScroll(screen).invoker().beforeMouseScroll(screen, mouseX, mouseY, horizontalAmount, verticalAmount); } - ScreenMouseEvents.beforeMouseScroll(this.currentScreen).invoker().beforeMouseScroll(this.currentScreen, mouseX, mouseY, horizontalAmount, verticalAmount); - } + boolean result = operation.call(screen, mouseX, mouseY, horizontalAmount, verticalAmount); - @Inject(method = "onMouseScroll", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/Screen;mouseScrolled(DDDD)Z", shift = At.Shift.AFTER), locals = LocalCapture.CAPTURE_FAILHARD) - private void afterMouseScrollEvent(long window, double horizontal, double vertical, CallbackInfo ci, boolean sensitivity, double discreteScroll, double horizontalAmount, double verticalAmount, double mouseX, double mouseY) { - if (this.currentScreen == null) { - return; + if (screen != null) { + ScreenMouseEvents.afterMouseScroll(screen).invoker().afterMouseScroll(screen, mouseX, mouseY, horizontalAmount, verticalAmount); } - ScreenMouseEvents.afterMouseScroll(this.currentScreen).invoker().afterMouseScroll(this.currentScreen, mouseX, mouseY, horizontalAmount, verticalAmount); - this.currentScreen = null; + return result; } } diff --git a/fabric-transitive-access-wideners-v1/src/main/resources/fabric-transitive-access-wideners-v1.accesswidener b/fabric-transitive-access-wideners-v1/src/main/resources/fabric-transitive-access-wideners-v1.accesswidener index 1a9d7a7d51..49da2dbf9b 100644 --- a/fabric-transitive-access-wideners-v1/src/main/resources/fabric-transitive-access-wideners-v1.accesswidener +++ b/fabric-transitive-access-wideners-v1/src/main/resources/fabric-transitive-access-wideners-v1.accesswidener @@ -160,6 +160,7 @@ transitive-accessible method net/minecraft/block/CoralBlock (Lnet/minecra transitive-accessible method net/minecraft/block/CoralFanBlock (Lnet/minecraft/block/Block;Lnet/minecraft/block/AbstractBlock$Settings;)V transitive-accessible method net/minecraft/block/CoralWallFanBlock (Lnet/minecraft/block/Block;Lnet/minecraft/block/AbstractBlock$Settings;)V transitive-accessible method net/minecraft/block/CraftingTableBlock (Lnet/minecraft/block/AbstractBlock$Settings;)V +transitive-accessible method net/minecraft/block/CreakingHeartBlock (Lnet/minecraft/block/AbstractBlock$Settings;)V transitive-accessible method net/minecraft/block/CropBlock (Lnet/minecraft/block/AbstractBlock$Settings;)V transitive-accessible method net/minecraft/block/DeadBushBlock (Lnet/minecraft/block/AbstractBlock$Settings;)V transitive-accessible method net/minecraft/block/DeadCoralBlock (Lnet/minecraft/block/AbstractBlock$Settings;)V diff --git a/gradle.properties b/gradle.properties index 8dc0d32a6e..a58e0d91d4 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,9 +2,9 @@ org.gradle.jvmargs=-Xmx2560M org.gradle.parallel=true fabric.loom.multiProjectOptimisation=true -version=0.105.2 -minecraft_version=24w40a -yarn_version=+build.3 +version=0.105.3 +minecraft_version=1.21.2-pre1 +yarn_version=+build.1 loader_version=0.16.4 installer_version=1.0.1 @@ -21,42 +21,42 @@ fabric-blockrenderlayer-v1-version=2.0.0 fabric-command-api-v1-version=1.2.54 fabric-command-api-v2-version=2.2.33 fabric-commands-v0-version=0.2.71 -fabric-content-registries-v0-version=9.1.2 +fabric-content-registries-v0-version=9.1.3 fabric-crash-report-info-v1-version=0.3.1 -fabric-data-attachment-api-v1-version=1.1.35 -fabric-data-generation-api-v1-version=21.0.10 +fabric-data-attachment-api-v1-version=1.1.36 +fabric-data-generation-api-v1-version=21.0.11 fabric-dimensions-v1-version=4.0.5 fabric-entity-events-v1-version=2.0.3 fabric-events-interaction-v0-version=2.0.6 fabric-game-rule-api-v1-version=1.0.57 -fabric-gametest-api-v1-version=2.0.10 -fabric-item-api-v1-version=11.1.2 -fabric-item-group-api-v1-version=4.1.11 +fabric-gametest-api-v1-version=2.0.11 +fabric-item-api-v1-version=11.1.3 +fabric-item-group-api-v1-version=4.1.12 fabric-key-binding-api-v1-version=1.0.51 fabric-keybindings-v0-version=0.2.49 fabric-lifecycle-events-v1-version=2.3.20 -fabric-loot-api-v2-version=3.0.21 -fabric-loot-api-v3-version=1.0.9 +fabric-loot-api-v2-version=3.0.22 +fabric-loot-api-v3-version=1.0.10 fabric-message-api-v1-version=6.0.17 fabric-model-loading-api-v1-version=3.0.5 fabric-networking-api-v1-version=4.3.0 -fabric-object-builder-api-v1-version=17.0.4 +fabric-object-builder-api-v1-version=17.0.5 fabric-particles-v1-version=4.0.6 fabric-recipe-api-v1-version=6.0.6 -fabric-registry-sync-v0-version=5.1.10 -fabric-renderer-api-v1-version=4.0.0 -fabric-renderer-indigo-version=1.9.0 +fabric-registry-sync-v0-version=5.1.11 +fabric-renderer-api-v1-version=4.0.1 +fabric-renderer-indigo-version=1.9.1 fabric-rendering-data-attachment-v1-version=0.3.52 fabric-rendering-fluids-v1-version=3.1.11 -fabric-rendering-v0-version=1.1.78 -fabric-rendering-v1-version=8.0.2 -fabric-resource-conditions-api-v1-version=5.0.5 -fabric-resource-loader-v0-version=3.0.2 -fabric-screen-api-v1-version=2.0.29 -fabric-screen-handler-api-v1-version=1.3.94 +fabric-rendering-v0-version=1.1.79 +fabric-rendering-v1-version=8.0.3 +fabric-resource-conditions-api-v1-version=5.0.6 +fabric-resource-loader-v0-version=3.0.3 +fabric-screen-api-v1-version=2.0.30 +fabric-screen-handler-api-v1-version=1.3.95 fabric-sound-api-v1-version=1.0.27 fabric-transfer-api-v1-version=5.3.2 -fabric-transitive-access-wideners-v1-version=6.1.5 -fabric-convention-tags-v1-version=2.0.31 -fabric-convention-tags-v2-version=2.8.2 +fabric-transitive-access-wideners-v1-version=6.1.6 +fabric-convention-tags-v1-version=2.0.32 +fabric-convention-tags-v2-version=2.8.3 fabric-client-tags-api-v1-version=1.1.20