Fixed magic projectiles not triggering the destroy event on their spells when being destroyed

This commit is contained in:
Sollace 2022-10-09 00:29:19 +02:00
parent f3cdeaf504
commit 66bdfc0e1a

View file

@ -25,6 +25,7 @@ import com.minelittlepony.unicopia.network.datasync.EffectSync;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityType; import net.minecraft.entity.EntityType;
import net.minecraft.entity.LivingEntity; import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.Entity.RemovalReason;
import net.minecraft.entity.damage.DamageSource; import net.minecraft.entity.damage.DamageSource;
import net.minecraft.entity.data.DataTracker; import net.minecraft.entity.data.DataTracker;
import net.minecraft.entity.data.TrackedData; import net.minecraft.entity.data.TrackedData;
@ -263,6 +264,12 @@ public class MagicProjectileEntity extends ThrownItemEntity implements Caster<Li
} }
} }
@Override
public void remove(RemovalReason reason) {
super.remove(reason);
getSpellSlot().clear();
}
@Override @Override
protected void onBlockHit(BlockHitResult hit) { protected void onBlockHit(BlockHitResult hit) {
super.onBlockHit(hit); super.onBlockHit(hit);