1.19 is enchanting

- Remove EnchantmentHelperMixin and use 1.19 enchantment extensions
instead
- Bump minimum Forge requirement to 43.2.3
This commit is contained in:
PepperCode1 2023-05-16 07:12:08 -07:00
parent d57fb72411
commit 1b76b147b1
4 changed files with 18 additions and 25 deletions

View file

@ -1,5 +1,7 @@
package com.simibubi.create.content.curiosities.armor; package com.simibubi.create.content.curiosities.armor;
import java.util.Map;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import com.simibubi.create.foundation.advancement.AllAdvancements; import com.simibubi.create.foundation.advancement.AllAdvancements;
@ -38,6 +40,21 @@ public class DivingHelmetItem extends BaseArmorItem {
return super.canApplyAtEnchantingTable(stack, enchantment); return super.canApplyAtEnchantingTable(stack, enchantment);
} }
@Override
public int getEnchantmentLevel(ItemStack stack, Enchantment enchantment) {
if (enchantment == Enchantments.AQUA_AFFINITY) {
return 1;
}
return super.getEnchantmentLevel(stack, enchantment);
}
@Override
public Map<Enchantment, Integer> getAllEnchantments(ItemStack stack) {
Map<Enchantment, Integer> map = super.getAllEnchantments(stack);
map.put(Enchantments.AQUA_AFFINITY, 1);
return map;
}
public static boolean isWornBy(Entity entity, boolean fireproof) { public static boolean isWornBy(Entity entity, boolean fireproof) {
ItemStack stack = getWornItem(entity); ItemStack stack = getWornItem(entity);
if (stack == null) if (stack == null)

View file

@ -1,23 +0,0 @@
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);
}
}
}

View file

@ -19,7 +19,7 @@ Technology that empowers the player.'''
[[dependencies.create]] [[dependencies.create]]
modId="forge" modId="forge"
mandatory=true mandatory=true
versionRange="[43.0.0,)" versionRange="[43.2.3,)"
ordering="NONE" ordering="NONE"
side="BOTH" side="BOTH"

View file

@ -9,7 +9,6 @@
"ContraptionDriverInteractMixin", "ContraptionDriverInteractMixin",
"WaterWheelFluidSpreadMixin", "WaterWheelFluidSpreadMixin",
"CustomItemUseEffectsMixin", "CustomItemUseEffectsMixin",
"EnchantmentHelperMixin",
"EntityMixin", "EntityMixin",
"LavaSwimmingMixin", "LavaSwimmingMixin",
"MainMixin", "MainMixin",