include animation methods

This commit is contained in:
Tofaa 2024-02-23 13:12:15 +04:00
parent 26cfb9e630
commit 69e8c2c9b0

View file

@ -1,7 +1,10 @@
package me.tofaa.entitylib.wrapper;
import com.github.retrooper.packetevents.protocol.entity.type.EntityType;
import com.github.retrooper.packetevents.protocol.player.HumanoidArm;
import com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerEntityAnimation;
import me.tofaa.entitylib.meta.EntityMeta;
import me.tofaa.entitylib.meta.types.LivingEntityMeta;
import java.util.UUID;
@ -14,6 +17,35 @@ public class WrapperLivingEntity extends WrapperEntity{
this.equipment = new WrapperEntityEquipment(this);
}
public void playCriticalHitAnimation() {
sendAnimation(WrapperPlayServerEntityAnimation.EntityAnimationType.CRITICAL_HIT);
}
public void playMagicCriticalHitAnimation() {
sendAnimation(WrapperPlayServerEntityAnimation.EntityAnimationType.MAGIC_CRITICAL_HIT);
}
public void playWakeupAnimation() {
sendAnimation(WrapperPlayServerEntityAnimation.EntityAnimationType.WAKE_UP);
}
public void playHurtAnimation() {
sendAnimation(WrapperPlayServerEntityAnimation.EntityAnimationType.HURT);
}
public void swingMainHand() {
sendAnimation(WrapperPlayServerEntityAnimation.EntityAnimationType.SWING_MAIN_ARM);
}
public void swingOffHand() {
sendAnimation(WrapperPlayServerEntityAnimation.EntityAnimationType.SWING_OFF_HAND);
}
public void sendAnimation(WrapperPlayServerEntityAnimation.EntityAnimationType type) {
sendPacketToViewers(
new WrapperPlayServerEntityAnimation(getEntityId(), type)
);
}
public WrapperEntityEquipment getEquipment() {
return equipment;