net.minecraft.entity.Entity.getCollisionBoundingBox()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(1.6k)|赞(0)|评价(0)|浏览(139)

本文整理了Java中net.minecraft.entity.Entity.getCollisionBoundingBox()方法的一些代码示例,展示了Entity.getCollisionBoundingBox()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Entity.getCollisionBoundingBox()方法的具体详情如下:
包路径:net.minecraft.entity.Entity
类名称:Entity
方法名:getCollisionBoundingBox

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();

相关文章

Entity类方法