net.minecraft.world.chunk.Chunk.getBlockState()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(5.8k)|赞(0)|评价(0)|浏览(165)

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

Chunk.getBlockState介绍

暂无

代码示例

代码示例来源:origin: EngineHub/WorldEdit

IBlockState old = chunk.getBlockState(pos);
Block mcBlock = Block.getBlockFromName(block.getBlockType().getId());
IBlockState newState = mcBlock.getDefaultState();

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

@Override
public Block getBlock( final int x, final int y, final int z )
{
  if( this.range( x, y, z ) )
  {
    return this.target.getBlockState( x, y, z ).getBlock();
  }
  return Platform.AIR_BLOCK;
}

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

final Block blk = c.getBlockState( i, k, j ).getBlock();
if( blk == skyStoneBlock )

代码示例来源:origin: thraaawn/CompactMachines

@Override
public IBlockState getBlockState(BlockPos pos) {
  pos = pos.add(0, 40, 0);
  return chunk.getBlockState(pos);
}

代码示例来源:origin: MCTCP/TerrainControl

@Override
public boolean isEmpty(int x, int y, int z) {
  Chunk chunk = this.getChunk(x, y, z);
  return chunk == null || chunk.getBlockState(x & 0xF, y, z & 0xF).getMaterial().equals(Material.AIR);
}

代码示例来源:origin: ValkyrienWarfare/Valkyrien-Warfare-Revamped

public IBlockState getBlockState(int x, int y, int z) {
  if (!hasChunkAt(x >> 4, z >> 4)) {
    return Blocks.AIR.getDefaultState();
  }
  Chunk chunkForPos = cachedChunks[(x >> 4) - minChunkX][(z >> 4) - minChunkZ];
  return chunkForPos.getBlockState(x, y, z);
}

代码示例来源:origin: lawremi/CustomOreGen

private int findSurfaceHeight(Chunk chunk, int x, int z) {
  int surfh = chunk.getHeightValue(x, z);
  while (surfh > 0 && !isSurfaceBlock(chunk.getBlockState(x, surfh, z))) 
  {
    surfh--;
  }
  return surfh;
}

代码示例来源:origin: ValkyrienWarfare/Valkyrien-Warfare-Revamped

public IBlockState getBlockState(BlockPos pos) {
  Chunk chunkForPos = cachedChunks[(pos.getX() >> 4) - minChunkX][(pos.getZ() >> 4) - minChunkZ];
  return chunkForPos.getBlockState(pos);
}

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

public static int getTopFilledHeight(Chunk chunk, int x, int z, boolean skippables) {
  int maxY = chunk.getTopFilledSegment() + 16;
  Block block;
  for (int y = maxY; y > 0; y--) {
    IBlockState state = chunk.getBlockState(new BlockPos(x, y, z));
    block = state.getBlock();
    if (block == Blocks.AIR || (skippables && AWStructureStatics.isSkippable(state))) {
      continue;
    }
    return y;
  }
  return -1;
}

代码示例来源:origin: AntiqueAtlasTeam/AntiqueAtlas

int y = chunk.getHeightValue(x, z);
if (y > 0) {
  Block topBlock = chunk.getBlockState(x, y-1, z).getBlock();
  Block topBlock2 = chunk.getBlockState(x, y, z).getBlock();

代码示例来源:origin: cabaletta/baritone

return cached.getBlockState(x, y, z);
return chunk.getBlockState(x, y, z);

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

private static int getTopFilledHeight(Chunk chunk, int x, int z) {
    int maxY = chunk.getTopFilledSegment() + 15;
    Block block;
    for (int y = maxY; y > 0; y--) {
      IBlockState state = chunk.getBlockState(new BlockPos(x, y, z));
      block = state.getBlock();
      if (AWStructureStatics.isSkippable(state)) {
        continue;
      }
      if (state.getMaterial().isLiquid()) {
        if (y >= 56) {
          continue;
        }// >=56 is fillable through underfill/border settings.  below that is too deep for a proper gradient on the border.
        return -1;//return invalid Y if liquid block is too low
      }
      if (!AWStructureStatics.isValidTargetBlock(state)) {
        AncientWarfareStructure.LOG.debug("rejecting town chunk for non-target block: " + block + " :: " + chunk.x + ":" + chunk.z);
        return -1;
      }
      return y;//if not skippable and is valid target block, return that y-level
    }
    return -1;
  }
}

代码示例来源:origin: AntiqueAtlasTeam/AntiqueAtlas

if (biomeID == hellID) {
  Block netherBlock = chunk.getBlockState(x, lavaSeaLevel, z).getBlock();
  if (netherBlock == Blocks.LAVA) {
    lavaOccurences += priorityLava;
  } else {
    netherBlock = chunk.getBlockState(x, airProbeLevel, z).getBlock();
    if (netherBlock == null || netherBlock == Blocks.AIR) {

代码示例来源:origin: JurassiCraftTeam/JurassiCraft2

if (delta <= 64) {
  int currentY = offset.getY();
  while (chunk.getBlockState(wireX, ++currentY, wireZ).getBlock() instanceof ElectricFenceWireBlock) {
    BlockPos wirePos = new BlockPos(wireX, currentY, wireZ);
    if (!wires.contains(wirePos)) {

代码示例来源:origin: Vazkii/Quark

private static BlockPos getTopLiquidBlock(World world, BlockPos pos) {
  Chunk chunk = world.getChunkFromBlockCoords(pos);
  BlockPos blockpos;
  BlockPos blockpos1;
  for(blockpos = new BlockPos(pos.getX(), chunk.getTopFilledSegment() + 16, pos.getZ()); blockpos.getY() >= 0; blockpos = blockpos1) {
    blockpos1 = blockpos.down();
    IBlockState state = chunk.getBlockState(blockpos1);
    if(state.getBlock() instanceof BlockLiquid)
      break;
  }
  return blockpos;
}

代码示例来源:origin: FTBTeam/FTB-Utilities

if (chunk.getBlockState(x, y, z).getMaterial() != Material.AIR)

代码示例来源:origin: AntiqueAtlasTeam/AntiqueAtlas

Block topBlock = chunk.getBlockState(x, top-1, z).getBlock();
  Block rootBlock = chunk.getBlockState(x, top, z).getBlock();
  if(rootBlock == Blocks.CHORUS_FLOWER || rootBlock == Blocks.CHORUS_PLANT) {
    plantOccurences++;

代码示例来源:origin: ForestryMC/ForestryMC

private int getFluidDepth(BlockPos pos) {
  Chunk chunk = world.getChunk(pos);
  int xx = pos.getX() & 15;
  int zz = pos.getZ() & 15;
  int depth = 0;
  for (int y = chunk.getTopFilledSegment() + 15; y > 0; --y) {
    IBlockState blockState = chunk.getBlockState(xx, y, zz);
    Block block = blockState.getBlock();
    if (blockState.getMaterial().isLiquid()) {
      depth++;
    } else if (!block.isAir(blockState, world, pos)) {
      break;
    }
  }
  return depth;
}

代码示例来源:origin: JurassiCraftTeam/JurassiCraft2

protected BlockPos getGround(World world, BlockPos pos) {
  Chunk chunk = world.getChunkFromBlockCoords(pos);
  BlockPos currentPos;
  BlockPos ground;
  for (currentPos = new BlockPos(pos.getX(), chunk.getHeight(pos), pos.getZ()); currentPos.getY() >= world.provider.getAverageGroundLevel() - 16; currentPos = ground) {
    ground = currentPos.down();
    IBlockState state = chunk.getBlockState(ground);
    Material material = state.getMaterial();
    if (material == Material.GROUND || material == Material.SAND || material == Material.GRASS || material == Material.ROCK|| material.isLiquid()) {
      break;
    }
  }
  return currentPos;
}

代码示例来源:origin: ValkyrienWarfare/Valkyrien-Warfare-Revamped

IBlockState inLocalState = chunkIn.getBlockState(x, y, z);

相关文章