CreateMod/src/main/java/com/simibubi/create/foundation/mixin/EnchantmentHelperMixin.java
PepperCode1 bb5d0fedee Mixin scrubbing
- Move all client mixins to separate package
- Prefix all mixin injector callback methods and added fields
- Remove unnecessary code from EntityContraptionInteractionMixin
- Remove EnchantmentMixin and use IForgeItem#canApplyAtEnchantingTable
instead
- Do not sync fire immune tag to client
- Bump network version to 3
- Remove 0.5.0j from Github issue template
2023-05-16 06:08:10 -07:00

24 lines
1 KiB
Java

package com.simibubi.create.foundation.mixin;
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.CallbackInfoReturnable;
import com.simibubi.create.content.curiosities.armor.DivingHelmetItem;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.enchantment.Enchantment;
import net.minecraft.world.item.enchantment.EnchantmentHelper;
import net.minecraft.world.item.enchantment.Enchantments;
@Mixin(EnchantmentHelper.class)
public class EnchantmentHelperMixin {
@Inject(method = "getItemEnchantmentLevel(Lnet/minecraft/world/item/enchantment/Enchantment;Lnet/minecraft/world/item/ItemStack;)I", at = @At("HEAD"), cancellable = true)
private static void create$onGetItemEnchantmentLevel(Enchantment enchantment, ItemStack stack, CallbackInfoReturnable<Integer> cir) {
if (enchantment == Enchantments.AQUA_AFFINITY && stack.getItem() instanceof DivingHelmetItem) {
cir.setReturnValue(1);
}
}
}