Java 类org.bukkit.ChunkSnapshot 实例源码

项目:SurvivalPlus    文件:SnowGeneration.java   
@SuppressWarnings("deprecation")
public void checkChunk(final Chunk chunk)
{
    final ChunkSnapshot chunkSnap = chunk.getChunkSnapshot(true, false, false);

    for(int x = 0; x < 16; x++)
    {
        for(int z = 0; z < 16; z++)
        {
            final int y = chunkSnap.getHighestBlockYAt(x, z);

            if(chunkSnap.getBlockTypeId(x, y, z) == Material.SNOW.getId())
                placeSnow(chunk, chunkSnap, x, y, z);
        }
    }
}
项目:FastAsyncWorldedit    文件:BukkitQueue_All.java   
@Override
public boolean queueChunkLoad(int cx, int cz, RunnableVal<ChunkSnapshot> operation) {
    if (PAPER) {
        try {
            new PaperChunkCallback(getImpWorld(), cx, cz) {
                @Override
                public void onLoad(Chunk chunk) {
                    try {
                        ChunkSnapshot snapshot = chunk.getChunkSnapshot();
                        operation.run(snapshot);
                    } catch (Throwable e) {
                        PAPER = false;
                    }
                }
            };
            return true;
        } catch (Throwable ignore) {
            PAPER = false;
        }
    }
    return super.queueChunkLoad(cx, cz);
}
项目:FastAsyncWorldedit    文件:BukkitQueue_All.java   
@Override
public ChunkSnapshot getCachedChunk(World world, int cx, int cz) {
    long pair = MathMan.pairInt(cx, cz);
    ChunkSnapshot cached = chunkCache.get(pair);
    if (cached != null) return cached;
    if (world.isChunkLoaded(cx, cz)) {
        Long originalKeep = keepLoaded.get(pair);
        keepLoaded.put(pair, Long.MAX_VALUE);
        if (world.isChunkLoaded(cx, cz)) {
            Chunk chunk = world.getChunkAt(cx, cz);
            ChunkSnapshot snapshot = getAndCacheChunk(chunk);
            if (originalKeep != null) {
                keepLoaded.put(pair, originalKeep);
            } else {
                keepLoaded.remove(pair);
            }
            return snapshot;
        } else {
            keepLoaded.remove(pair);
            return null;
        }
    } else {
        return null;
    }
}
项目:MCBridge    文件:ChunkSection.java   
@SuppressWarnings("deprecation")
public void createFromChunk(Chunk chunk, World world, int offset){
    blocks = new byte[4096];
    metaData = new byte[2048];
    blocklight = new byte[2048];
    skylight = new byte[2048];

    ChunkSnapshot snap = chunk.getChunkSnapshot();
    offset = offset * 16;

    int aoffset = 0;
    for (int x = chunk.getX(); x < 16; x++) {
           for (int z = chunk.getZ(); z < 16; z++) {
               for (int y = offset; y < offset + 16; y++) {
                System.out.println("ChunkSection offset "+offset+", X: "+x+", Y: "+y+", Z: "+z);
                blocks[aoffset] = (byte) snap.getBlockTypeId(x, y, z);
                ChunkUtils.setNibble((byte) x, (byte) y, (byte) z, (byte) snap.getBlockData(x, y, z), metaData);
                ChunkUtils.setNibble((byte) x, (byte) y, (byte) z, (byte) snap.getBlockEmittedLight(x, y, z), blocklight);
                ChunkUtils.setNibble((byte) x, (byte) y, (byte) z, (byte) snap.getBlockSkyLight(x, y, z), skylight);
                aoffset++;
               }
           }
       }
}
项目:civcraft    文件:Buildable.java   
public static int getBlockIDFromSnapshotMap(HashMap<ChunkCoord, ChunkSnapshot> snapshots, int absX, int absY, int absZ, String worldName) throws CivException {

    int chunkX = ChunkCoord.castToChunkX(absX);
    int chunkZ = ChunkCoord.castToChunkZ(absZ);

    int blockChunkX = absX % 16;
    int blockChunkZ = absZ % 16;

    if (blockChunkX < 0) {
        blockChunkX += 16;
    }

    if (blockChunkZ < 0) {
        blockChunkZ += 16;
    }

    ChunkCoord coord = new ChunkCoord(worldName, chunkX, chunkZ);

    ChunkSnapshot snapshot = snapshots.get(coord);
    if (snapshot == null) {
        throw new CivException("Snapshot for chunk "+chunkX+", "+chunkZ+" in "+worldName+" not found for abs:"+absX+","+absZ);
    }

    return ItemManager.getBlockTypeId(snapshot, blockChunkX, absY, blockChunkZ);
}
项目:civcraft    文件:BlockSnapshot.java   
public void setFromSnapshotLocation(int x, int y, int z, ChunkSnapshot snapshot) {
    /* Modulo in Java doesn't handle negative numbers the way we want it to, compensate here. */
    if (x < 0) {
        x += 16;
    }

    if (z < 0) {
        z += 16;
    }

    this.setX(x);
    this.setY(y);
    this.setZ(z);
    this.setSnapshot(snapshot);
    this.setTypeId(ItemManager.getBlockTypeId(snapshot, this.x, this.y, this.z));
    this.setData(ItemManager.getBlockData(snapshot, this.x, this.y, this.z));
}
项目:swu    文件:DatabaseUpdateTask.java   
/**
 * Updates the height map of the given ChunkInfo.
 * 
 * As this waits for the main thread, it can be time intensive.
 * 
 * @param info The ChunkInfo to update.
 */
private void updateHeightMap(final ChunkInfo info) throws InterruptedException, ExecutionException {
    final FutureTask<ChunkSnapshot> task = new FutureTask<ChunkSnapshot>(new Callable<ChunkSnapshot>() {
        public ChunkSnapshot call() throws Exception {
            World w = plugin.getServer().getWorld(info.getWorld());
            if (w == null)
                return null;

            return w.getChunkAt(info.getX(), info.getZ()).getChunkSnapshot();
        }
    });

    plugin.getGameTasker().add(task);
    ChunkSnapshot chunk = task.get();
    ChunkUtils.copyHeightMap(chunk, info.getHeightMap());
}
项目:ProjectAres    文件:SnapshotMatchModule.java   
public MaterialData getOriginalMaterial(int x, int y, int z) {
    if(y < 0 || y >= 256) return new MaterialData(Material.AIR);

    ChunkVector chunkVector = ChunkVector.ofBlock(x, y, z);
    ChunkSnapshot chunkSnapshot = chunkSnapshots.get(chunkVector);
    if(chunkSnapshot != null) {
        BlockVector chunkPos = chunkVector.worldToChunk(x, y, z);
        return new MaterialData(chunkSnapshot.getBlockTypeId(chunkPos.getBlockX(), chunkPos.getBlockY(), chunkPos.getBlockZ()),
                                (byte) chunkSnapshot.getBlockData(chunkPos.getBlockX(), chunkPos.getBlockY(), chunkPos.getBlockZ()));
    } else {
        return getMatch().getWorld().getBlockAt(x, y, z).getState().getMaterialData();
    }
}
项目:ProjectAres    文件:SnapshotMatchModule.java   
public BlockState getOriginalBlock(int x, int y, int z) {
    BlockState state = getMatch().getWorld().getBlockAt(x, y, z).getState();
    if(y < 0 || y >= 256) return state;

    ChunkVector chunkVector = ChunkVector.ofBlock(x, y, z);
    ChunkSnapshot chunkSnapshot = chunkSnapshots.get(chunkVector);
    if(chunkSnapshot != null) {
        BlockVector chunkPos = chunkVector.worldToChunk(x, y, z);
        state.setMaterialData(new MaterialData(chunkSnapshot.getBlockTypeId(chunkPos.getBlockX(), chunkPos.getBlockY(), chunkPos.getBlockZ()),
                                               (byte) chunkSnapshot.getBlockData(chunkPos.getBlockX(), chunkPos.getBlockY(), chunkPos.getBlockZ())));
    }
    return state;
}
项目:ProjectAres    文件:SnapshotMatchModule.java   
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void onBlockChange(BlockTransformEvent event) {
    Chunk chunk = event.getOldState().getChunk();
    ChunkVector chunkVector = ChunkVector.of(chunk);
    if(!chunkSnapshots.containsKey(chunkVector)) {
        logger.fine("Copying chunk at " + chunkVector);
        ChunkSnapshot chunkSnapshot = chunk.getChunkSnapshot();
        chunkSnapshot.updateBlock(event.getOldState()); // ChunkSnapshot is very likely to have the post-event state already, so we have to correct it
        chunkSnapshots.put(chunkVector, chunkSnapshot);
    }
}
项目:Transport-Pipes    文件:OcclusionCullingUtils.java   
@SuppressWarnings("deprecation")
private static boolean isBlockAtLocationOccluding(Location loc) {
    try {
        ChunkSnapshot snapshot = null;
        int chunkX = (int) Math.floor(loc.getBlockX() / 16d);
        int chunkZ = (int) Math.floor(loc.getBlockZ() / 16d);
        ChunkCoords cc = new ChunkCoords(loc.getWorld().getName(), chunkX, chunkZ);
        if (TransportPipes.instance.blockChangeListener.cachedChunkSnapshots.containsKey(cc)) {
            snapshot = TransportPipes.instance.blockChangeListener.cachedChunkSnapshots.get(cc);
        }
        if (snapshot == null) {
            return false;
        }
        int relativeX = loc.getBlockX() % 16;
        if (relativeX < 0) {
            relativeX = 16 + relativeX;
        }
        int relativeZ = loc.getBlockZ() % 16;
        if (relativeZ < 0) {
            relativeZ = 16 + relativeZ;
        }
        Material material = Material.getMaterial(snapshot.getBlockTypeId(relativeX, loc.getBlockY(), relativeZ));
        return material.isOccluding();
    } catch (Exception e) {
        e.printStackTrace();
        Sentry.capture(e);
        return false;
    }
}
项目:AutomaticInventory    文件:FindChestsThread.java   
public FindChestsThread(World world, ChunkSnapshot[][] snapshots, int minY, int maxY, int startX, int startY, int startZ, Player player)
{
    this.world = world;
    this.snapshots = snapshots;
    this.minY = minY;
    this.maxY = maxY;
    this.smallestChunk = this.snapshots[0][0];
    this.startX = startX - this.smallestChunk.getX() * 16;
    this.startY = startY;
    this.startZ = startZ - this.smallestChunk.getZ() * 16;
    if(this.maxY >= world.getMaxHeight()) this.maxY = world.getMaxHeight() - 1;
    this.player = player;
    this.seen =  new boolean[48][this.maxY - this.minY + 1][48];
}
项目:AutomaticInventory    文件:FindChestsThread.java   
@SuppressWarnings("deprecation")
private int getTypeID(Vector location)
{
    if(this.outOfBounds(location)) return  -1;
    int chunkx = location.getBlockX() / 16;
    int chunkz = location.getBlockZ() / 16;
    ChunkSnapshot chunk = this.snapshots[chunkx][chunkz];
    int x = location.getBlockX() % 16;
    int z = location.getBlockZ() % 16;
    return chunk.getBlockTypeId(x, location.getBlockY(), z);
}
项目:SunBurnsTrees    文件:EventListener.java   
@EventHandler
public void onChunkLoad(ChunkLoadEvent event) throws InterruptedException {
    if (!plugin.checkChunksCompletely || disabling) {
        return;
    }

    Chunk chunk = event.getChunk();
    if (plugin.cleanChunks.contains(chunk)) {
        return;
    }

    while (plugin.isUpdatingChecks) {
        Thread.sleep(25);
    }

    ChunkSnapshot snapshot = chunk.getChunkSnapshot();
    int highest;
    Block block;
    for (int x = 0; x < 16; x++) {
        for (int z = 0; z < 16; z++) {
            highest = snapshot.getHighestBlockYAt(x, z);
            for (int y = 1; y <= highest; y++) {
                block = chunk.getBlock(x, y, z);
                if (plugin.burningMaterials.contains(block.getType())) {
                    plugin.monitorBlocks.add(block);
                }
            }
        }
    }
    Bukkit.broadcastMessage("Finished checking chunk at X=" + chunk.getX() + " Z=" + chunk.getZ());
    plugin.cleanChunks.add(chunk);
}
项目:FastAsyncWorldedit    文件:AsyncChunk.java   
@Override
public ChunkSnapshot getChunkSnapshot(boolean includeMaxblocky, boolean includeBiome, boolean includeBiomeTempRain) {
    if (Thread.currentThread() == Fawe.get().getMainThread()) {
        return world.getChunkAt(x, z).getChunkSnapshot(includeMaxblocky, includeBiome, includeBiomeTempRain);
    }
    return whenLoaded(new RunnableVal<ChunkSnapshot>() {
        @Override
        public void run(ChunkSnapshot value) {
            this.value = world.getChunkAt(x, z).getChunkSnapshot(includeBiome, includeBiome, includeBiomeTempRain);
        }
    });
}
项目:FastAsyncWorldedit    文件:AsyncWorld.java   
@Override
public ChunkSnapshot getEmptyChunkSnapshot(final int x, final int z, final boolean includeBiome, final boolean includeBiomeTempRain) {
    return TaskManager.IMP.sync(new RunnableVal<ChunkSnapshot>() {
        @Override
        public void run(ChunkSnapshot value) {
            this.value = parent.getEmptyChunkSnapshot(x, z, includeBiome, includeBiomeTempRain);
        }
    });
}
项目:FastAsyncWorldedit    文件:BukkitQueue_All.java   
@Override
public int getCombinedId4Data(ChunkSnapshot chunk, int x, int y, int z) {
    if (chunk.isSectionEmpty(y >> 4)) {
        return 0;
    }
    int id = chunk.getBlockTypeId(x & 15, y, z & 15);
    if (FaweCache.hasData(id)) {
        int data = chunk.getBlockData(x & 15, y, z & 15);
        return (id << 4) + data;
    } else {
        return id << 4;
    }
}
项目:FastAsyncWorldedit    文件:BukkitQueue_All.java   
@Override
public CompoundTag getTileEntity(ChunkSnapshot chunk, int x, int y, int z) {
    if (getAdapter() == null) {
        return null;
    }
    Location loc = new Location(getWorld(), x, y, z);
    BaseBlock block = getAdapter().getBlock(loc);
    return block != null ? block.getNbtData() : null;
}
项目:uSkyBlock    文件:LevelLogic.java   
private ChunkSnapshot getChunkSnapshot(int x, int z, List<ChunkSnapshot> snapshots) {
    for (ChunkSnapshot chunk : snapshots) {
        if (chunk.getX() == x && chunk.getZ() == z) {
            return chunk;
        }
    }
    return null;
}
项目:uSkyBlock    文件:ChunkSnapShotTask.java   
public ChunkSnapShotTask(uSkyBlock plugin, Location location, ProtectedRegion region, final Callback<List<ChunkSnapshot>> callback) {
    super(plugin, callback);
    this.location = location;
    if (region != null) {
        chunks = new ArrayList<>(WorldEditHandler.getChunks(new CuboidRegion(region.getMinimumPoint(), region.getMaximumPoint())));
    } else {
        chunks = new ArrayList<>();
    }
    callback.setState(snapshots);
}
项目:uSkyBlock    文件:ChunkUtil.java   
public Material getBlockTypeAt(int x, int y, int z) {
    ChunkSnapshot chunkAt = getChunkAt(x >> 4, z >> 4);
    if (chunkAt != null) {
        int cx = x & 0xF;
        int cz = z & 0xF;
        return Material.getMaterial(chunkAt.getBlockTypeId(cx, y, cz));
    }
    return null;
}
项目:civcraft    文件:WindmillStartSyncTask.java   
@Override
public void run() {
    /* Find adjacent farms, get their chunk snapshots and continue processing in our thread. */
    ChunkCoord cc = new ChunkCoord(windmill.getCorner());
    ArrayList<ChunkSnapshot> snapshots = new ArrayList<ChunkSnapshot>();

    int[][] offset = { { -1, 0 }, { 1, 0 }, { 0, -1 }, { 0, 1 }, { 1, 1 }, {-1,-1 }, {-1, 1}, {1, -1} };
    for (int i = 0; i < 8; i++) {
        cc.setX(cc.getX() + offset[i][0]);
        cc.setZ(cc.getZ() + offset[i][1]);

        FarmChunk farmChunk = CivGlobal.getFarmChunk(cc);
        if (farmChunk != null) {
            snapshots.add(farmChunk.getChunk().getChunkSnapshot());
        }

        cc.setFromLocation(windmill.getCorner().getLocation());
    }


    if (snapshots.size() == 0) {
        return;
    }

    /* Fire off an async task to do some post processing. */
    TaskMaster.asyncTask("", new WindmillPreProcessTask(windmill, snapshots), 0);

}
项目:PopulationDensity    文件:ScanRegionTask.java   
@SuppressWarnings("deprecation")
private Material getMaterialAt(Position position) {
    Material material = null;

    int chunkx = position.x / 16;
    int chunkz = position.z / 16;

    try {
        ChunkSnapshot snapshot = this.chunks[chunkx][chunkz];
        int materialID = snapshot.getBlockTypeId(position.x % 16, position.y, position.z % 16);
        material = Material.getMaterial(materialID);
    } catch (IndexOutOfBoundsException e) { }

    return material;
}
项目:NucleusFramework    文件:BuildableRegion.java   
public BuildChunkIterator (Region region, ChunkSnapshot snapshot, long segmentSize,
                           int xStart, int yStart, int zStart,
                           int xEnd, int yEnd, int zEnd) {

    super(region.getPlugin(), TaskConcurrency.ASYNC, segmentSize, xStart, yStart, zStart, xEnd, yEnd, zEnd);

    this.blocks = new ArrayDeque<>((int)this.getVolume());
    this.snapshot = snapshot;

    //noinspection ConstantConditions
    this.chunk = region.getWorld().getChunkAt(snapshot.getX(), snapshot.getZ());
}
项目:swu    文件:ChunkUtils.java   
/**
 * Copies the height map of the given ChunkSnapshot to the given HeightMap instance.
 * 
 * @param chunk The ChunkInfo to get the heights from.
 * @param map The height map to copy the values to.
 */
public static void copyHeightMap(ChunkSnapshot chunk, HeightMap map) {
    for (int x = 0; x < 16; x++) {
        for (int z = 0; z < 16; z++) {
            map.setHeightAt(x, z, chunk.getHighestBlockYAt(x, z));
        }
    }
}
项目:Subterranea    文件:ColumnPopulatorBase.java   
@Override
public void decorateColumn(int x, int z, ChunkSnapshot snapshot, Chunk chunk) {
    Material[] soilBlocks = getBiomeSoilBlocks();
    int soilBlockIndex = -1;

    Material lastMaterial = Material.getMaterial(snapshot.getBlockTypeId(x, snapshot.getHighestBlockYAt(x, z), z));

    for (int y = snapshot.getHighestBlockYAt(x, z) - 1; y >=0; y--) {
        Material thisMaterial = Material.getMaterial(snapshot.getBlockTypeId(x, y, z));

        // Look for an Air->Stone boundary going down
        if (lastMaterial == Material.AIR && thisMaterial == Material.STONE) {
            soilBlockIndex = soilBlocks.length - 1;
        }

        // Look for a Stone->Anything Else boundary going down
        if (lastMaterial == Material.STONE && thisMaterial != Material.STONE) {
            soilBlockIndex = -1;
        }

        if (soilBlockIndex > -1) {
            chunk.getBlock(x, y, z).setType(soilBlocks[soilBlockIndex]);
            soilBlockIndex--;
        }

        lastMaterial = thisMaterial;
    }
}
项目:Uranium    文件:CraftWorld.java   
public ChunkSnapshot getEmptyChunkSnapshot(int x, int z, boolean includeBiome, boolean includeBiomeTempRain) {
    return CraftChunk.getEmptyChunkSnapshot(x, z, this, includeBiome, includeBiomeTempRain);
}
项目:Uranium    文件:CraftChunk.java   
public ChunkSnapshot getChunkSnapshot() {
    return getChunkSnapshot(true, false, false);
}
项目:Uranium    文件:CraftChunk.java   
public static ChunkSnapshot getEmptyChunkSnapshot(int x, int z, CraftWorld world, boolean includeBiome, boolean includeBiomeTempRain) {
    net.minecraft.world.biome.BiomeGenBase[] biome = null;
    double[] biomeTemp = null;
    double[] biomeRain = null;

    if (includeBiome || includeBiomeTempRain) {
        net.minecraft.world.biome.WorldChunkManager wcm = world.getHandle().getWorldChunkManager();

        if (includeBiome) {
            biome = new net.minecraft.world.biome.BiomeGenBase[256];
            for (int i = 0; i < 256; i++) {
                biome[i] = world.getHandle().getBiomeGenForCoords((x << 4) + (i & 0xF), (z << 4) + (i >> 4));
            }
        }

        if (includeBiomeTempRain) {
            biomeTemp = new double[256];
            biomeRain = new double[256];
            float[] dat = getTemperatures(wcm, x << 4, z << 4);

            for (int i = 0; i < 256; i++) {
                biomeTemp[i] = dat[i];
            }

            dat = wcm.getRainfall(null, x << 4, z << 4, 16, 16);

            for (int i = 0; i < 256; i++) {
                biomeRain[i] = dat[i];
            }
        }
    }

    /* Fill with empty data */
    int hSection = world.getMaxHeight() >> 4;
    short[][] blockIDs = new short[hSection][];
    byte[][] skyLight = new byte[hSection][];
    byte[][] emitLight = new byte[hSection][];
    byte[][] blockData = new byte[hSection][];
    boolean[] empty = new boolean[hSection];

    for (int i = 0; i < hSection; i++) {
        blockIDs[i] = emptyBlockIDs;
        skyLight[i] = emptySkyLight;
        emitLight[i] = emptyData;
        blockData[i] = emptyData;
        empty[i] = true;
    }

    return new CraftChunkSnapshot(x, z, world.getName(), world.getFullTime(), blockIDs, blockData, skyLight, emitLight, empty, new int[256], biome, biomeTemp, biomeRain);
}
项目:MockBukkit    文件:WorldMock.java   
@Override
public ChunkSnapshot getEmptyChunkSnapshot(int x, int z, boolean includeBiome, boolean includeBiomeTempRain)
{
    // TODO Auto-generated method stub
    throw new UnimplementedOperationException();
}
项目:MockBukkit    文件:ChunkMock.java   
@Override
public ChunkSnapshot getChunkSnapshot()
{
    // TODO Auto-generated method stub
    throw new UnimplementedOperationException();
}
项目:MockBukkit    文件:ChunkMock.java   
@Override
public ChunkSnapshot getChunkSnapshot(boolean includeMaxblocky, boolean includeBiome, boolean includeBiomeTempRain)
{
    // TODO Auto-generated method stub
    throw new UnimplementedOperationException();
}
项目:factions-top    文件:ChunkPos.java   
public static ChunkPos of(ChunkSnapshot snapshot) {
    return new ChunkPos(snapshot.getWorldName(), snapshot.getX(), snapshot.getZ());
}
项目:factions-top    文件:ChunkWorthTask.java   
public void queue(ChunkSnapshot snapshot) {
    queue.add(snapshot);
}
项目:factions-top    文件:ChunkWorthTask.java   
@Override
public void run() {
    while (!isInterrupted()) {
        ChunkSnapshot snapshot;
        try {
            snapshot = queue.take();
        } catch (InterruptedException e) {
            interrupt();
            break;
        }

        ChunkPos pos = ChunkPos.of(snapshot);
        double worth = 0;
        double blockPrice;
        Map<Material, Integer> materials = new EnumMap<>(Material.class);

        for (int y = 0; y < 256; y++) {
            // ChunkSnapshot#getHighestBlockYAt(x, y) for whatever reason
            // provides us with a half complete chunk in Spigot v1.10.x. So
            // we're testing if the chunk section is empty instead.
            if (snapshot.isSectionEmpty(y >> 4)) {
                y += 15;
                continue;
            }

            for (int x = 0; x < 16; x++) {
                for (int z = 0; z < 16; z++) {
                    Material material = Material.getMaterial(snapshot.getBlockTypeId(x, y, z));
                    if (material == null) {
                        continue;
                    }

                    blockPrice = plugin.getSettings().getBlockPrice(material);
                    worth += blockPrice;

                    if (blockPrice != 0) {
                        int count = materials.getOrDefault(material, 0);
                        materials.put(material, count + 1);
                    }
                }
            }
        }

        final double worthFinal = worth;
        plugin.getServer().getScheduler().runTask(plugin, () -> {
            plugin.getWorthManager().set(pos, WorthType.BLOCK, worthFinal);
            plugin.getWorthManager().setMaterials(pos, materials);
        });
    }
}
项目:ThermosRebased    文件:CraftWorld.java   
public ChunkSnapshot getEmptyChunkSnapshot(int x, int z, boolean includeBiome, boolean includeBiomeTempRain) {
    return CraftChunk.getEmptyChunkSnapshot(x, z, this, includeBiome, includeBiomeTempRain);
}
项目:ThermosRebased    文件:CraftChunk.java   
public ChunkSnapshot getChunkSnapshot() {
    return getChunkSnapshot(true, false, false);
}
项目:ThermosRebased    文件:CraftChunk.java   
public static ChunkSnapshot getEmptyChunkSnapshot(int x, int z, CraftWorld world, boolean includeBiome, boolean includeBiomeTempRain) {
    net.minecraft.world.biome.BiomeGenBase[] biome = null;
    double[] biomeTemp = null;
    double[] biomeRain = null;

    if (includeBiome || includeBiomeTempRain) {
        net.minecraft.world.biome.WorldChunkManager wcm = world.getHandle().getWorldChunkManager();

        if (includeBiome) {
            biome = new net.minecraft.world.biome.BiomeGenBase[256];
            for (int i = 0; i < 256; i++) {
                biome[i] = world.getHandle().getBiomeGenForCoords((x << 4) + (i & 0xF), (z << 4) + (i >> 4));
            }
        }

        if (includeBiomeTempRain) {
            biomeTemp = new double[256];
            biomeRain = new double[256];
            float[] dat = getTemperatures(wcm, x << 4, z << 4);

            for (int i = 0; i < 256; i++) {
                biomeTemp[i] = dat[i];
            }

            dat = wcm.getRainfall(null, x << 4, z << 4, 16, 16);

            for (int i = 0; i < 256; i++) {
                biomeRain[i] = dat[i];
            }
        }
    }

    /* Fill with empty data */
    int hSection = world.getMaxHeight() >> 4;
    short[][] blockIDs = new short[hSection][];
    byte[][] skyLight = new byte[hSection][];
    byte[][] emitLight = new byte[hSection][];
    byte[][] blockData = new byte[hSection][];
    boolean[] empty = new boolean[hSection];

    for (int i = 0; i < hSection; i++) {
        blockIDs[i] = emptyBlockIDs;
        skyLight[i] = emptySkyLight;
        emitLight[i] = emptyData;
        blockData[i] = emptyData;
        empty[i] = true;
    }

    return new CraftChunkSnapshot(x, z, world.getName(), world.getFullTime(), blockIDs, blockData, skyLight, emitLight, empty, new int[256], biome, biomeTemp, biomeRain);
}
项目:ExilePearl    文件:TestChunk.java   
@Override
public ChunkSnapshot getChunkSnapshot() {
    return null;
}
项目:ExilePearl    文件:TestChunk.java   
@Override
public ChunkSnapshot getChunkSnapshot(boolean arg0, boolean arg1, boolean arg2) {
    return null;
}