Fix player animations

This commit is contained in:
fullwall 2013-12-01 18:51:43 +08:00
parent 3896c67709
commit fe370258db
2 changed files with 17 additions and 12 deletions

View File

@ -196,8 +196,7 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder {
// swallow
}
NMS.setStepHeight(this, 1);// stepHeight - must not stay as the default
// 0 (breaks steps).
NMS.setStepHeight(this, 1); // the default (0) breaks step climbing
try {
socket.close();

View File

@ -15,29 +15,31 @@ public enum PlayerAnimation {
ARM_SWING {
@Override
protected void playAnimation(EntityPlayer player, int radius) {
PacketPlayOutAnimation packet = new PacketPlayOutAnimation(player, 1);
sendPacketNearby(packet, player, radius);
playDefaultAnimation(player, radius, 0);
}
},
CRIT {
@Override
protected void playAnimation(EntityPlayer player, int radius) {
PacketPlayOutAnimation packet = new PacketPlayOutAnimation(player, 6);
sendPacketNearby(packet, player, radius);
playDefaultAnimation(player, radius, 4);
}
},
EAT_FOOD {
@Override
protected void playAnimation(EntityPlayer player, int radius) {
playDefaultAnimation(player, radius, 3);
}
},
HURT {
@Override
protected void playAnimation(EntityPlayer player, int radius) {
PacketPlayOutAnimation packet = new PacketPlayOutAnimation(player, 2);
sendPacketNearby(packet, player, radius);
playDefaultAnimation(player, radius, 1);
}
},
MAGIC_CRIT {
@Override
protected void playAnimation(EntityPlayer player, int radius) {
PacketPlayOutAnimation packet = new PacketPlayOutAnimation(player, 7);
sendPacketNearby(packet, player, radius);
playDefaultAnimation(player, radius, 5);
}
},
SIT {
@ -71,8 +73,7 @@ public enum PlayerAnimation {
STOP_SLEEPING {
@Override
protected void playAnimation(EntityPlayer player, int radius) {
PacketPlayOutAnimation packet = new PacketPlayOutAnimation(player, 3);
sendPacketNearby(packet, player, radius);
playDefaultAnimation(player, radius, 2);
}
},
STOP_SNEAKING {
@ -96,6 +97,11 @@ public enum PlayerAnimation {
throw new UnsupportedOperationException("unimplemented animation");
}
protected void playDefaultAnimation(EntityPlayer player, int radius, int code) {
PacketPlayOutAnimation packet = new PacketPlayOutAnimation(player, code);
sendPacketNearby(packet, player, radius);
}
protected void sendPacketNearby(Packet packet, EntityPlayer player, int radius) {
NMS.sendPacketsNearby(player.getBukkitEntity().getLocation(), Arrays.asList(packet), radius);
}