Update mod to Minecraft 1.21.2 pre-release 1 ()

* Update mod to Minecraft 1.21.2 pre-release 1

* Bump version

---------

Co-authored-by: modmuss50 <modmuss50@gmail.com>
This commit is contained in:
haykam821 2024-10-08 13:00:08 -04:00 committed by GitHub
parent 86ae0e5586
commit 57632285fa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
22 changed files with 152 additions and 185 deletions
fabric-convention-tags-v2/src/datagen/java/net/fabricmc/fabric/impl/tag/convention/datagen/generators
fabric-data-generation-api-v1/src/main/resources
fabric-item-api-v1/src
main/java/net/fabricmc/fabric/mixin/item
testmod/java/net/fabricmc/fabric/test/item/gametest
fabric-registry-sync-v0/src
client/java/net/fabricmc/fabric/mixin/registry/sync/client
main/java/net/fabricmc/fabric/impl/registry/sync
fabric-renderer-api-v1/src/client/java/net/fabricmc/fabric/api/renderer/v1/render
fabric-renderer-indigo/src/client/java/net/fabricmc/fabric
impl/client/indigo/renderer/render
mixin/client/indigo/renderer
fabric-rendering-v1/src/client/java/net/fabricmc/fabric
api/client/rendering/v1
mixin/client/rendering
fabric-resource-conditions-api-v1/src/testmod/java/net/fabricmc/fabric/test/resource/conditions
fabric-resource-loader-v0/src/main
fabric-screen-api-v1/src/client/java/net/fabricmc/fabric/mixin/screen
fabric-transitive-access-wideners-v1/src/main/resources
gradle.properties

View file

@ -18,13 +18,13 @@ package net.fabricmc.fabric.impl.tag.convention.datagen.generators;
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 @@ public final class BiomeTagGenerator extends FabricTagProvider<Biome> {
.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 @@ public final class BiomeTagGenerator extends FabricTagProvider<Biome> {
.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 @@ public final class BiomeTagGenerator extends FabricTagProvider<Biome> {
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 @@ public final class BiomeTagGenerator extends FabricTagProvider<Biome> {
.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);

View file

@ -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;

View file

@ -30,13 +30,13 @@ import net.fabricmc.fabric.impl.item.RecipeRemainderHandler;
@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<Item> 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();

View file

@ -37,7 +37,7 @@ public class RecipeGameTest implements FabricGameTest {
new ItemStack(Items.WATER_BUCKET),
new ItemStack(Items.DIAMOND)));
DefaultedList<ItemStack> remainderList = CraftingRecipe.method_64671(inventory);
DefaultedList<ItemStack> remainderList = CraftingRecipe.collectRecipeRemainders(inventory);
assertStackList(remainderList, "Testing vanilla recipe remainder.",
new ItemStack(Items.BUCKET),
@ -54,7 +54,7 @@ public class RecipeGameTest implements FabricGameTest {
withDamage(new ItemStack(CustomDamageTest.WEIRD_PICK), 31),
new ItemStack(Items.DIAMOND)));
DefaultedList<ItemStack> remainderList = CraftingRecipe.method_64671(inventory);
DefaultedList<ItemStack> remainderList = CraftingRecipe.collectRecipeRemainders(inventory);
assertStackList(remainderList, "Testing fabric recipe remainder.",
withDamage(new ItemStack(CustomDamageTest.WEIRD_PICK), 1),

View file

@ -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<RegistryLoader.Entry<?>> skipEmptyRegistries(Operation<List<RegistryLoader.Entry<?>>> operation, ResourceFactory resourceFactory, @Coerce ClientRegistriesDynamicRegistriesAccessor storage, boolean bl) {
Map<RegistryKey<? extends Registry<?>>, List<SerializableRegistries.SerializedRegistryEntry>> dynamicRegistries = storage.getDynamicRegistries();

View file

@ -215,5 +215,9 @@ public class FabricRegistryInit implements ModInitializer {
// Synced via PacketCodecs.registryValue
RegistryAttributeHolder.get(Registries.SLOT_DISPLAY)
.addAttribute(RegistryAttribute.SYNCED);
// Synced via PacketCodecs.registryValue
RegistryAttributeHolder.get(Registries.field_54927)
.addAttribute(RegistryAttribute.SYNCED);
}
}

View file

@ -20,7 +20,7 @@ import java.util.function.Consumer;
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;

View file

@ -27,7 +27,7 @@ import net.minecraft.client.render.LightmapTextureManager;
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;

View file

@ -29,9 +29,9 @@ import net.minecraft.client.render.VertexConsumer;
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;

View file

@ -28,9 +28,9 @@ import net.minecraft.client.color.item.ItemColors;
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<ItemRenderContext> 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);

View file

@ -19,11 +19,11 @@ package net.fabricmc.fabric.api.client.rendering.v1;
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;

View file

@ -24,9 +24,9 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
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;

View file

@ -18,7 +18,7 @@ package net.fabricmc.fabric.test.resource.conditions;
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 @@ public class ConditionalResourcesTest {
@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.");

View file

@ -245,7 +245,7 @@ public class ResourceManagerHelperImpl implements ResourceManagerHelper {
}
}
throw new IllegalStateException("No RecipeManager found in listeners!");
throw new IllegalStateException("No ServerRecipeManager found in listeners!");
}
@Override

View file

@ -22,7 +22,7 @@ import java.util.Locale;
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 @@ import net.fabricmc.fabric.api.resource.ResourceReloadListenerKeys;
@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 abstract class KeyedResourceReloadListenerMixin implements IdentifiableRe
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;

View file

@ -24,13 +24,13 @@ 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.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;

View file

@ -10,10 +10,10 @@
"ResourceMixin",
"ResourcePackManagerMixin",
"ResourcePackProfileMixin",
"RecipeManagerMixin",
"SelectKnownPacksC2SPacketMixin",
"ServerConfigurationNetworkHandlerMixin",
"ServerPropertiesHandlerMixin",
"ServerRecipeManagerMixin",
"SimpleResourceReloadMixin",
"SynchronizeRegistriesTaskMixin",
"TestServerMixin"

View file

@ -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 @@ import net.fabricmc.fabric.api.client.screen.v1.ScreenKeyboardEvents;
@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<Boolean> 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);
// 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);
}
// 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;
if (screen != null) {
ScreenKeyboardEvents.afterKeyPress(screen).invoker().afterKeyPress(screen, key, scancode, modifiers);
}
ScreenKeyboardEvents.beforeKeyRelease(screen).invoker().beforeKeyRelease(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", 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);
@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<Boolean> 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);
}
boolean result = operation.call(screen, key, scancode, modifiers);
if (screen != null) {
ScreenKeyboardEvents.afterKeyRelease(screen).invoker().afterKeyRelease(screen, key, scancode, modifiers);
}
return result;
}
}

View file

@ -66,9 +66,8 @@ abstract class MinecraftClientMixin {
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 @@ abstract class MinecraftClientMixin {
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

View file

@ -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 @@ import net.fabricmc.fabric.api.client.screen.v1.ScreenMouseEvents;
@Mixin(Mouse.class)
abstract class MouseMixin {
@Shadow
@Final
private MinecraftClient client;
@Unique
private Screen currentScreen;
@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<Boolean> 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.
// 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 (screen != null) {
if (!ScreenMouseEvents.allowMouseClick(screen).invoker().allowMouseClick(screen, mouseX, mouseY, button)) {
// Set this press action as handled
return true;
}
if (thisRef.currentScreen == null) {
return;
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;
boolean result = operation.call(screen, mouseX, mouseY, button);
if (screen != null) {
ScreenMouseEvents.afterMouseClick(screen).invoker().afterMouseClick(screen, mouseX, mouseY, button);
}
ScreenMouseEvents.beforeMouseClick(thisRef.currentScreen).invoker().beforeMouseClick(thisRef.currentScreen, mouseX, mouseY, button);
return result;
}
// 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;
@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<Boolean> 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;
}
ScreenMouseEvents.beforeMouseRelease(screen).invoker().beforeMouseRelease(screen, mouseX, mouseY, button);
}
ScreenMouseEvents.afterMouseClick(thisRef.currentScreen).invoker().afterMouseClick(thisRef.currentScreen, mouseX, mouseY, button);
thisRef.currentScreen = null;
boolean result = operation.call(screen, mouseX, mouseY, button);
if (screen != null) {
ScreenMouseEvents.afterMouseRelease(screen).invoker().afterMouseRelease(screen, mouseX, mouseY, button);
}
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;
@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<Boolean> 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.
// 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 (screen != null) {
if (!ScreenMouseEvents.allowMouseScroll(screen).invoker().allowMouseScroll(screen, mouseX, mouseY, horizontalAmount, verticalAmount)) {
// Set this scroll action as handled
return true;
}
if (thisRef.currentScreen == null) {
return;
ScreenMouseEvents.beforeMouseScroll(screen).invoker().beforeMouseScroll(screen, mouseX, mouseY, horizontalAmount, verticalAmount);
}
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;
boolean result = operation.call(screen, mouseX, mouseY, horizontalAmount, verticalAmount);
if (screen != null) {
ScreenMouseEvents.afterMouseScroll(screen).invoker().afterMouseScroll(screen, mouseX, mouseY, horizontalAmount, verticalAmount);
}
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;
if (thisRef.currentScreen == null) {
return;
}
ScreenMouseEvents.afterMouseRelease(thisRef.currentScreen).invoker().afterMouseRelease(thisRef.currentScreen, mouseX, mouseY, button);
thisRef.currentScreen = null;
}
@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;
if (this.currentScreen == null) {
return;
}
if (!ScreenMouseEvents.allowMouseScroll(this.currentScreen).invoker().allowMouseScroll(this.currentScreen, mouseX, mouseY, horizontalAmount, verticalAmount)) {
this.currentScreen = null;
ci.cancel();
return;
}
ScreenMouseEvents.beforeMouseScroll(this.currentScreen).invoker().beforeMouseScroll(this.currentScreen, 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;
}
ScreenMouseEvents.afterMouseScroll(this.currentScreen).invoker().afterMouseScroll(this.currentScreen, mouseX, mouseY, horizontalAmount, verticalAmount);
this.currentScreen = null;
return result;
}
}

View file

@ -160,6 +160,7 @@ transitive-accessible method net/minecraft/block/CoralBlock <init> (Lnet/minecra
transitive-accessible method net/minecraft/block/CoralFanBlock <init> (Lnet/minecraft/block/Block;Lnet/minecraft/block/AbstractBlock$Settings;)V
transitive-accessible method net/minecraft/block/CoralWallFanBlock <init> (Lnet/minecraft/block/Block;Lnet/minecraft/block/AbstractBlock$Settings;)V
transitive-accessible method net/minecraft/block/CraftingTableBlock <init> (Lnet/minecraft/block/AbstractBlock$Settings;)V
transitive-accessible method net/minecraft/block/CreakingHeartBlock <init> (Lnet/minecraft/block/AbstractBlock$Settings;)V
transitive-accessible method net/minecraft/block/CropBlock <init> (Lnet/minecraft/block/AbstractBlock$Settings;)V
transitive-accessible method net/minecraft/block/DeadBushBlock <init> (Lnet/minecraft/block/AbstractBlock$Settings;)V
transitive-accessible method net/minecraft/block/DeadCoralBlock <init> (Lnet/minecraft/block/AbstractBlock$Settings;)V

View file

@ -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