Search in sources :

Example 61 with CraftEntity

use of org.bukkit.craftbukkit.v1_5_R2.entity.CraftEntity in project NoCheatPlus by NoCheatPlus.

the class MCAccessCBDev method getHeight.

@Override
public double getHeight(final Entity entity) {
    // (entity.getHeight() returns the length field, but we access nms anyway.)
    final net.minecraft.server.v1_12_R1.Entity mcEntity = ((CraftEntity) entity).getHandle();
    final AxisAlignedBB boundingBox = mcEntity.getBoundingBox();
    final double entityHeight = Math.max(mcEntity.length, Math.max(mcEntity.getHeadHeight(), boundingBox.e - boundingBox.b));
    if (entity instanceof LivingEntity) {
        return Math.max(((LivingEntity) entity).getEyeHeight(), entityHeight);
    } else {
        return entityHeight;
    }
}
Also used : AxisAlignedBB(net.minecraft.server.v1_12_R1.AxisAlignedBB) LivingEntity(org.bukkit.entity.LivingEntity) CraftEntity(org.bukkit.craftbukkit.v1_12_R1.entity.CraftEntity)

Aggregations

Entity (org.bukkit.entity.Entity)30 Iterator (java.util.Iterator)21 List (java.util.List)21 LivingEntity (org.bukkit.entity.LivingEntity)14 UUID (java.util.UUID)12 CraftEntity (org.bukkit.craftbukkit.v1_10_R1.entity.CraftEntity)10 CraftEntity (org.bukkit.craftbukkit.v1_11_R1.entity.CraftEntity)10 HashSet (java.util.HashSet)8 Set (java.util.Set)8 CraftEntity (org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity)8 BukkitRunnable (org.bukkit.scheduler.BukkitRunnable)8 CraftEntity (org.bukkit.craftbukkit.v1_12_R1.entity.CraftEntity)7 CraftEntity (org.bukkit.craftbukkit.v1_9_R2.entity.CraftEntity)7 Location (org.bukkit.Location)6 net.minecraft.server.v1_10_R1 (net.minecraft.server.v1_10_R1)5 net.minecraft.server.v1_11_R1 (net.minecraft.server.v1_11_R1)5 CompoundTag_v1_10_R1 (net.aufdemrand.denizen.nms.impl.jnbt.CompoundTag_v1_10_R1)4 CompoundTag_v1_11_R1 (net.aufdemrand.denizen.nms.impl.jnbt.CompoundTag_v1_11_R1)4 CompoundTag_v1_8_R3 (net.aufdemrand.denizen.nms.impl.jnbt.CompoundTag_v1_8_R3)4 CompoundTag_v1_9_R2 (net.aufdemrand.denizen.nms.impl.jnbt.CompoundTag_v1_9_R2)4