本文整理了Java中net.minecraft.entity.Entity.getCollisionBoundingBox()
方法的一些代码示例,展示了Entity.getCollisionBoundingBox()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Entity.getCollisionBoundingBox()
方法的具体详情如下:
包路径:net.minecraft.entity.Entity
类名称:Entity
方法名:getCollisionBoundingBox
暂无
代码示例来源:origin: TeamWizardry/Wizardry
public static void run(World world, BlockPos pos, Block block, Entity entity, Predicate<Entity> test, Consumer<Entity> process) {
if (!(block instanceof IFluidBlock)) return;
float height;
IBlockState up = world.getBlockState(pos.up());
if (up.getMaterial().isLiquid() || up.getBlock() instanceof IFluidBlock)
height = 1f;
else
height = ((IFluidBlock) block).getFilledPercentage(world, pos) * 0.875f;
AxisAlignedBB bb = new AxisAlignedBB(pos).contract(0, 1 - height, 0);
AxisAlignedBB entityBox = entity.getCollisionBoundingBox();
if ((entityBox == null || entityBox.intersects(bb))
&& test.test(entity)) process.accept(entity);
}
}
代码示例来源:origin: amadornes/MCMultiPart
@Override
public void onEntityCollidedWithBlock(World world, BlockPos pos, IBlockState state, Entity entity) {
forEach(world, pos, it -> {
List<AxisAlignedBB> boxes = new ArrayList<>();
AxisAlignedBB bb = entity.getCollisionBoundingBox();
if (bb != null)
it.getPart().addCollisionBoxToList(it, bb.grow(0.001), boxes, entity, false);
bb = entity.getEntityBoundingBox();
it.getPart().addCollisionBoxToList(it, bb.grow(0.001), boxes, entity, false);
if (!boxes.isEmpty())
it.getPart().onEntityCollidedWithPart(it, entity);
});
}
代码示例来源:origin: AlgorithmX2/Chisels-and-Bits
AxisAlignedBB what = entity.getCollisionBoundingBox();
内容来源于网络,如有侵权,请联系作者删除!