mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-12-18 16:07:59 +01:00
Merge branch '1.20.2' into 1.20.4
This commit is contained in:
commit
358f832cab
2 changed files with 5 additions and 2 deletions
|
@ -12,7 +12,6 @@ import com.mojang.serialization.codecs.RecordCodecBuilder;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.block.StairsBlock;
|
import net.minecraft.block.StairsBlock;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.util.ActionResult;
|
import net.minecraft.util.ActionResult;
|
||||||
import net.minecraft.util.Hand;
|
import net.minecraft.util.Hand;
|
||||||
import net.minecraft.util.hit.BlockHitResult;
|
import net.minecraft.util.hit.BlockHitResult;
|
||||||
|
|
|
@ -8,12 +8,14 @@ import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||||
|
|
||||||
import com.minelittlepony.unicopia.entity.player.Pony;
|
import com.minelittlepony.unicopia.entity.player.Pony;
|
||||||
|
import com.minelittlepony.unicopia.item.enchantment.SimpleEnchantment;
|
||||||
|
|
||||||
import net.minecraft.enchantment.Enchantment;
|
import net.minecraft.enchantment.Enchantment;
|
||||||
import net.minecraft.enchantment.EnchantmentHelper;
|
import net.minecraft.enchantment.EnchantmentHelper;
|
||||||
import net.minecraft.enchantment.EnchantmentLevelEntry;
|
import net.minecraft.enchantment.EnchantmentLevelEntry;
|
||||||
import net.minecraft.entity.LivingEntity;
|
import net.minecraft.entity.LivingEntity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.item.Items;
|
||||||
|
|
||||||
@Mixin(EnchantmentHelper.class)
|
@Mixin(EnchantmentHelper.class)
|
||||||
abstract class MixinEnchantmentHelper {
|
abstract class MixinEnchantmentHelper {
|
||||||
|
@ -30,6 +32,8 @@ abstract class MixinEnchantmentHelper {
|
||||||
|
|
||||||
@Inject(method = "getPossibleEntries", at = @At("RETURN"))
|
@Inject(method = "getPossibleEntries", at = @At("RETURN"))
|
||||||
private static void onGetPossibleEntries(int power, ItemStack stack, boolean treasureAllowed, CallbackInfoReturnable<List<EnchantmentLevelEntry>> info) {
|
private static void onGetPossibleEntries(int power, ItemStack stack, boolean treasureAllowed, CallbackInfoReturnable<List<EnchantmentLevelEntry>> info) {
|
||||||
info.getReturnValue().removeIf(entry -> !entry.enchantment.isAcceptableItem(stack));
|
if (!stack.isOf(Items.BOOK)) {
|
||||||
|
info.getReturnValue().removeIf(entry -> entry.enchantment instanceof SimpleEnchantment && !entry.enchantment.isAcceptableItem(stack));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue