Search in sources :

Example 1 with RayTrace

use of net.minecraft.server.v1_16_R3.RayTrace in project RoseStacker by Rosewood-Development.

the class NMSHandlerImpl method hasLineOfSight.

@Override
public boolean hasLineOfSight(LivingEntity entity1, org.bukkit.entity.Entity entity2) {
    EntityLiving nmsEntity1 = ((CraftLivingEntity) entity1).getHandle();
    Entity nmsEntity2 = ((CraftEntity) entity2).getHandle();
    Vec3D vec3d = new Vec3D(nmsEntity1.locX(), nmsEntity1.getHeadY(), nmsEntity1.locZ());
    Vec3D vec3d1 = new Vec3D(nmsEntity2.locX(), nmsEntity2.getHeadY(), nmsEntity2.locZ());
    return nmsEntity1.world.rayTrace(new RayTrace(vec3d, vec3d1, RayTrace.BlockCollisionOption.VISUAL, RayTrace.FluidCollisionOption.NONE, nmsEntity1)).getType() == MovingObjectPosition.EnumMovingObjectType.MISS;
}
Also used : Entity(net.minecraft.server.v1_16_R2.Entity) CraftLivingEntity(org.bukkit.craftbukkit.v1_16_R2.entity.CraftLivingEntity) LivingEntity(org.bukkit.entity.LivingEntity) TileEntity(net.minecraft.server.v1_16_R2.TileEntity) GroupDataEntity(net.minecraft.server.v1_16_R2.GroupDataEntity) CraftEntity(org.bukkit.craftbukkit.v1_16_R2.entity.CraftEntity) EntityLiving(net.minecraft.server.v1_16_R2.EntityLiving) RayTrace(net.minecraft.server.v1_16_R2.RayTrace) CraftEntity(org.bukkit.craftbukkit.v1_16_R2.entity.CraftEntity) CraftLivingEntity(org.bukkit.craftbukkit.v1_16_R2.entity.CraftLivingEntity) Vec3D(net.minecraft.server.v1_16_R2.Vec3D)

Example 2 with RayTrace

use of net.minecraft.server.v1_16_R3.RayTrace in project RoseStacker by Rosewood-Development.

the class NMSHandlerImpl method hasLineOfSight.

@Override
public boolean hasLineOfSight(LivingEntity entity1, org.bukkit.entity.Entity entity2) {
    EntityLiving nmsEntity1 = ((CraftLivingEntity) entity1).getHandle();
    Entity nmsEntity2 = ((CraftEntity) entity2).getHandle();
    Vec3D vec3d = new Vec3D(nmsEntity1.locX(), nmsEntity1.getHeadY(), nmsEntity1.locZ());
    Vec3D vec3d1 = new Vec3D(nmsEntity2.locX(), nmsEntity2.getHeadY(), nmsEntity2.locZ());
    return nmsEntity1.world.rayTrace(new RayTrace(vec3d, vec3d1, RayTrace.BlockCollisionOption.VISUAL, RayTrace.FluidCollisionOption.NONE, nmsEntity1)).getType() == MovingObjectPosition.EnumMovingObjectType.MISS;
}
Also used : Entity(net.minecraft.server.v1_16_R3.Entity) GroupDataEntity(net.minecraft.server.v1_16_R3.GroupDataEntity) CraftEntity(org.bukkit.craftbukkit.v1_16_R3.entity.CraftEntity) TileEntity(net.minecraft.server.v1_16_R3.TileEntity) LivingEntity(org.bukkit.entity.LivingEntity) CraftLivingEntity(org.bukkit.craftbukkit.v1_16_R3.entity.CraftLivingEntity) EntityLiving(net.minecraft.server.v1_16_R3.EntityLiving) RayTrace(net.minecraft.server.v1_16_R3.RayTrace) CraftEntity(org.bukkit.craftbukkit.v1_16_R3.entity.CraftEntity) CraftLivingEntity(org.bukkit.craftbukkit.v1_16_R3.entity.CraftLivingEntity) Vec3D(net.minecraft.server.v1_16_R3.Vec3D)

Aggregations

LivingEntity (org.bukkit.entity.LivingEntity)2 Entity (net.minecraft.server.v1_16_R2.Entity)1 EntityLiving (net.minecraft.server.v1_16_R2.EntityLiving)1 GroupDataEntity (net.minecraft.server.v1_16_R2.GroupDataEntity)1 RayTrace (net.minecraft.server.v1_16_R2.RayTrace)1 TileEntity (net.minecraft.server.v1_16_R2.TileEntity)1 Vec3D (net.minecraft.server.v1_16_R2.Vec3D)1 Entity (net.minecraft.server.v1_16_R3.Entity)1 EntityLiving (net.minecraft.server.v1_16_R3.EntityLiving)1 GroupDataEntity (net.minecraft.server.v1_16_R3.GroupDataEntity)1 RayTrace (net.minecraft.server.v1_16_R3.RayTrace)1 TileEntity (net.minecraft.server.v1_16_R3.TileEntity)1 Vec3D (net.minecraft.server.v1_16_R3.Vec3D)1 CraftEntity (org.bukkit.craftbukkit.v1_16_R2.entity.CraftEntity)1 CraftLivingEntity (org.bukkit.craftbukkit.v1_16_R2.entity.CraftLivingEntity)1 CraftEntity (org.bukkit.craftbukkit.v1_16_R3.entity.CraftEntity)1 CraftLivingEntity (org.bukkit.craftbukkit.v1_16_R3.entity.CraftLivingEntity)1