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

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

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

Chunk.getBlockStorageArray介绍

暂无

代码示例

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

private void fillData( final int y, BlockStorageData data )
{
  final ExtendedBlockStorage[] storage = this.c.getBlockStorageArray();
  final ExtendedBlockStorage extendedblockstorage = storage[y >> 4];
  data.state = extendedblockstorage.get( this.x, y & 15, this.z );
  data.light = extendedblockstorage.getBlockLight( this.x, y & 15, this.z );
}

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

private boolean doNotSkip( final int y )
{
  final ExtendedBlockStorage[] storage = this.c.getBlockStorageArray();
  final ExtendedBlockStorage extendedblockstorage = storage[y >> 4];
  if( CachedPlane.this.reg.isBlacklisted( extendedblockstorage.get( this.x, y & 15, this.z ).getBlock() ) )
  {
    return false;
  }
  return this.skipThese == null || !this.skipThese.contains( y );
}

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

private void setBlockIDWithMetadata( final int y, BlockStorageData data )
{
  if( data.state == CachedPlane.this.matrixBlockState )
  {
    data.state = Platform.AIR_BLOCK.getDefaultState();
  }
  final ExtendedBlockStorage[] storage = this.c.getBlockStorageArray();
  final ExtendedBlockStorage extendedBlockStorage = storage[y >> 4];
  extendedBlockStorage.set( this.x, y & 15, this.z, data.state );
  extendedBlockStorage.setBlockLight( this.x, y & 15, this.z, data.light );
}

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

public Column( final Chunk chunk, final int x, final int z, final int chunkY, final int chunkHeight )
{
  this.x = x;
  this.z = z;
  this.c = chunk;
  final ExtendedBlockStorage[] storage = this.c.getBlockStorageArray();
  // make sure storage exists before hand...
  for( int ay = 0; ay < chunkHeight; ay++ )
  {
    final int by = ( ay + chunkY );
    ExtendedBlockStorage extendedblockstorage = storage[by];
    if( extendedblockstorage == null )
    {
      extendedblockstorage = storage[by] = new ExtendedBlockStorage( by << 4, this.c.getWorld().provider.hasSkyLight() );
    }
  }
}

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

public void scanChunkInto(int chunkX, int chunkZ, Chunk chunk, List<Block> search, Collection<BlockPos> result, int max, int yLevelThreshold, int playerY) {
    ExtendedBlockStorage[] chunkInternalStorageArray = chunk.getBlockStorageArray();
    for (int y0 = 0; y0 < 16; y0++) {
      ExtendedBlockStorage extendedblockstorage = chunkInternalStorageArray[y0];
      if (extendedblockstorage == null) {
        continue;
      }
      int yReal = y0 << 4;
      BlockStateContainer bsc = extendedblockstorage.getData();
      // the mapping of BlockStateContainer.getIndex from xyz to index is y << 8 | z << 4 | x;
      // for better cache locality, iterate in that order
      for (int y = 0; y < 16; y++) {
        for (int z = 0; z < 16; z++) {
          for (int x = 0; x < 16; x++) {
            IBlockState state = bsc.get(x, y, z);
            if (search.contains(state.getBlock())) {
              int yy = yReal | y;
              result.add(new BlockPos(chunkX | x, yy, chunkZ | z));
              if (result.size() >= max && Math.abs(yy - playerY) < yLevelThreshold) {
                return;
              }
            }
          }
        }
      }
    }
  }
}

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

BitSet bitSet = new BitSet(CachedChunk.SIZE);
try {
  ExtendedBlockStorage[] chunkInternalStorageArray = chunk.getBlockStorageArray();
  for (int y0 = 0; y0 < 16; y0++) {
    ExtendedBlockStorage extendedblockstorage = chunkInternalStorageArray[y0];

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

@Override
public LocalMaterialData getMaterial(int x, int y, int z)
{
  Chunk chunk = this.getChunk(x, y, z);
  if (chunk == null || y < TerrainControl.WORLD_DEPTH || y >= TerrainControl.WORLD_HEIGHT)
  {
    return ForgeMaterialData.ofMinecraftBlock(Blocks.AIR);
  }
  // There's no chunk.getType(x,y,z), only chunk.getType(BlockPosition)
  // so we use this little hack.
  // Creating a block position for every block lookup is expensive and
  // a major cause of Minecraft 1.8's performance degradation:
  // http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/1272953-optifine?comment=43757
  ExtendedBlockStorage section = chunk.getBlockStorageArray()[y >> 4];
  if (section == null)
  {
    return ForgeMaterialData.ofMinecraftBlock(Blocks.AIR);
  }
  IBlockState blockState = section.get(x & 0xF, y & 0xF, z & 0xF);
  return ForgeMaterialData.ofMinecraftBlockState(blockState);
}

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

if (chunk != null && ownedChunks.chunkOccupiedInLocal[chunkX][chunkZ]) {
  for (index = 0; index < 16; index++) {
    storage = chunk.getBlockStorageArray()[index];
    if (storage != null) {
      for (y = 0; y < 16; y++) {

代码示例来源:origin: Electrical-Age/ElectricalAge

Chunk chunk = w.getChunkFromBlockCoords(xBlock, zBlock);
if (chunk != null) {
  ExtendedBlockStorage storage = chunk.getBlockStorageArray()[yBlock >> 4];
  if (storage != null) {
    int xLocal = xBlock & 0xF;

代码示例来源:origin: PenguinSquad/Harvest-Festival

private void removeOresAndSpawnNew(World world, Chunk chunk) {
  ExtendedBlockStorage[] array = chunk.getBlockStorageArray();

代码示例来源:origin: PenguinSquad/Harvest-Festival

@SubscribeEvent
public void onChunkData(ChunkDataEvent.Load event) {
  ExtendedBlockStorage[] array = event.getChunk().getBlockStorageArray();
  Chunk chunk = event.getChunk();
  World world = chunk.getWorld();
  for (int x = 0; x < 16; x++) {
    for (int z = 0; z < 16; z++) {
      for (int y = 0; y < 256; y++) {
        ExtendedBlockStorage extendedblockstorage = array[y >> 4];
        if (extendedblockstorage != NULL_BLOCK_STORAGE) {
          IBlockState state = extendedblockstorage.get(x, y & 15, z);
          BlockPos pos = new BlockPos((chunk.xPosition * 16) + x, y, (chunk.zPosition * 16) + z);
          WateringHandler handler = CropHelper.getWateringHandler(world, pos, state);
          if (handler != null) {
            HFApi.tickable.addTickable(world, pos, this);
            if (!handler.isWet(world, pos, state) && world.isRaining()) {
              extendedblockstorage.set(x, y & 15, z, handler.hydrate(world, pos, state));
            }
          }
        }
      }
    }
  }
}

代码示例来源:origin: PenguinSquad/Harvest-Festival

@SubscribeEvent
  public void onChunkData(ChunkDataEvent.Load event) {
    ExtendedBlockStorage[] array = event.getChunk().getBlockStorageArray();
    Chunk chunk = event.getChunk();
    World world = chunk.getWorld();
    for (int x = 0; x < 16; x++) {
      for (int z = 0; z < 16; z++) {
        for (int y = 0; y < 256; y++) {
          ExtendedBlockStorage extendedblockstorage = array[y >> 4];
          if (extendedblockstorage != NULL_BLOCK_STORAGE) {
            if (extendedblockstorage.get(x, y & 15, z).getBlock() == SNOW_LAYER || extendedblockstorage.get(x, y & 15, z).getBlock() == Blocks.ICE) {
              BlockPos pos = new BlockPos((chunk.xPosition * 16) + x, y, (chunk.zPosition * 16) + z);
              if (!chunk.getBiome(pos, world.provider.getBiomeProvider()).isSnowyBiome()) {
                HFApi.tickable.addTickable(world, pos, this);
              }
            }
          }
        }
      }
    }
  }
}

代码示例来源:origin: IntellectualSites/PlotSquared

return false;
ExtendedBlockStorage[] sections = nmsChunk.getBlockStorageArray();
nmsChunk.generateSkylightMap();
net.minecraft.world.World nmsWorld = nmsChunk.getWorld();

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

int worldStartZ = rawChunk.z * 16;
ExtendedBlockStorage[] sectionsArray = rawChunk.getBlockStorageArray();

代码示例来源:origin: IntellectualSites/PlotSquared

continue;
ExtendedBlockStorage[] sections = nmsChunk.getBlockStorageArray();
ExtendedBlockStorage section = sections[layer];
if (section == null) {

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

compound.setBoolean("LightPopulated", chunkIn.isLightPopulated());
compound.setLong("InhabitedTime", chunkIn.getInhabitedTime());
ExtendedBlockStorage[] aextendedblockstorage = chunkIn.getBlockStorageArray();
NBTTagList nbttaglist = new NBTTagList();
boolean flag = worldIn.provider.hasSkyLight();

相关文章