use of net.minecraft.server.v1_13_R2.AxisAlignedBB in project Citizens2 by CitizensDev.
the class NMSImpl method setSize.
public static void setSize(Entity entity, boolean justCreated) {
try {
EntitySize entitysize = (EntitySize) SIZE_FIELD_GETTER.invoke(entity);
EntityPose entitypose = entity.getPose();
EntitySize entitysize1 = entity.a(entitypose);
SIZE_FIELD_SETTER.invoke(entity, entitysize1);
HEAD_HEIGHT.invoke(entity, HEAD_HEIGHT_METHOD.invoke(entity, entitypose, entitysize1));
if (entitysize1.width < entitysize.width && false) /* TODO: PREVIOUS CITIZENS ADDITION ?reason */
{
double d0 = entitysize1.width / 2.0D;
entity.a(new AxisAlignedBB(entity.locX() - d0, entity.locY(), entity.locZ() - d0, entity.locX() + d0, entity.locY() + entitysize1.height, entity.locZ() + d0));
} else {
AxisAlignedBB axisalignedbb = entity.getBoundingBox();
entity.a(new AxisAlignedBB(axisalignedbb.minX, axisalignedbb.minY, axisalignedbb.minZ, axisalignedbb.minX + entitysize1.width, axisalignedbb.minY + entitysize1.height, axisalignedbb.minZ + entitysize1.width));
if (entitysize1.width > entitysize.width && !justCreated && !entity.world.isClientSide) {
float f = entitysize.width - entitysize1.width;
entity.move(EnumMoveType.SELF, new Vec3D(f, 0.0D, f));
}
}
} catch (Throwable e) {
e.printStackTrace();
}
}
use of net.minecraft.server.v1_13_R2.AxisAlignedBB in project Citizens2 by CitizensDev.
the class NMSImpl method getCollisionBox.
@Override
public BoundingBox getCollisionBox(org.bukkit.block.Block block) {
WorldServer world = ((CraftWorld) block.getWorld()).getHandle();
BlockPosition pos = new BlockPosition(block.getX(), block.getY(), block.getZ());
AxisAlignedBB aabb = world.getType(pos).c(world, pos);
if (aabb == null) {
aabb = world.getType(pos).d(world, pos);
}
return new BoundingBox(aabb.a, aabb.b, aabb.c, aabb.d, aabb.e, aabb.f);
}
use of net.minecraft.server.v1_13_R2.AxisAlignedBB in project Citizens2 by CitizensDev.
the class PlayerPathfinderNormal method a.
private PathPoint a(int paramInt1, int paramInt2, int paramInt3, int paramInt4, double paramDouble, EnumDirection paramEnumDirection) {
PathPoint localPathPoint = null;
BlockPosition localBlockPosition1 = new BlockPosition(paramInt1, paramInt2, paramInt3);
BlockPosition localBlockPosition2 = localBlockPosition1.down();
double d1 = paramInt2 - (1.0D - this.a.getType(localBlockPosition2).d(this.a, localBlockPosition2).e);
if (d1 - paramDouble > 1.125D) {
return null;
}
PathType localPathType1 = a(this.b, paramInt1, paramInt2, paramInt3);
float f = this.b.a(localPathType1);
double d2 = this.b.width / 2.0D;
if (f >= 0.0F) {
localPathPoint = a(paramInt1, paramInt2, paramInt3);
localPathPoint.m = localPathType1;
localPathPoint.l = Math.max(localPathPoint.l, f);
}
if (localPathType1 == PathType.WALKABLE) {
return localPathPoint;
}
if ((localPathPoint == null) && (paramInt4 > 0) && (localPathType1 != PathType.FENCE) && (localPathType1 != PathType.TRAPDOOR)) {
localPathPoint = a(paramInt1, paramInt2 + 1, paramInt3, paramInt4 - 1, paramDouble, paramEnumDirection);
if ((localPathPoint != null) && ((localPathPoint.m == PathType.OPEN) || (localPathPoint.m == PathType.WALKABLE)) && (this.b.width < 1.0F)) {
double d3 = paramInt1 - paramEnumDirection.getAdjacentX() + 0.5D;
double d4 = paramInt3 - paramEnumDirection.getAdjacentZ() + 0.5D;
AxisAlignedBB localAxisAlignedBB1 = new AxisAlignedBB(d3 - d2, paramInt2 + 0.001D, d4 - d2, d3 + d2, paramInt2 + this.b.length, d4 + d2);
AxisAlignedBB localAxisAlignedBB2 = this.a.getType(localBlockPosition1).d(this.a, localBlockPosition1);
AxisAlignedBB localAxisAlignedBB3 = localAxisAlignedBB1.b(0.0D, localAxisAlignedBB2.e - 0.002D, 0.0D);
if (this.b.world.b(localAxisAlignedBB3)) {
localPathPoint = null;
}
}
}
if (localPathType1 == PathType.OPEN) {
AxisAlignedBB localAxisAlignedBB4 = new AxisAlignedBB(paramInt1 - d2 + 0.5D, paramInt2 + 0.001D, paramInt3 - d2 + 0.5D, paramInt1 + d2 + 0.5D, paramInt2 + this.b.length, paramInt3 + d2 + 0.5D);
if (this.b.world.b(localAxisAlignedBB4)) {
return null;
}
if (this.b.width >= 1.0F) {
PathType localPathType2 = a(this.b, paramInt1, paramInt2 - 1, paramInt3);
if (localPathType2 == PathType.BLOCKED) {
localPathPoint = a(paramInt1, paramInt2, paramInt3);
localPathPoint.m = PathType.WALKABLE;
localPathPoint.l = Math.max(localPathPoint.l, f);
return localPathPoint;
}
}
int i = 0;
while ((paramInt2 > 0) && (localPathType1 == PathType.OPEN)) {
paramInt2--;
if (i++ >= Setting.MC_NAVIGATION_MAX_FALL_DISTANCE.asInt()) {
return null;
}
localPathType1 = a(this.b, paramInt1, paramInt2, paramInt3);
f = this.b.a(localPathType1);
if ((localPathType1 != PathType.OPEN) && (f >= 0.0F)) {
localPathPoint = a(paramInt1, paramInt2, paramInt3);
localPathPoint.m = localPathType1;
localPathPoint.l = Math.max(localPathPoint.l, f);
} else if (f < 0.0F) {
return null;
}
}
}
return localPathPoint;
}
use of net.minecraft.server.v1_13_R2.AxisAlignedBB in project Citizens2 by CitizensDev.
the class PlayerPathfinderNormal method a.
private PathPoint a(int var0, int var1, int var2, int var3, double var4, EnumDirection var6) {
PathPoint var7 = null;
BlockPosition var8 = new BlockPosition(var0, var1, var2);
double var9 = a(this.a, var8);
if (var9 - var4 > 1.125D) {
return null;
} else {
PathType var11 = this.a(this.b, var0, var1, var2);
float var12 = this.b.a(var11);
double var13 = this.b.getWidth() / 2.0D;
if (var12 >= 0.0F) {
var7 = this.a(var0, var1, var2);
var7.l = var11;
var7.k = Math.max(var7.k, var12);
}
if (var11 == PathType.WALKABLE) {
return var7;
} else {
if ((var7 == null || var7.k < 0.0F) && var3 > 0 && var11 != PathType.FENCE && var11 != PathType.TRAPDOOR) {
var7 = this.a(var0, var1 + 1, var2, var3 - 1, var4, var6);
if (var7 != null && (var7.l == PathType.OPEN || var7.l == PathType.WALKABLE) && this.b.getWidth() < 1.0F) {
double var15 = var0 - var6.getAdjacentX() + 0.5D;
double var17 = var2 - var6.getAdjacentZ() + 0.5D;
AxisAlignedBB var19 = new AxisAlignedBB(var15 - var13, a(this.a, (new BlockPosition(var15, var1 + 1, var17))) + 0.001D, var17 - var13, var15 + var13, this.b.getHeight() + a(this.a, (new BlockPosition(var7.a, var7.b, var7.c))) - 0.002D, var17 + var13);
if (!this.a.getCubes(this.b, var19)) {
var7 = null;
}
}
}
if (var11 == PathType.WATER && !this.e()) {
if (this.a(this.b, var0, var1 - 1, var2) != PathType.WATER) {
return var7;
}
while (var1 > 0) {
--var1;
var11 = this.a(this.b, var0, var1, var2);
if (var11 != PathType.WATER) {
return var7;
}
var7 = this.a(var0, var1, var2);
var7.l = var11;
var7.k = Math.max(var7.k, this.b.a(var11));
}
}
if (var11 == PathType.OPEN) {
AxisAlignedBB var15 = new AxisAlignedBB(var0 - var13 + 0.5D, var1 + 0.001D, var2 - var13 + 0.5D, var0 + var13 + 0.5D, var1 + this.b.getHeight(), var2 + var13 + 0.5D);
if (!this.a.getCubes(this.b, var15)) {
return null;
}
if (this.b.getWidth() >= 1.0F) {
PathType var16 = this.a(this.b, var0, var1 - 1, var2);
if (var16 == PathType.BLOCKED) {
var7 = this.a(var0, var1, var2);
var7.l = PathType.WALKABLE;
var7.k = Math.max(var7.k, var12);
return var7;
}
}
int var16 = 0;
int var17 = var1;
while (var11 == PathType.OPEN) {
--var1;
PathPoint var18;
if (var1 < 0) {
var18 = this.a(var0, var17, var2);
var18.l = PathType.BLOCKED;
var18.k = -1.0F;
return var18;
}
var18 = this.a(var0, var1, var2);
if (var16++ >= Setting.MC_NAVIGATION_MAX_FALL_DISTANCE.asInt()) {
var18.l = PathType.BLOCKED;
var18.k = -1.0F;
return var18;
}
var11 = this.a(this.b, var0, var1, var2);
var12 = this.b.a(var11);
if (var11 != PathType.OPEN && var12 >= 0.0F) {
var7 = var18;
var18.l = var11;
var18.k = Math.max(var18.k, var12);
break;
}
if (var12 < 0.0F) {
var18.l = PathType.BLOCKED;
var18.k = -1.0F;
return var18;
}
}
}
return var7;
}
}
}
use of net.minecraft.server.v1_13_R2.AxisAlignedBB in project Citizens2 by CitizensDev.
the class NMSImpl method getCollisionBox.
@Override
public BoundingBox getCollisionBox(org.bukkit.block.Block block) {
WorldServer world = ((CraftWorld) block.getWorld()).getHandle();
Block type = CraftMagicNumbers.getBlock(block);
BlockPosition pos = new BlockPosition(block.getX(), block.getY(), block.getZ());
AxisAlignedBB aabb = type.a(world, pos, world.getType(pos));
return aabb == null ? BoundingBox.EMPTY : new BoundingBox(aabb.a, aabb.b, aabb.c, aabb.d, aabb.e, aabb.f);
}
Aggregations