use of net.minecraft.server.v1_14_R1.AxisAlignedBB in project MechanicsMain by WeaponMechanics.
the class v1_16_R3 method getHitBox.
@Override
public HitBox getHitBox(Block block) {
if (block.isEmpty() || block.isLiquid() || block.isPassable())
return null;
BoundingBox boundingBox = block.getBoundingBox();
HitBox hitBox = new HitBox(boundingBox.getMinX(), boundingBox.getMinY(), boundingBox.getMinZ(), boundingBox.getMaxX(), boundingBox.getMaxY(), boundingBox.getMaxZ());
hitBox.setBlockHitBox(block);
if (WeaponMechanics.getBasicConfigurations().getBool("Check_Accurate_Hitboxes", true)) {
CraftBlock craftBlock = (CraftBlock) block;
List<AxisAlignedBB> voxelShape = craftBlock.getNMS().getCollisionShape(craftBlock.getCraftWorld().getHandle(), craftBlock.getPosition()).d();
if (voxelShape.size() > 1) {
int x = block.getX();
int y = block.getY();
int z = block.getZ();
for (AxisAlignedBB boxPart : voxelShape) {
hitBox.addVoxelShapePart(new HitBox(x + boxPart.minX, y + boxPart.minY, z + boxPart.minZ, x + boxPart.maxX, y + boxPart.maxY, z + boxPart.maxZ));
}
}
}
return hitBox;
}
use of net.minecraft.server.v1_14_R1.AxisAlignedBB in project MechanicsMain by WeaponMechanics.
the class v1_12_R1 method getHitBox.
@Override
public HitBox getHitBox(org.bukkit.entity.Entity entity) {
if (entity.isInvulnerable() || !entity.getType().isAlive() || entity.isDead())
return null;
AxisAlignedBB aabb = ((CraftEntity) entity).getHandle().getBoundingBox();
HitBox hitBox = new HitBox(aabb.a, aabb.b, aabb.c, aabb.d, aabb.e, aabb.f);
hitBox.setLivingEntity((LivingEntity) entity);
if (entity instanceof ComplexLivingEntity && WeaponMechanics.getBasicConfigurations().getBool("Check_Accurate_Hitboxes", true)) {
for (ComplexEntityPart entityPart : ((ComplexLivingEntity) entity).getParts()) {
AxisAlignedBB boxPart = ((CraftEntity) entityPart).getHandle().getBoundingBox();
hitBox.addVoxelShapePart(new HitBox(boxPart.a, boxPart.b, boxPart.c, boxPart.d, boxPart.e, boxPart.f));
}
}
return hitBox;
}
use of net.minecraft.server.v1_14_R1.AxisAlignedBB in project Citizens2 by CitizensDev.
the class NMSImpl method setSize.
public static void setSize(Entity entity, float f, float f1, boolean justCreated) {
if ((f != entity.width) || (f1 != entity.length)) {
float f2 = entity.width;
entity.width = f;
entity.length = f1;
entity.a(new AxisAlignedBB(entity.getBoundingBox().a, entity.getBoundingBox().b, entity.getBoundingBox().c, entity.getBoundingBox().a + entity.width, entity.getBoundingBox().b + entity.length, entity.getBoundingBox().c + entity.width));
if ((entity.width > f2) && (!justCreated) && (!entity.world.isClientSide))
entity.move((f2 - entity.width) / 2, 0.0D, (f2 - entity.width) / 2);
}
}
use of net.minecraft.server.v1_14_R1.AxisAlignedBB in project Citizens2 by CitizensDev.
the class PlayerPathfinderNormal method a.
@Override
public PathType a(IBlockAccess paramIBlockAccess, int paramInt1, int paramInt2, int paramInt3, EntityHumanNPC paramEntityInsentient, int paramInt4, int paramInt5, int paramInt6, boolean paramBoolean1, boolean paramBoolean2) {
EnumSet<PathType> localEnumSet = EnumSet.noneOf(PathType.class);
Object localObject1 = PathType.BLOCKED;
double d = paramEntityInsentient.width / 2.0D;
BlockPosition localBlockPosition = new BlockPosition(paramEntityInsentient);
for (int i = paramInt1; i < paramInt1 + paramInt4; i++) {
for (int k = paramInt2; k < paramInt2 + paramInt5; k++) {
for (int m = paramInt3; m < paramInt3 + paramInt6; m++) {
PathType localPathType2 = a(paramIBlockAccess, i, k, m);
if ((localPathType2 == PathType.DOOR_WOOD_CLOSED) && (paramBoolean1) && (paramBoolean2)) {
localPathType2 = PathType.WALKABLE;
}
if ((localPathType2 == PathType.DOOR_OPEN) && (!paramBoolean2)) {
localPathType2 = PathType.BLOCKED;
}
if ((localPathType2 == PathType.RAIL) && (!(paramIBlockAccess.getType(localBlockPosition).getBlock() instanceof BlockMinecartTrackAbstract)) && (!(paramIBlockAccess.getType(localBlockPosition.down()).getBlock() instanceof BlockMinecartTrackAbstract))) {
localPathType2 = PathType.FENCE;
}
if ((i == paramInt1) && (k == paramInt2) && (m == paramInt3)) {
localObject1 = localPathType2;
}
if ((k > paramInt2) && (localPathType2 != PathType.OPEN)) {
AxisAlignedBB localAxisAlignedBB = new AxisAlignedBB(i - d + 0.5D, paramInt2 + 0.001D, m - d + 0.5D, i + d + 0.5D, paramInt2 + paramEntityInsentient.length, m + d + 0.5D);
if (!paramEntityInsentient.world.b(localAxisAlignedBB)) {
localPathType2 = PathType.OPEN;
}
}
localEnumSet.add(localPathType2);
}
}
}
if (localEnumSet.contains(PathType.FENCE)) {
return PathType.FENCE;
}
Object localObject2 = PathType.BLOCKED;
for (PathType localPathType1 : localEnumSet) {
if (paramEntityInsentient.a(localPathType1) < 0.0F) {
return localPathType1;
}
if (paramEntityInsentient.a(localPathType1) >= paramEntityInsentient.a((PathType) localObject2)) {
localObject2 = localPathType1;
}
}
if ((localObject1 == PathType.OPEN) && (paramEntityInsentient.a((PathType) localObject2) == 0.0F)) {
return PathType.OPEN;
}
return (PathType) localObject2;
}
use of net.minecraft.server.v1_14_R1.AxisAlignedBB in project Citizens2 by CitizensDev.
the class PlayerPathfinderNormal method a.
@Override
public PathType a(IBlockAccess paramIBlockAccess, int paramInt1, int paramInt2, int paramInt3, EntityInsentient paramEntityInsentient, int paramInt4, int paramInt5, int paramInt6, boolean paramBoolean1, boolean paramBoolean2) {
EnumSet<PathType> localEnumSet = EnumSet.noneOf(PathType.class);
Object localObject1 = PathType.BLOCKED;
double d = paramEntityInsentient.width / 2.0D;
BlockPosition localBlockPosition = new BlockPosition(paramEntityInsentient);
for (int i = paramInt1; i < paramInt1 + paramInt4; i++) {
for (int k = paramInt2; k < paramInt2 + paramInt5; k++) {
for (int m = paramInt3; m < paramInt3 + paramInt6; m++) {
PathType localPathType2 = a(paramIBlockAccess, i, k, m);
if ((localPathType2 == PathType.DOOR_WOOD_CLOSED) && (paramBoolean1) && (paramBoolean2)) {
localPathType2 = PathType.WALKABLE;
}
if ((localPathType2 == PathType.DOOR_OPEN) && (!paramBoolean2)) {
localPathType2 = PathType.BLOCKED;
}
if ((localPathType2 == PathType.RAIL) && (!(paramIBlockAccess.getType(localBlockPosition).getBlock() instanceof BlockMinecartTrackAbstract)) && (!(paramIBlockAccess.getType(localBlockPosition.down()).getBlock() instanceof BlockMinecartTrackAbstract))) {
localPathType2 = PathType.FENCE;
}
if ((i == paramInt1) && (k == paramInt2) && (m == paramInt3)) {
localObject1 = localPathType2;
}
if ((k > paramInt2) && (localPathType2 != PathType.OPEN)) {
AxisAlignedBB localAxisAlignedBB = new AxisAlignedBB(i - d + 0.5D, paramInt2 + 0.001D, m - d + 0.5D, i + d + 0.5D, paramInt2 + paramEntityInsentient.length, m + d + 0.5D);
if (!paramEntityInsentient.world.b(localAxisAlignedBB)) {
localPathType2 = PathType.OPEN;
}
}
localEnumSet.add(localPathType2);
}
}
}
if (localEnumSet.contains(PathType.FENCE)) {
return PathType.FENCE;
}
Object localObject2 = PathType.BLOCKED;
for (PathType localPathType1 : localEnumSet) {
if (paramEntityInsentient.a(localPathType1) < 0.0F) {
return localPathType1;
}
if (paramEntityInsentient.a(localPathType1) >= paramEntityInsentient.a((PathType) localObject2)) {
localObject2 = localPathType1;
}
}
if ((localObject1 == PathType.OPEN) && (paramEntityInsentient.a((PathType) localObject2) == 0.0F)) {
return PathType.OPEN;
}
return (PathType) localObject2;
}
Aggregations