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

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

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

Chunk.isLoaded介绍

暂无

代码示例

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

@Override
public boolean setBiome(BlockVector2 position, BaseBiome biome) {
  checkNotNull(position);
  checkNotNull(biome);
  Chunk chunk = getWorld().getChunkFromBlockCoords(new BlockPos(position.getBlockX(), 0, position.getBlockZ()));
  if (chunk.isLoaded()) {
    chunk.getBiomeArray()[((position.getBlockZ() & 0xF) << 4 | position.getBlockX() & 0xF)] = (byte) biome.getId();
    return true;
  }
  return false;
}

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

@Override
  public void moveTile( final TileEntity te, final World w, final BlockPos newPosition )
  {
    te.setWorld( w );
    te.setPos( newPosition );

    final Chunk c = w.getChunkFromBlockCoords( newPosition );
    c.addTileEntity( newPosition, te );

    if( c.isLoaded() )
    {
      final IBlockState state = w.getBlockState( newPosition );
      w.addTileEntity( te );
      w.notifyBlockUpdate( newPosition, state, state, 1 );
    }
  }
}

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

private boolean canUseNode( final long qe )
{
  final QuantumCluster qc = (QuantumCluster) AEApi.instance().registries().locatable().getLocatableBy( qe );
  if( qc != null )
  {
    final World theWorld = qc.center.getWorld();
    if( !qc.isDestroyed )
    {
      final Chunk c = theWorld.getChunkFromBlockCoords( qc.center.getPos() );
      if( c.isLoaded() )
      {
        final int id = theWorld.provider.getDimension();
        final World cur = DimensionManager.getWorld( id );
        final TileEntity te = theWorld.getTileEntity( qc.center.getPos() );
        return te != qc.center || theWorld != cur;
      }
    }
  }
  return true;
}

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

if( c.c.isLoaded() )

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

public Chunk getChunk(World world, int x, int z) {
  net.minecraft.world.chunk.Chunk chunk = ((net.minecraft.world.World) world).getChunkProvider().provideChunk(x, z);
  if (chunk != null && !chunk.isLoaded()) {
    chunk.onLoad();
  }
  return chunk;
}

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

World world = getSpongeWorld();
Chunk nmsChunk = ((net.minecraft.world.World) world).getChunkProvider().provideChunk(x, z);
if (nmsChunk == null || !nmsChunk.isLoaded()) {
  return;

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

public boolean isLoaded(int x, int z) {
    Chunk prevChunk = prev;
    if (prevChunk != null && prevChunk.x == x >> 4 && prevChunk.z == z >> 4) {
      return true;
    }
    prevChunk = loadedChunks.get(ChunkPos.asLong(x >> 4, z >> 4));
    if (prevChunk != null && prevChunk.isLoaded()) {
      prev = prevChunk;
      return true;
    }
    CachedRegion prevRegion = prevCached;
    if (prevRegion != null && prevRegion.getX() == x >> 9 && prevRegion.getZ() == z >> 9) {
      return prevRegion.isCached(x & 511, z & 511);
    }
    if (worldData == null) {
      return false;
    }
    prevRegion = worldData.cache.getRegion(x >> 9, z >> 9);
    if (prevRegion == null) {
      return false;
    }
    prevCached = prevRegion;
    return prevRegion.isCached(x & 511, z & 511);
  }
}

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

if (chunk != null && chunk.isLoaded()) {
  prev = chunk;
  return chunk.getBlockState(x, y, z);

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

@SubscribeEvent
public static void chunkSave(ChunkDataEvent.Save event) {
  int dim = event.getWorld().provider.getDimension();
  ChunkPos loc = event.getChunk().getPos();
  NBTTagCompound nbt = new NBTTagCompound();
  event.getData().setTag("BloodMagic", nbt);
  WillChunk ac = WorldDemonWillHandler.getWillChunk(dim, loc.x, loc.z);
  if (ac != null) {
    nbt.setShort("base", ac.getBase());
    ac.getCurrentWill().writeToNBT(nbt, "current");
    if (!event.getChunk().isLoaded())
      WorldDemonWillHandler.removeWillChunk(dim, loc.x, loc.z);
  }
}

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

public boolean fixLighting(CharLocalChunk_Sponge bc, Chunk nmsChunk) {
  try {
    if (!nmsChunk.isLoaded()) {
      return false;

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

blockpos$pooledmutableblockpos.setPos(entity.posX, 0.0D, entity.posZ);
if (!entity.world.isRemote || entity.world.isBlockLoaded(blockpos$pooledmutableblockpos) && entity.world.getChunk(blockpos$pooledmutableblockpos).isLoaded()) {
  if (!entity.hasNoGravity()) {
    entity.motionY -= 0.08D;

相关文章