net.minecraft.block.Block.onEntityCollidedWithBlock()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(2.6k)|赞(0)|评价(0)|浏览(145)

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

Block.onEntityCollidedWithBlock介绍

暂无

代码示例

代码示例来源:origin: RS485/LogisticsPipes

@Override
@ModDependentMethod(modId = LPConstants.mcmpModID)
public void onEntityCollidedWithBlock(World world, BlockPos pos, IBlockState state, Entity entity) {
  Block block = mcmpBlockAccess.getBlock();
  if (block != null) {
    block.onEntityCollidedWithBlock(world, pos, state, entity);
  } else {
    super.onEntityCollidedWithBlock(world, pos, state, entity);
  }
}

代码示例来源:origin: amadornes/MCMultiPart

public default void onEntityCollidedWithPart(IPartInfo part, Entity entity) {
  part.getState().getBlock().onEntityCollidedWithBlock(part.getPartWorld(), part.getPartPos(), part.getState(), entity);
}

代码示例来源:origin: CoFH/RedstoneArsenal

this.inTile.onEntityCollidedWithBlock(this.world, blockpos, iblockstate, this);

代码示例来源:origin: P3pp3rF1y/AncientWarfare2

@Override
protected void doBlockCollisions() {
  AxisAlignedBB axisalignedbb = this.getEntityBoundingBox();
  BlockPos.PooledMutableBlockPos posMin = BlockPos.PooledMutableBlockPos.retain(axisalignedbb.minX + 0.001D, axisalignedbb.minY + 0.001D, axisalignedbb.minZ + 0.001D);
  BlockPos.PooledMutableBlockPos posMax = BlockPos.PooledMutableBlockPos.retain(axisalignedbb.maxX - 0.001D, axisalignedbb.maxY - 0.001D, axisalignedbb.maxZ - 0.001D);
  BlockPos.PooledMutableBlockPos currentPos = BlockPos.PooledMutableBlockPos.retain();
  if (world.isAreaLoaded(posMin, posMax)) {
    for (int i = posMin.getX(); i <= posMax.getX(); ++i) {
      for (int j = posMin.getY(); j <= posMax.getY(); ++j) {
        for (int k = posMin.getZ(); k <= posMax.getZ(); ++k) {
          currentPos.setPos(i, j, k);
          IBlockState iblockstate = world.getBlockState(currentPos);
          try {
            iblockstate.getBlock().onEntityCollidedWithBlock(world, currentPos, iblockstate, this);
            onInsideBlock(iblockstate, currentPos);
          }
          catch (Throwable throwable) {
            CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Colliding entity with block");
            CrashReportCategory crashreportcategory = crashreport.makeCategory("Block being collided with");
            CrashReportCategory.addBlockInfo(crashreportcategory, currentPos, iblockstate);
            throw new ReportedException(crashreport);
          }
        }
      }
    }
  }
  posMin.release();
  posMax.release();
  currentPos.release();
}

代码示例来源:origin: MatterOverdrive/MatterOverdrive-Legacy-Edition

this.blockState.getBlock().onEntityCollidedWithBlock(this.world, blockPos, this.blockState, this);
if (this.blockState instanceof BlockTNT) {
  world.setBlockToAir(blockPos);

相关文章

Block类方法