net.minecraft.world.World.getChunkFromChunkCoords()方法的使用及代码示例

x33g5p2x  于2022-02-02 转载在 其他  
字(7.4k)|赞(0)|评价(0)|浏览(115)

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

World.getChunkFromChunkCoords介绍

暂无

代码示例

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

  1. @Override
  2. public void fixLighting(Iterable<BlockVector2> chunks) {
  3. World world = getWorld();
  4. for (BlockVector2 chunk : chunks) {
  5. world.getChunkFromChunkCoords(chunk.getBlockX(), chunk.getBlockZ()).resetRelightChecks();
  6. }
  7. }

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

  1. public ChunkOnly( final World w, final int cx, final int cz )
  2. {
  3. super( w );
  4. this.target = w.getChunkFromChunkCoords( cx, cz );
  5. this.cx = cx;
  6. this.cz = cz;
  7. }

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

  1. freshWorld.getChunkFromChunkCoords(chunk.getBlockX(), chunk.getBlockZ());

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

  1. Chunk chunk = world.getChunkFromChunkCoords(x >> 4, z >> 4);
  2. BlockPos pos = new BlockPos(x, y, z);
  3. IBlockState old = chunk.getBlockState(pos);

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

  1. final Chunk c = w.getChunkFromChunkCoords( cx, cz );

代码示例来源:origin: SleepyTrousers/EnderIO

  1. @Override
  2. public @Nonnull Chunk getChunkFromChunkCoords(int chunkX, int chunkZ) {
  3. return wrapped.getChunkFromChunkCoords(chunkX, chunkZ);
  4. }

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

  1. this.myColumns[x][z] = new Column( w.getChunkFromChunkCoords( ( minX + x ) >> 4,
  2. ( minZ + z ) >> 4 ), ( minX + x ) & 0xF, ( minZ + z ) & 0xF, minCY, cy_size );
  3. final List<BlockPos> deadTiles = new ArrayList<>();
  4. final Chunk c = w.getChunkFromChunkCoords( minCX + cx, minCZ + cz );
  5. this.myChunks[cx][cz] = c;

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

  1. @Override
  2. public Chunk getChunkFromChunkCoords(int chunkX, int chunkZ) {
  3. return getActualWorld().getChunkFromChunkCoords(chunkX, chunkZ);
  4. }

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

  1. private static boolean isAverageHeightWithin(World world, int cx, int cz, int min, int max) {
  2. Chunk chunk = world.getChunkFromChunkCoords(cx, cz);
  3. int val;
  4. int total = 0;
  5. for (int x = (cx << 4); x < ((cx << 4) + 16); x++) {
  6. for (int z = (cz << 4); z < ((cz << 4) + 16); z++) {
  7. val = getTopFilledHeight(chunk, x, z);
  8. if (val < 0) {
  9. return false;
  10. }//exit out if a non-proper block-type is detected
  11. total += val;
  12. }
  13. }
  14. total /= 256; //make it the average top-height of all blocks in chunk
  15. return total >= min && total <= max;
  16. }

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

  1. public VWChunkCache(World world, int mnX, int mnZ, int mxX, int mxZ) {
  2. worldFor = world;
  3. minChunkX = mnX >> 4;
  4. minChunkZ = mnZ >> 4;
  5. maxChunkX = mxX >> 4;
  6. maxChunkZ = mxZ >> 4;
  7. cachedChunks = new Chunk[maxChunkX - minChunkX + 1][maxChunkZ - minChunkZ + 1];
  8. isChunkLoaded = new boolean[maxChunkX - minChunkX + 1][maxChunkZ - minChunkZ + 1];
  9. for (int x = minChunkX; x <= maxChunkX; x++) {
  10. for (int z = minChunkZ; z <= maxChunkZ; z++) {
  11. cachedChunks[x - minChunkX][z - minChunkZ] = world.getChunkFromChunkCoords(x, z);
  12. isChunkLoaded[x - minChunkX][z - minChunkZ] = !cachedChunks[x - minChunkX][z - minChunkZ].isEmpty();
  13. if (!isChunkLoaded[x - minChunkX][z - minChunkZ]) {
  14. allLoaded = false;
  15. }
  16. }
  17. }
  18. }

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

  1. public static void chunkForced(World world, ChunkPos location) {
  2. if (forcingChunk) { // prevent infinite recursion when there are multiple chunk loaders
  3. return;
  4. }
  5. forcingChunk = true;
  6. WorldConfig cfg = getWorldConfig(world);
  7. int radius = (cfg.deferredPopulationRange + 15) / 16;
  8. for (int cX = location.x - radius; cX <= location.x + radius; ++cX)
  9. {
  10. for (int cZ = location.z - radius; cZ <= location.z + radius; ++cZ)
  11. {
  12. if (cX != location.x && cZ != location.z) {
  13. world.getChunkFromChunkCoords(cX, cZ);
  14. }
  15. }
  16. }
  17. forcingChunk = false;
  18. }
  19. }

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

  1. private static void addValidTilesInChunkArea(World world, int x1, int y1, int z1, int x2, int y2, int z2, List<TileEntity> tileEntities, int x, int z) {
  2. Chunk chunk = world.getChunkFromChunkCoords(x, z);
  3. for (TileEntity tile : chunk.getTileEntityMap().values()) {
  4. if (!tile.isInvalid() && isTileInArea(x1, y1, z1, x2, y2, z2, tile)) {
  5. tileEntities.add(tile);
  6. }
  7. }
  8. }

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

  1. private Chunk[] loadFourChunks(ChunkCoordinate topLeft)
  2. {
  3. Chunk[] chunkCache = new Chunk[4];
  4. for (int indexX = 0; indexX <= 1; indexX++)
  5. {
  6. for (int indexZ = 0; indexZ <= 1; indexZ++)
  7. {
  8. chunkCache[indexX | (indexZ << 1)] = this.world.getChunkFromChunkCoords(
  9. topLeft.getChunkX() + indexX,
  10. topLeft.getChunkZ() + indexZ
  11. );
  12. }
  13. }
  14. return chunkCache;
  15. }

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

  1. public boolean hasToManyAndroids() {
  2. Chunk chunk = world.getChunkFromChunkCoords(chunkCoordX, chunkCoordZ);
  3. int androidCount = 0;
  4. for (int i = 0; i < chunk.getEntityLists().length; i++) {
  5. for (Entity entity : chunk.getEntityLists()[i]) {
  6. if (entity instanceof EntityRougeAndroidMob) {
  7. androidCount++;
  8. if (androidCount > EntityRogueAndroid.MAX_ANDROIDS_PER_CHUNK) {
  9. return true;
  10. }
  11. }
  12. }
  13. }
  14. return false;
  15. }

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

  1. @Override
  2. public void run() {
  3. Chunk chunk = Chisel.proxy.getClientWorld().getChunkFromChunkCoords(message.chunk.x, message.chunk.z);
  4. IChunkData<?> data = INSTANCE.data.get(message.key);
  5. data.readFromNBT(chunk, message.tag);
  6. int x = chunk.x << 4;
  7. int z = chunk.z << 4;
  8. Chisel.proxy.getClientWorld().markBlockRangeForRenderUpdate(x, 0, z, x, 255, z);
  9. }
  10. });

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

  1. private static boolean chunkHasBeenPopulated(World world, int chunkX, int chunkZ) {
  2. // NOTE: We assume the chunk has been populated if it is only on disk,
  3. // because if we load it to check, it will be populated automatically.
  4. return chunkIsLoaded(world, chunkX, chunkZ) ?
  5. world.getChunkFromChunkCoords(chunkX, chunkZ).isTerrainPopulated() :
  6. chunkIsSaved(world, chunkX, chunkZ);
  7. }

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

  1. private Chunk getChunk(int x, int y, int z)
  2. {
  3. if (y < TerrainControl.WORLD_DEPTH || y >= TerrainControl.WORLD_HEIGHT)
  4. return null;
  5. int chunkX = x >> 4;
  6. int chunkZ = z >> 4;
  7. if (this.chunkCache == null)
  8. {
  9. // Blocks requested outside population step
  10. // (Tree growing, /tc spawn, etc.)
  11. return this.world.getChunkFromChunkCoords(chunkX, chunkZ);
  12. }
  13. // Restrict to chunks we are currently populating
  14. Chunk topLeftCachedChunk = this.chunkCache[0];
  15. int indexX = (chunkX - topLeftCachedChunk.x);
  16. int indexZ = (chunkZ - topLeftCachedChunk.z);
  17. if ((indexX == 0 || indexX == 1) && (indexZ == 0 || indexZ == 1))
  18. {
  19. return this.chunkCache[indexX | (indexZ << 1)];
  20. } else
  21. {
  22. // Outside area
  23. if (this.settings.getWorldConfig().populationBoundsCheck)
  24. {
  25. return null;
  26. }
  27. return this.getLoadedChunkWithoutMarkingActive(chunkX, chunkZ);
  28. }
  29. }

代码示例来源:origin: TheCBProject/EnderStorage

  1. public void invert() {
  2. invert_redstone = !invert_redstone;
  3. world.getChunkFromChunkCoords(pos.getX(), pos.getZ()).markDirty();
  4. }
  5. }

代码示例来源:origin: McJtyMods/DeepResonance

  1. private List<EntityPlayerMP> getAllPlayersWatchingBlock(World world, int x, int z) {
  2. List<EntityPlayerMP> ret = new ArrayList<>();
  3. if(world instanceof WorldServer) {
  4. PlayerChunkMap playerManager = ((WorldServer)world).getPlayerChunkMap();
  5. for (EntityPlayerMP player : ((WorldServer) getWorld()).getMinecraftServer().getPlayerList().getPlayers()) {
  6. Chunk chunk = world.getChunkFromChunkCoords(x >> 4, z >> 4);
  7. if (playerManager.isPlayerWatchingChunk(player, chunk.x, chunk.z)) {
  8. ret.add(player);
  9. }
  10. }
  11. }
  12. return ret;
  13. }

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

  1. @Inject(method = "addEntity(Lnet/minecraft/entity/Entity;)V", at = @At("HEAD"), cancellable = true)
  2. public void preAddEntity(Entity entityIn, CallbackInfo callbackInfo) {
  3. World world = this.world;
  4. int i = MathHelper.floor(entityIn.posX / 16.0D);
  5. int j = MathHelper.floor(entityIn.posZ / 16.0D);
  6. if (i == this.x && j == this.z) {
  7. //do nothing, and let vanilla code take over after our injected code is done (now)
  8. } else {
  9. Chunk realChunkFor = world.getChunkFromChunkCoords(i, j);
  10. if (!realChunkFor.isEmpty() && realChunkFor.loaded) {
  11. realChunkFor.addEntity(entityIn);
  12. callbackInfo.cancel(); //don't run the code on this chunk!!!
  13. }
  14. }
  15. }
  16. }

相关文章

World类方法