Search in sources :

Example 51 with Vec3D

use of net.minecraft.server.v1_16_R3.Vec3D in project Citizens2 by CitizensDev.

the class PlayerNavigation method a.

@Override
protected void a(Vec3D paramVec3D) {
    if (this.e - this.j > 100) {
        if (paramVec3D.distanceSquared(this.k) < 2.25D) {
            p();
        }
        this.j = this.e;
        this.k = paramVec3D;
    }
    if ((this.c != null) && (!this.c.b())) {
        Vec3D localVec3D = this.c.f();
        if (localVec3D.equals(this.l)) {
            this.m += System.currentTimeMillis() - this.n;
        } else {
            this.l = localVec3D;
            double d1 = paramVec3D.f(this.l);
            this.o = (this.a.cy() > 0.0F ? d1 / this.a.cy() * 1000.0D : 0.0D);
        }
        if ((this.o > 0.0D) && (this.m > this.o * 3.0D)) {
            this.l = Vec3D.a;
            this.m = 0L;
            this.o = 0.0D;
            p();
        }
        this.n = System.currentTimeMillis();
    }
}
Also used : Vec3D(net.minecraft.server.v1_12_R1.Vec3D)

Example 52 with Vec3D

use of net.minecraft.server.v1_16_R3.Vec3D in project Citizens2 by CitizensDev.

the class PlayerNavigation method d.

@Override
public void d() {
    this.e += 1;
    if (this.g) {
        k();
    }
    if (o()) {
        return;
    }
    if (b()) {
        n();
    } else if ((this.c != null) && (this.c.e() < this.c.d())) {
        Vec3D localVec3D = c();
        Vec3D localObject = this.c.a(this.a, this.c.e());
        if ((localVec3D.y > localObject.y) && (!this.a.onGround) && (MathHelper.floor(localVec3D.x) == MathHelper.floor(localObject.x)) && (MathHelper.floor(localVec3D.z) == MathHelper.floor(localObject.z))) {
            this.c.c(this.c.e() + 1);
        }
    }
    m();
    if (o()) {
        return;
    }
    Vec3D localVec3D = this.c.a(this.a);
    Object localObject = new BlockPosition(localVec3D).down();
    AxisAlignedBB localAxisAlignedBB = this.b.getType((BlockPosition) localObject).e(this.b, (BlockPosition) localObject);
    localVec3D = localVec3D.a(0.0D, 1.0D - localAxisAlignedBB.e, 0.0D);
    this.a.getControllerMove().a(localVec3D.x, localVec3D.y, localVec3D.z, this.d);
}
Also used : AxisAlignedBB(net.minecraft.server.v1_12_R1.AxisAlignedBB) BlockPosition(net.minecraft.server.v1_12_R1.BlockPosition) Vec3D(net.minecraft.server.v1_12_R1.Vec3D)

Example 53 with Vec3D

use of net.minecraft.server.v1_16_R3.Vec3D in project Citizens2 by CitizensDev.

the class EntityHumanNPC method moveOnCurrentHeading.

private void moveOnCurrentHeading() {
    if (jumping) {
        if (onGround && jumpTicks == 0) {
            jump();
            jumpTicks = 10;
        }
    } else {
        jumpTicks = 0;
    }
    bb *= 0.98F;
    bd *= 0.98F;
    be *= 0.9F;
    // movement method
    moveWithFallDamage(new Vec3D(this.bb, this.bc, this.bd));
    NMS.setHeadYaw(getBukkitEntity(), yaw);
    if (jumpTicks > 0) {
        jumpTicks--;
    }
}
Also used : Vec3D(net.minecraft.server.v1_14_R1.Vec3D)

Example 54 with Vec3D

use of net.minecraft.server.v1_16_R3.Vec3D 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 55 with Vec3D

use of net.minecraft.server.v1_16_R3.Vec3D 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

Vec3D (net.minecraft.server.v1_16_R3.Vec3D)11 Vec3D (net.minecraft.server.v1_15_R1.Vec3D)10 Vec3D (net.minecraft.server.v1_14_R1.Vec3D)9 Vec3D (net.minecraft.server.v1_12_R1.Vec3D)7 Vec3D (net.minecraft.server.v1_10_R1.Vec3D)5 Vec3D (net.minecraft.server.v1_11_R1.Vec3D)5 BaseBlockPosition (net.minecraft.server.v1_16_R3.BaseBlockPosition)4 Vec3D (net.minecraft.server.v1_8_R3.Vec3D)4 Gravity (net.citizensnpcs.trait.Gravity)3 PathPoint (net.minecraft.server.v1_16_R3.PathPoint)3 BlockPosition (net.minecraft.server.v1_10_R1.BlockPosition)2 BlockPosition (net.minecraft.server.v1_11_R1.BlockPosition)2 AxisAlignedBB (net.minecraft.server.v1_12_R1.AxisAlignedBB)2 BlockPosition (net.minecraft.server.v1_12_R1.BlockPosition)2 MovingObjectPosition (net.minecraft.server.v1_12_R1.MovingObjectPosition)2 AxisAlignedBB (net.minecraft.server.v1_16_R3.AxisAlignedBB)2 BlockPosition (net.minecraft.server.v1_16_R3.BlockPosition)2 AxisAlignedBB (net.minecraft.server.v1_8_R3.AxisAlignedBB)2 LivingEntity (org.bukkit.entity.LivingEntity)2 Warlords (com.ebicep.warlords.Warlords)1