当前位置: 首页>>代码示例>>Java>>正文


Java Chunk.getBlockStorageArray方法代码示例

本文整理汇总了Java中net.minecraft.world.chunk.Chunk.getBlockStorageArray方法的典型用法代码示例。如果您正苦于以下问题:Java Chunk.getBlockStorageArray方法的具体用法?Java Chunk.getBlockStorageArray怎么用?Java Chunk.getBlockStorageArray使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraft.world.chunk.Chunk的用法示例。


在下文中一共展示了Chunk.getBlockStorageArray方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: updateChunk

import net.minecraft.world.chunk.Chunk; //导入方法依赖的package包/类
/**
 * Gets a chunk from the chunk coordinates, then adds it
 * to the queue if it exists and is not already in the queue.
 * @param x chunk coordinate
 * @param z chunk coordinate
 * @return if the chunk exists
 */
public boolean updateChunk(int x, int z) {
	Chunk chunk = mc.world.getChunkFromChunkCoords(x, z);
	ExtendedBlockStorage[] storage = chunk.getBlockStorageArray();
	for (int y = 0; y < 16; y++) {
		if (storage[y] != null) {
			updateChunk(chunk);
			return true;
		}
	}
	return false;
}
 
开发者ID:18107,项目名称:MC-Ray-Tracer,代码行数:19,代码来源:WorldLoader.java

示例2: updateChunkFirst

import net.minecraft.world.chunk.Chunk; //导入方法依赖的package包/类
/**
 * Gets a chunk from the chunk coordinates, then adds it
 * to the beginning of the queue if it exists.
 * @param x chunk coordinate
 * @param z chunk coordinate
 * @return if the chunk exists
 */
public boolean updateChunkFirst(int x, int z) {
	Chunk chunk = mc.world.getChunkFromChunkCoords(x, z);
	ExtendedBlockStorage[] storage = chunk.getBlockStorageArray();
	for (int y = 0; y < 16; y++) {
		if (storage[y] != null) {
			updateChunkFirst(chunk);
			return true;
		}
	}
	return false;
}
 
开发者ID:18107,项目名称:MC-Ray-Tracer,代码行数:19,代码来源:WorldLoader.java

示例3: reloadChunk

import net.minecraft.world.chunk.Chunk; //导入方法依赖的package包/类
private void reloadChunk(Chunk chunk, int chunkX, int chunkZ, int renderDistance, Shader shader) {
	
	for (int y = 0; y < 16; y++) {
		ExtendedBlockStorage storage = chunk.getBlockStorageArray()[y];
		int id = worldChunks[chunkZ*(renderDistance*2-1)*16 + chunkX*16 + y];
		int metadataId = worldMetadata[chunkZ*(renderDistance*2-1)*16 + chunkX*16 + y];
		if (storage == null) {
			if (id == 0) {
				//do nothing
				continue;
			} else {
				//remove chunk
				worldChunks[chunkZ*(renderDistance*2-1)*16 + chunkX*16 + y] = 0;
				chunkIdList.push(id);
				if (metadataId != 0) {
					worldMetadata[chunkZ*(renderDistance*2-1)*16 + chunkX*16 + y] = 0;
					metadataIdList.push(metadataId);
				}
				continue;
			}
		} else {
			if (id == 0) {
				//create chunk
				id = chunkIdList.pop();
				worldChunks[chunkZ*(renderDistance*2-1)*16 + chunkX*16 + y] = id;
			}
			if (metadataId == 0) {
				metadataId = metadataIdList.pop();
				worldMetadata[chunkZ*(renderDistance*2-1)*16 + chunkX*16 + y] = metadataId;
			}
		}
		loadChunk(id, shader, storage);
		loadMetadata(metadataId, shader, storage);
	}
}
 
开发者ID:18107,项目名称:MC-Ray-Tracer,代码行数:36,代码来源:WorldLoader.java

示例4: extractChunkData

import net.minecraft.world.chunk.Chunk; //导入方法依赖的package包/类
public int extractChunkData(PacketBuffer p_189555_1_, Chunk p_189555_2_, boolean p_189555_3_, int p_189555_4_)
{
    int i = 0;
    ExtendedBlockStorage[] aextendedblockstorage = p_189555_2_.getBlockStorageArray();
    int j = 0;

    for (int k = aextendedblockstorage.length; j < k; ++j)
    {
        ExtendedBlockStorage extendedblockstorage = aextendedblockstorage[j];

        if (extendedblockstorage != Chunk.NULL_BLOCK_STORAGE && (!this.doChunkLoad() || !extendedblockstorage.isEmpty()) && (p_189555_4_ & 1 << j) != 0)
        {
            i |= 1 << j;
            extendedblockstorage.getData().write(p_189555_1_);
            p_189555_1_.writeBytes(extendedblockstorage.getBlocklightArray().getData());

            if (p_189555_3_)
            {
                p_189555_1_.writeBytes(extendedblockstorage.getSkylightArray().getData());
            }
        }
    }

    if (this.doChunkLoad())
    {
        p_189555_1_.writeBytes(p_189555_2_.getBiomeArray());
    }

    return i;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:31,代码来源:SPacketChunkData.java

示例5: calculateChunkSize

import net.minecraft.world.chunk.Chunk; //导入方法依赖的package包/类
protected int calculateChunkSize(Chunk chunkIn, boolean p_189556_2_, int p_189556_3_)
{
    int i = 0;
    ExtendedBlockStorage[] aextendedblockstorage = chunkIn.getBlockStorageArray();
    int j = 0;

    for (int k = aextendedblockstorage.length; j < k; ++j)
    {
        ExtendedBlockStorage extendedblockstorage = aextendedblockstorage[j];

        if (extendedblockstorage != Chunk.NULL_BLOCK_STORAGE && (!this.doChunkLoad() || !extendedblockstorage.isEmpty()) && (p_189556_3_ & 1 << j) != 0)
        {
            i = i + extendedblockstorage.getData().getSerializedSize();
            i = i + extendedblockstorage.getBlocklightArray().getData().length;

            if (p_189556_2_)
            {
                i += extendedblockstorage.getSkylightArray().getData().length;
            }
        }
    }

    if (this.doChunkLoad())
    {
        i += chunkIn.getBiomeArray().length;
    }

    return i;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:30,代码来源:SPacketChunkData.java

示例6: getStorage

import net.minecraft.world.chunk.Chunk; //导入方法依赖的package包/类
/**
 * Get block storage array for y-coordinate
 * Returns null in case block is outside
 * @param chunk Target chunk
 * @param y Block height inside chunk
 * @return Block storage or null
 */
private static ExtendedBlockStorage getStorage(Chunk chunk, int y) {
    ExtendedBlockStorage[] storage = chunk.getBlockStorageArray();
    if (y < 0 || y >= 256) {
        return null;
    }
    int i = y >> 4;
    if (storage[i] == Chunk.NULL_BLOCK_STORAGE) {
        storage[i] = new ExtendedBlockStorage(i << 4, !chunk.getWorld().provider.getHasNoSky());
        chunk.generateSkylightMap();
    }
    return storage[i];
}
 
开发者ID:ternsip,项目名称:StructPro,代码行数:20,代码来源:UWorld.java

示例7: getStorage

import net.minecraft.world.chunk.Chunk; //导入方法依赖的package包/类
/**
 * Get block storage array for y-coordinate
 * Returns null in case block is outside
 * @param chunk Target chunk
 * @param y Block height inside chunk
 * @return Block storage or null
 */
private static ExtendedBlockStorage getStorage(Chunk chunk, int y) {
    ExtendedBlockStorage[] storage = chunk.getBlockStorageArray();
    if (y < 0 || y >= 256) {
        return null;
    }
    int i = y >> 4;
    if (storage[i] == Chunk.NULL_BLOCK_STORAGE) {
        storage[i] = new ExtendedBlockStorage(i << 4, chunk.getWorld().provider.hasSkyLight());
        chunk.generateSkylightMap();
    }
    return storage[i];
}
 
开发者ID:ternsip,项目名称:StructPro,代码行数:20,代码来源:UWorld.java

示例8: getStorage

import net.minecraft.world.chunk.Chunk; //导入方法依赖的package包/类
/**
 * Get block storage array for y-coordinate
 * Returns null in case block is outside
 * @param chunk Target chunk
 * @param y Block height inside chunk
 * @return Block storage or null
 */
private static ExtendedBlockStorage getStorage(Chunk chunk, int y) {
    ExtendedBlockStorage[] storage = chunk.getBlockStorageArray();
    if (y < 0 || y >= 256) {
        return null;
    }
    int i = y >> 4;
    if (storage[i] == null) {
        storage[i] = new ExtendedBlockStorage(i << 4, !chunk.worldObj.provider.hasNoSky);
        chunk.generateSkylightMap();
    }
    return storage[i];
}
 
开发者ID:ternsip,项目名称:StructPro,代码行数:20,代码来源:UWorld.java

示例9: moveX

import net.minecraft.world.chunk.Chunk; //导入方法依赖的package包/类
private void moveX(Shader shader, int centerX, int centerZ, int renderDistance, boolean positive) {
	//deallocate chunks
	for (int z = 0; z < renderDistance*2-1; z++) {
		for (int y = 0; y < 16; y++) {
			int chunkId = worldChunks[z*(renderDistance*2-1)*16 + (positive ? 0 : renderDistance*2-2)*16 + y];
			if (chunkId != 0) {
				chunkIdList.push(chunkId);
			}
			int metadataId = worldMetadata[z*(renderDistance*2-1)*16 + (positive ? 0 : renderDistance*2-2)*16 + y];
			if (metadataId != 0) {
				metadataIdList.push(metadataId);
			}
		}
	}
	
	//shift chunks
	if (positive) {
		for (int z = 0; z < renderDistance*2-1; z++) {
			for (int x = 0; x < renderDistance*2-2; x++) {
				for (int y = 0; y < 16; y++) {
					worldChunks[z*(renderDistance*2-1)*16 + x*16 + y] =
							worldChunks[z*(renderDistance*2-1)*16 + (x+1)*16 + y];
					worldMetadata[z*(renderDistance*2-1)*16 + x*16 + y] =
							worldMetadata[z*(renderDistance*2-1)*16 + (x+1)*16 + y];
				}
			}
		}
	} else {
		for (int z = 0; z < renderDistance*2-1; z++) {
			for (int x = renderDistance*2-2; x > 0; x--) {
				for (int y = 0; y < 16; y++) {
					worldChunks[z*(renderDistance*2-1)*16 + x*16 + y] =
							worldChunks[z*(renderDistance*2-1)*16 + (x-1)*16 + y];
					worldMetadata[z*(renderDistance*2-1)*16 + x*16 + y] =
							worldMetadata[z*(renderDistance*2-1)*16 + (x-1)*16 + y];
				}
			}
		}
	}
	
	//allocate new chunks
	int chunkX = centerX + (positive ? renderDistance-1 : -(renderDistance-1));
	for (int z = 0; z < renderDistance*2-1; z++) {
		int chunkZ = centerZ+z-(renderDistance-1);
		Chunk chunk = mc.world.getChunkFromChunkCoords(chunkX, chunkZ);
		ExtendedBlockStorage[] storage = chunk.getBlockStorageArray();
		for (int y = 0; y < 16; y++) {
			worldChunks[z*(renderDistance*2-1)*16 + (positive ? renderDistance*2-2 : 0)*16 + y] = 0;
			worldMetadata[z*(renderDistance*2-1)*16 + (positive ? renderDistance*2-2 : 0)*16 + y] = 0;
			if (storage[y] != null) {
				updateChunk(chunk);
			}
		}
	}
	
	playerChunkX += positive ? 1 : -1;
}
 
开发者ID:18107,项目名称:MC-Ray-Tracer,代码行数:58,代码来源:WorldLoader.java

示例10: moveZ

import net.minecraft.world.chunk.Chunk; //导入方法依赖的package包/类
private void moveZ(Shader shader, int centerX, int centerZ, int renderDistance, boolean positive) {
	//deallocate chunks
	for (int x = 0; x < renderDistance*2-1; x++) {
		for (int y = 0; y < 16; y++) {
			int chunkId = worldChunks[(positive ? 0 : renderDistance*2-2)*(renderDistance*2-1)*16 + x*16 + y];
			if (chunkId != 0) {
				chunkIdList.push(chunkId);
			}
			int metadataId = worldMetadata[(positive ? 0 : renderDistance*2-2)*(renderDistance*2-1)*16 + x*16 + y];
			if (metadataId != 0) {
				metadataIdList.push(metadataId);
			}
		}
	}

	//shift chunks
	if (positive) {
		for (int z = 0; z < renderDistance*2-2; z++) {
			for (int x = 0; x < renderDistance*2-1; x++) {
				for (int y = 0; y < 16; y++) {
					worldChunks[z*(renderDistance*2-1)*16 + x*16 + y] =
							worldChunks[(z+1)*(renderDistance*2-1)*16 + x*16 + y];
					worldMetadata[z*(renderDistance*2-1)*16 + x*16 + y] =
							worldMetadata[(z+1)*(renderDistance*2-1)*16 + x*16 + y];
				}
			}
		}
	} else {
		for (int z = renderDistance*2-2; z > 0; z--) {
			for (int x = 0; x < renderDistance*2-1; x++) {
				for (int y = 0; y < 16; y++) {
					worldChunks[z*(renderDistance*2-1)*16 + x*16 + y] =
							worldChunks[(z-1)*(renderDistance*2-1)*16 + x*16 + y];
					worldMetadata[z*(renderDistance*2-1)*16 + x*16 + y] =
							worldMetadata[(z-1)*(renderDistance*2-1)*16 + x*16 + y];
				}
			}
		}
	}

	//allocate new chunks
	int chunkZ = centerZ + (positive ? renderDistance-1 : -(renderDistance-1));
	for (int x = 0; x < renderDistance*2-1; x++) {
		int chunkX = centerX+x-(renderDistance-1);
		Chunk chunk = mc.world.getChunkFromChunkCoords(chunkX, chunkZ);
		ExtendedBlockStorage[] storage = chunk.getBlockStorageArray();
		for (int y = 0; y < 16; y++) {
			worldChunks[(positive ? renderDistance*2-2 : 0)*(renderDistance*2-1)*16 + x*16 + y] = 0;
			worldMetadata[(positive ? renderDistance*2-2 : 0)*(renderDistance*2-1)*16 + x*16 + y] = 0;
			if (storage[y] != null) {
				updateChunk(chunk);
			}
		}
	}
	
	playerChunkZ += positive ? 1 : -1;
}
 
开发者ID:18107,项目名称:MC-Ray-Tracer,代码行数:58,代码来源:WorldLoader.java

示例11: func_179756_a

import net.minecraft.world.chunk.Chunk; //导入方法依赖的package包/类
public static S21PacketChunkData.Extracted func_179756_a(Chunk p_179756_0_, boolean p_179756_1_, boolean p_179756_2_, int p_179756_3_)
{
    ExtendedBlockStorage[] aextendedblockstorage = p_179756_0_.getBlockStorageArray();
    S21PacketChunkData.Extracted s21packetchunkdata$extracted = new S21PacketChunkData.Extracted();
    List<ExtendedBlockStorage> list = Lists.<ExtendedBlockStorage>newArrayList();

    for (int i = 0; i < aextendedblockstorage.length; ++i)
    {
        ExtendedBlockStorage extendedblockstorage = aextendedblockstorage[i];

        if (extendedblockstorage != null && (!p_179756_1_ || !extendedblockstorage.isEmpty()) && (p_179756_3_ & 1 << i) != 0)
        {
            s21packetchunkdata$extracted.dataSize |= 1 << i;
            list.add(extendedblockstorage);
        }
    }

    s21packetchunkdata$extracted.data = new byte[func_180737_a(Integer.bitCount(s21packetchunkdata$extracted.dataSize), p_179756_2_, p_179756_1_)];
    int j = 0;

    for (ExtendedBlockStorage extendedblockstorage1 : list)
    {
        char[] achar = extendedblockstorage1.getData();

        for (char c0 : achar)
        {
            s21packetchunkdata$extracted.data[j++] = (byte)(c0 & 255);
            s21packetchunkdata$extracted.data[j++] = (byte)(c0 >> 8 & 255);
        }
    }

    for (ExtendedBlockStorage extendedblockstorage2 : list)
    {
        j = func_179757_a(extendedblockstorage2.getBlocklightArray().getData(), s21packetchunkdata$extracted.data, j);
    }

    if (p_179756_2_)
    {
        for (ExtendedBlockStorage extendedblockstorage3 : list)
        {
            j = func_179757_a(extendedblockstorage3.getSkylightArray().getData(), s21packetchunkdata$extracted.data, j);
        }
    }

    if (p_179756_1_)
    {
        func_179757_a(p_179756_0_.getBiomeArray(), s21packetchunkdata$extracted.data, j);
    }

    return s21packetchunkdata$extracted;
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:52,代码来源:S21PacketChunkData.java


注:本文中的net.minecraft.world.chunk.Chunk.getBlockStorageArray方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。