use of net.minecraft.server.v1_13_R2.AxisAlignedBB in project WildChests by BG-Software-LLC.
the class NMSAdapter_v1_16_R3 method getNearbyItems.
@Override
public Stream<Item> getNearbyItems(Location location, int range, boolean onlyChunk, KeySet blacklisted, KeySet whitelisted) {
World world = ((CraftWorld) location.getWorld()).getHandle();
List<Entity> entityList = new ArrayList<>();
if (onlyChunk) {
Chunk chunk = ((CraftChunk) location.getChunk()).getHandle();
for (int i = 0; i < chunk.entitySlices.length; i++) entityList.addAll(chunk.entitySlices[i]);
entityList = entityList.stream().filter(entity -> entity instanceof EntityItem).collect(Collectors.toList());
} else {
AxisAlignedBB boundingBox = new AxisAlignedBB(location.getX() + range, location.getY() + range, location.getZ() + range, location.getX() - range, location.getY() - range, location.getZ() - range);
entityList = world.getEntities(null, boundingBox, entity -> entity instanceof EntityItem);
}
return entityList.stream().map(entity -> (Item) entity.getBukkitEntity()).filter(item -> !blacklisted.contains(item.getItemStack()) && (whitelisted.isEmpty() || whitelisted.contains(item.getItemStack())));
}
use of net.minecraft.server.v1_13_R2.AxisAlignedBB in project InteractionVisualizer by LOOHP.
the class V1_11 method getBoundingBoxes.
public List<BoundingBox> getBoundingBoxes(BlockPosition pos) {
net.minecraft.server.v1_11_R1.BlockPosition blockpos = new net.minecraft.server.v1_11_R1.BlockPosition(pos.getX(), pos.getY(), pos.getZ());
WorldServer world = ((CraftWorld) pos.getWorld()).getHandle();
AxisAlignedBB box = world.getType(blockpos).d(world, blockpos);
List<BoundingBox> boxes = new ArrayList<>(1);
boxes.add(new BoundingBox(box.a + pos.getX(), box.b + pos.getY(), box.c + pos.getZ(), box.d + pos.getX(), box.e + pos.getY(), box.f + pos.getZ()));
return boxes;
}
use of net.minecraft.server.v1_13_R2.AxisAlignedBB in project InteractionVisualizer by LOOHP.
the class V1_12 method getBoundingBoxes.
public List<BoundingBox> getBoundingBoxes(BlockPosition pos) {
net.minecraft.server.v1_12_R1.BlockPosition blockpos = new net.minecraft.server.v1_12_R1.BlockPosition(pos.getX(), pos.getY(), pos.getZ());
WorldServer world = ((CraftWorld) pos.getWorld()).getHandle();
AxisAlignedBB box = world.getType(blockpos).d(world, blockpos);
List<BoundingBox> boxes = new ArrayList<>(1);
boxes.add(new BoundingBox(box.a + pos.getX(), box.b + pos.getY(), box.c + pos.getZ(), box.d + pos.getX(), box.e + pos.getY(), box.f + pos.getZ()));
return boxes;
}
use of net.minecraft.server.v1_13_R2.AxisAlignedBB in project MechanicsMain by WeaponMechanics.
the class v1_9_R2 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_13_R2.AxisAlignedBB in project MechanicsMain by WeaponMechanics.
the class v1_11_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;
}
Aggregations