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

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

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

Chunk.getWorld介绍

暂无

代码示例

代码示例来源: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: AppliedEnergistics/Applied-Energistics-2

public static void sendChunk( final Chunk c, final int verticalBits )
{
  try
  {
    final WorldServer ws = (WorldServer) c.getWorld();
    final PlayerChunkMap pm = ws.getPlayerChunkMap();
    final PlayerChunkMapEntry playerInstance = pm.getEntry( c.x, c.z );
    if( playerInstance != null )
    {
      playerInstance.sendPacket( new SPacketChunkData( c, verticalBits ) );
    }
  }
  catch( final Throwable t )
  {
    AELog.debug( t );
  }
}

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

public ChunkCoords(Chunk chunk) {
    this.dimension = chunk.getWorld().provider.getDimension();
    this.x = chunk.x;
    this.z = chunk.z;
  }
}

代码示例来源:origin: Chisel-Team/Chisel

@Override
public void writeToNBT(@Nonnull Chunk chunk, @Nonnull NBTTagCompound tag) {
  T t = data.get(Pair.of(chunk.getWorld().provider.getDimension(), chunk.getPos()));
  if (t != null) {
    t.write(tag);
  }
}

代码示例来源:origin: Chisel-Team/Chisel

@Override
public void readFromNBT(@Nonnull Chunk chunk, @Nonnull NBTTagCompound tag) {
  int dimID = chunk.getWorld().provider.getDimension();
  ChunkPos coords = chunk.getPos();
  if (tag.hasNoTags()) {
    data.remove(dimID, coords);
    return;
  }
  T t = getOrCreateNew(dimID, coords);
  t.read(tag);
}

代码示例来源:origin: TeamWizardry/Wizardry

public static WizardryChunk get(Chunk chunk)
{
  WizardryChunk cap = chunk.getCapability(capability(), null);
  if (cap == null)
    throw new IllegalStateException("Missing capability: " + chunk.getWorld().getWorldInfo().getWorldName() + "/" + chunk.getWorld().provider.getDimensionType().getName() + "/(" + chunk.x + ","+ chunk.z + ")");
  return cap;
}

代码示例来源:origin: Chisel-Team/Chisel

public static IOffsetData getOffsetForChunk(Chunk chunk) {
  return getOffsetForChunk(chunk.getWorld().provider.getDimension(), chunk.getPos());
}

代码示例来源:origin: WayofTime/BloodMagic

public static void generateWill(Chunk chunk) {
    addWillChunk(chunk.getWorld().provider.getDimension(), chunk, (short) 1, new DemonWillHolder());
  }
}

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

public void updateRenderTileEntities() {
  ArrayList<TileEntity> updatedRenderTiles = new ArrayList<TileEntity>();
  MutableBlockPos pos = new MutableBlockPos();
  for (int x = chunkToRender.x * 16; x < chunkToRender.x * 16 + 16; x++) {
    for (int z = chunkToRender.z * 16; z < chunkToRender.z * 16 + 16; z++) {
      for (int y = yMin; y <= yMax; y++) {
        pos.setPos(x, y, z);
        TileEntity tile = chunkToRender.getWorld().getTileEntity(pos);
        if (tile != null) {
          updatedRenderTiles.add(tile);
        }
      }
    }
  }
  Minecraft.getMinecraft().renderGlobal.updateTileEntities(renderTiles, updatedRenderTiles);
  renderTiles = updatedRenderTiles;
}

代码示例来源:origin: Chisel-Team/Chisel

private void updateClient(@Nonnull Chunk chunk, String key, IChunkData<?> cd) {
    if (cd.requiresClientSync()) {
      NBTTagCompound tag = new NBTTagCompound();
      cd.writeToNBT(chunk, tag);
      PlayerChunkMapEntry entry = ((WorldServer)chunk.getWorld()).getPlayerChunkMap().getEntry(chunk.x, chunk.z);
      if (entry != null) {
        entry.sendPacket(Chisel.network.getPacketFrom(new MessageChunkData(chunk, key, tag)));
      }
    }
  }
}

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

@SubscribeEvent
public static void onAttachCapabilitiesChunk(AttachCapabilitiesEvent<Chunk> event)
{
  if (event.getObject().getWorld().getWorldType() == TerraFirmaCraft.getWorldTypeTFC())
    event.addCapability(CHUNK_DATA, new ChunkDataProvider());
}

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

if(chunk.getHeightValue(x, z) < chunk.getWorld().provider.getAverageGroundLevel() - ravineMinDepth)	{
  ravineOccurences += priorityRavine;

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

WorldServer w = (WorldServer) nmsChunk.getWorld();
PlayerChunkMap chunkMap = w.getPlayerChunkMap();
if (!chunkMap.contains(x, z)) {

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

/**
 * Returns the village if the specified chunk overlays its territory.
 */
public static Village getVillageInChunk(Chunk chunk) {
  int centerX = (chunk.x << 4) + 8;
  int centerZ = (chunk.z << 4) + 8;
  List<Village> villages = chunk.getWorld().villageCollection.getVillageList();
  for (Village village : villages) {
    BlockPos coords = village.getCenter();
    if ((centerX - coords.getX())*(centerX - coords.getX()) + (centerZ - coords.getZ())*(centerZ - coords.getZ())
        <= village.getVillageRadius()*village.getVillageRadius()) {
      return village;
    }
  }
  return null;
}

代码示例来源: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

net.minecraft.world.World nmsWorld = nmsChunk.getWorld();

相关文章