本文整理汇总了Java中net.minecraft.util.math.AxisAlignedBB.intersects方法的典型用法代码示例。如果您正苦于以下问题:Java AxisAlignedBB.intersects方法的具体用法?Java AxisAlignedBB.intersects怎么用?Java AxisAlignedBB.intersects使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.util.math.AxisAlignedBB
的用法示例。
在下文中一共展示了AxisAlignedBB.intersects方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: rayTraceEntities
import net.minecraft.util.math.AxisAlignedBB; //导入方法依赖的package包/类
public static <T extends Entity>List<T> rayTraceEntities(World w, Vec3d pos, Vec3d ray, Optional<Predicate<T>> entityFilter, Class<T> entityClazz)
{
AxisAlignedBB aabb = new AxisAlignedBB(pos, pos.add(new Vec3d(1, 1, 1))).expand(ray.x, ray.y, ray.z);
Vec3d checkVec = pos.add(ray);
List<T> ret = Lists.newArrayList();
for (T t : w.getEntitiesWithinAABB(entityClazz, aabb, entityFilter.orElse(Predicates.alwaysTrue())))
{
AxisAlignedBB entityBB = t.getEntityBoundingBox();
if (entityBB == null)
{
continue;
}
if (entityBB.intersects(pos, checkVec))
{
ret.add(t);
}
}
return ret;
}
示例2: genCubes
import net.minecraft.util.math.AxisAlignedBB; //导入方法依赖的package包/类
private void genCubes(World world, BlockPos pos) {
//Gen Cube
BlockPos origin = pos.add(5, 0, 5);
Template template = Structure.ASHEN_CUBE.load(world);
boolean loot = GEN_CONFIG.ASHEN_CUBE_STRUCTURE.loot / 100D > random.nextDouble();
PlacementSettings integrity = new PlacementSettings();
integrity.setIntegrity(loot ? 1F : 0.35F + 0.45F * random.nextFloat());
template.addBlocksToWorld(world, origin, integrity);
integrity.setIntegrity(!loot && random.nextFloat() > 0.45F ? 1F : random.nextFloat());
Structure.ASHEN_CUBE_.generate(world, origin, integrity);
//Add loot
for (int i = 0; i < 6 + random.nextInt(6); i++) {
loot = GEN_CONFIG.MONOLITH_CONFIG.MONOLITH_STRUCTURE.loot / 100D > random.nextDouble();
if (loot) {
BlockPos inside = origin.add(1 + random.nextInt(4), 1, 1 + random.nextInt(4));
IBlockState pot = ModBlocks.LARGE_POT.getDefaultState().withProperty(State.POT_VARIANT, random.nextInt(3));
world.setBlockState(inside, pot);
}
}
//Gen Cubes
AxisAlignedBB cubeBB = new AxisAlignedBB(origin, origin.add(template.getSize()));
for(int i = 0; i < GEN_CONFIG.ASHEN_CUBE_STRUCTURE.size; i++) {
Template cube = nuggets.next().load(world);
Rotation rotation = Rotation.values()[random.nextInt(4)];
Vector3 vec = Vector3.create(cube.getSize()).rotate(rotation);
BlockPos offset = randomVector().add(pos).toBlockPos();
if(offset.getY() < 1 || (world.canSeeSky(offset) && GEN_CONFIG.ASHEN_CUBE_STRUCTURE.underground)) continue;
AxisAlignedBB nuggetBB = new AxisAlignedBB(offset, vec.add(offset).toBlockPos());
if(!nuggetBB.intersects(cubeBB)) {
PlacementSettings settings = new PlacementSettings();
settings.setIntegrity(random.nextFloat() > 0.85F ? 0.9F : 0.35F + 0.45F * random.nextFloat());
settings.setRotation(rotation);
settings.setRandom(random);
cube.addBlocksToWorld(world, offset, settings);
}
}
}