Skip to content

Commit

Permalink
Update to 1.21.1
Browse files Browse the repository at this point in the history
Fixes #143
  • Loading branch information
Su5eD committed Aug 11, 2024
1 parent 9cd92c6 commit f56196c
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@

package net.fabricmc.fabric.mixin.item;

import com.llamalad7.mixinextras.sugar.Local;
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
import org.jetbrains.annotations.Nullable;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
import net.fabricmc.fabric.api.item.v1.EnchantingContext;
import net.minecraft.core.Holder;
import net.minecraft.world.entity.player.Inventory;
Expand All @@ -37,14 +37,14 @@ abstract class AnvilScreenHandlerMixin extends ItemCombinerMenu {
super(type, syncId, playerInventory, context);
}

@Redirect(
@WrapOperation(
method = "createResult",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/world/item/enchantment/Enchantment;canEnchant(Lnet/minecraft/world/item/ItemStack;)Z"
target = "Lnet/minecraft/world/item/ItemStack;supportsEnchantment(Lnet/minecraft/core/Holder;)Z"
)
)
private boolean callAllowEnchantingEvent(Enchantment instance, ItemStack stack, @Local Holder<Enchantment> registryEntry) {
return stack.canBeEnchantedWith(registryEntry, EnchantingContext.ACCEPTABLE);
private boolean callAllowEnchantingEvent(ItemStack instance, Holder<Enchantment> registryEntry, Operation<Boolean> original) {
return instance.canBeEnchantedWith(registryEntry, EnchantingContext.ACCEPTABLE) || original.call(instance, registryEntry);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,24 @@

package net.fabricmc.fabric.mixin.item;

import java.util.Collection;

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.Redirect;
import net.fabricmc.fabric.api.item.v1.EnchantingContext;
import net.minecraft.commands.CommandSourceStack;
import net.minecraft.core.Holder;
import net.minecraft.server.commands.EnchantCommand;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.enchantment.Enchantment;

@Mixin(EnchantCommand.class)
abstract class EnchantCommandMixin {
@Redirect(
@WrapOperation(
method = "enchant",
at = @At(value = "INVOKE", target = "Lnet/minecraft/world/item/enchantment/Enchantment;canEnchant(Lnet/minecraft/world/item/ItemStack;)Z")
at = @At(value = "INVOKE", target = "Lnet/minecraft/world/item/ItemStack;supportsEnchantment(Lnet/minecraft/core/Holder;)Z")
)
private static boolean callAllowEnchantingEvent(Enchantment instance, ItemStack stack, CommandSourceStack source, Collection<? extends Entity> targets, Holder<Enchantment> enchantment) {
return stack.canBeEnchantedWith(enchantment, EnchantingContext.ACCEPTABLE);
private static boolean callAllowEnchantingEvent(ItemStack instance, Holder<Enchantment> enchantment, Operation<Boolean> original) {
return instance.canBeEnchantedWith(enchantment, EnchantingContext.ACCEPTABLE) || original.call(instance, enchantment);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,23 @@

package net.fabricmc.fabric.mixin.item;

import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
import net.fabricmc.fabric.api.item.v1.EnchantingContext;
import net.minecraft.core.Holder;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.enchantment.Enchantment;
import net.minecraft.world.level.storage.loot.functions.EnchantRandomlyFunction;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;

@Mixin(EnchantRandomlyFunction.class)
abstract class EnchantRandomlyLootFunctionMixin {
@Redirect(
@WrapOperation(
method = "lambda$run$4",
at = @At(value = "INVOKE", target = "Lnet/minecraft/world/item/enchantment/Enchantment;canEnchant(Lnet/minecraft/world/item/ItemStack;)Z")
at = @At(value = "INVOKE", target = "Lnet/minecraft/world/item/ItemStack;supportsEnchantment(Lnet/minecraft/core/Holder;)Z")
)
private static boolean callAllowEnchantingEvent(Enchantment enchantment, ItemStack stack, boolean bl, ItemStack itemStack, Holder<Enchantment> registryEntry) {
return stack.canBeEnchantedWith(registryEntry, EnchantingContext.ACCEPTABLE);
private static boolean callAllowEnchantingEvent(ItemStack stack, Holder<Enchantment> registryEntry, Operation<Boolean> original) {
return stack.canBeEnchantedWith(registryEntry, EnchantingContext.ACCEPTABLE) || original.call(stack, registryEntry);
}
}
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
package net.fabricmc.fabric.mixin.item;

import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
import net.fabricmc.fabric.api.item.v1.EquipmentSlotProvider;
import net.fabricmc.fabric.api.item.v1.FabricItem;
import net.fabricmc.fabric.impl.item.ItemExtensions;
import net.fabricmc.fabric.impl.item.RecursivityHelper;
import net.minecraft.core.Holder;
import net.minecraft.world.entity.EquipmentSlot;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.enchantment.Enchantment;
import net.neoforged.neoforge.common.extensions.IItemExtension;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
Expand Down
6 changes: 3 additions & 3 deletions ffapi.gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ fabric.loom.dontRemap=true

implementationVersion=2.0.10

versionMc=1.21
versionForge=21.0.160
versionMc=1.21.1
versionForge=21.1.4
versionForgifiedFabricLoader=2.5.29+0.16.0+1.21
versionFabricLoader=0.16.0

curseForgeId=889079
modrinthId=Aqlf1Shp
githubRepository=Sinytra/ForgifiedFabricAPI
# This is the branch the release tag will be created from
publishBranch=1.21
publishBranch=1.21.1

0 comments on commit f56196c

Please sign in to comment.