mirror of https://github.com/kami-blue/client
parent
ce6748454d
commit
ed9a8d0a1f
|
@ -8,7 +8,8 @@ import java.math.BigDecimal;
|
||||||
import java.math.RoundingMode;
|
import java.math.RoundingMode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by d1gress/Qther on 25/11/2017.
|
* Created by d1gress/Qther on 25/11/2017, updated on 16/12/2019
|
||||||
|
* Updated by EmotionalLove on 16/12/2019
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class EntityStatsCommand extends Command {
|
public class EntityStatsCommand extends Command {
|
||||||
|
@ -23,23 +24,14 @@ public class EntityStatsCommand extends Command {
|
||||||
String maxHealth;
|
String maxHealth;
|
||||||
String speed;
|
String speed;
|
||||||
if (mc.player.getRidingEntity() != null && mc.player.getRidingEntity() instanceof AbstractHorse) {
|
if (mc.player.getRidingEntity() != null && mc.player.getRidingEntity() instanceof AbstractHorse) {
|
||||||
// EntityHorse, EntityMule, etc etc all extend AbstractHorse
|
AbstractHorse horse = (AbstractHorse) mc.player.getRidingEntity();
|
||||||
// no need to check if the riding entity is an instanceof everything @d1gress
|
|
||||||
AbstractHorse h = (AbstractHorse) mc.player.getRidingEntity();
|
|
||||||
|
|
||||||
maxHealth = h.getMaxHealth() + " \2472HP";
|
|
||||||
speed = round(43.17 * h.getAIMoveSpeed(), 2) + " \2472m/s";
|
|
||||||
String jumpHeight = round(-0.1817584952 * Math.pow(h.getHorseJumpStrength(), 3) + 3.689713992 * Math.pow(h.getHorseJumpStrength(), 2) + 2.128599134 * h.getHorseJumpStrength() - 0.343930367, 4) + " \2472m";
|
|
||||||
String tamer = h.getOwnerUniqueId() == null ? "Not tamed." : h.getOwnerUniqueId().toString();
|
|
||||||
// TODO: Function that resolves UUID's to Minecraft usernames. @bella
|
// TODO: Function that resolves UUID's to Minecraft usernames. @bella
|
||||||
Command.sendChatMessage("\2476Entity Stats:\n\247cMax Health: \247b" + maxHealth + "\n\247cSpeed: \247b" + speed + "\n\247cJump: \247b" + jumpHeight + "\n\247cOwner UUID: \247b" + tamer);
|
Command.sendChatMessage("&6Entity Stats:\n&cMax Health: &b" + horse.getMaxHealth() + " &2HP" + "\n&cSpeed: &b" + round(43.17 * horse.getAIMoveSpeed(), 2) + " &2m/s" + "\n&cJump: &b" + round(-0.1817584952 * Math.pow(horse.getHorseJumpStrength(), 3) + 3.689713992 * Math.pow(horse.getHorseJumpStrength(), 2) + 2.128599134 * horse.getHorseJumpStrength() - 0.343930367, 4) + " &2m" + "\n&cOwner UUID: &b" + horse.getOwnerUniqueId() == null ? "Not tamed." : horse.getOwnerUniqueId().toString());
|
||||||
} else if (mc.player.getRidingEntity() instanceof EntityLivingBase) {
|
} else if (mc.player.getRidingEntity() instanceof EntityLivingBase) {
|
||||||
EntityLivingBase l = (EntityLivingBase) mc.player.getRidingEntity();
|
EntityLivingBase entity = (EntityLivingBase) mc.player.getRidingEntity();
|
||||||
maxHealth = l.getMaxHealth() + " \2472HP";
|
Command.sendChatMessage("&6Entity Stats:\n&cMax Health: &b" + entity.getMaxHealth() + " &2HP" + "\n&cSpeed: &b" + round(43.17 * entity.getAIMoveSpeed(), 2) + " &2m/s";);
|
||||||
speed = round(43.17 * l.getAIMoveSpeed(), 2) + " \2472m/s";
|
|
||||||
Command.sendChatMessage("\2476Entity Stats:\n\247cMax Health: \247b" + maxHealth + "\n\247cSpeed: \247b" + speed);
|
|
||||||
} else {
|
} else {
|
||||||
Command.sendChatMessage("\2474\247lERROR: \247cNot riding a compatible entity.");
|
Command.sendChatMessage("&4&lERROR: &cNot riding a compatible entity.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue