mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-24 05:47:59 +01:00
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:
parent
dd294f4f86
commit
06bfc6d760
2 changed files with 24 additions and 0 deletions
|
@ -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));
|
||||
}
|
||||
}
|
|
@ -11,6 +11,7 @@
|
|||
"MixinItemEntity",
|
||||
"MixinItems",
|
||||
"MixinLivingEntity",
|
||||
"MixinMilkBucketItem",
|
||||
"MixinPlayerEntity",
|
||||
"MixinProjectileEntity",
|
||||
"MixinServerPlayerEntity",
|
||||
|
|
Loading…
Reference in a new issue