Drinking milk will also clear whatever spell is attached to you (useful if you're an earth pony stuck with a shield)

This commit is contained in:
Sollace 2020-10-09 18:00:55 +02:00
parent dd294f4f86
commit 06bfc6d760
2 changed files with 24 additions and 0 deletions

View file

@ -0,0 +1,23 @@
package com.minelittlepony.unicopia.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.minelittlepony.unicopia.ability.magic.CasterUtils;
import net.minecraft.entity.LivingEntity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.MilkBucketItem;
import net.minecraft.world.World;
@Mixin(MilkBucketItem.class)
abstract class MixinMilkBucketItem extends Item {
MixinMilkBucketItem() { super(null); }
@Inject(method = "finishUsing", at = @At("HEAD"), cancellable = true)
private void finishUsing(ItemStack stack, World world, LivingEntity entity, CallbackInfoReturnable<ItemStack> info) {
CasterUtils.toCaster(entity).ifPresent(c -> c.setSpell(null));
}
}

View file

@ -11,6 +11,7 @@
"MixinItemEntity",
"MixinItems",
"MixinLivingEntity",
"MixinMilkBucketItem",
"MixinPlayerEntity",
"MixinProjectileEntity",
"MixinServerPlayerEntity",