package fr.koka99cab.ibelievechickenfly.mixin;

import fr.koka99cab.ibelievechickenfly.chickenfly.ChickenCarryController;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.LivingEntity;
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.CallbackInfo;

@Mixin(LivingEntity.class)
public abstract class LivingEntityMixin {
	@Inject(method = "doPush", at = @At("HEAD"), cancellable = true)
	private void ibelievechickenfly$cancelPushAway(Entity entity, CallbackInfo ci) {
		if (ChickenCarryController.isChickenCarried((Entity) (Object) this)) {
			ci.cancel();
		}
	}
}
