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


Java ExtendedBlockStorage类代码示例

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


ExtendedBlockStorage类属于net.minecraft.world.chunk.storage包,在下文中一共展示了ExtendedBlockStorage类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getBlock0

import net.minecraft.world.chunk.storage.ExtendedBlockStorage; //导入依赖的package包/类
/**
 * Returns the block corresponding to the given coordinates inside a chunk.
 */
private Block getBlock0(int x, int y, int z)
{
    Block block = Blocks.air;

    if (y >= 0 && y >> 4 < this.storageArrays.length)
    {
        ExtendedBlockStorage extendedblockstorage = this.storageArrays[y >> 4];

        if (extendedblockstorage != null)
        {
            try
            {
                block = extendedblockstorage.getBlockByExtId(x, y & 15, z);
            }
            catch (Throwable throwable)
            {
                CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Getting block");
                throw new ReportedException(crashreport);
            }
        }
    }

    return block;
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:28,代码来源:Chunk.java

示例2: getLightSubtracted

import net.minecraft.world.chunk.storage.ExtendedBlockStorage; //导入依赖的package包/类
public int getLightSubtracted(BlockPos pos, int amount)
{
    int i = pos.getX() & 15;
    int j = pos.getY();
    int k = pos.getZ() & 15;
    ExtendedBlockStorage extendedblockstorage = this.storageArrays[j >> 4];

    if (extendedblockstorage == null)
    {
        return !this.worldObj.provider.getHasNoSky() && amount < EnumSkyBlock.SKY.defaultLightValue ? EnumSkyBlock.SKY.defaultLightValue - amount : 0;
    }
    else
    {
        int l = this.worldObj.provider.getHasNoSky() ? 0 : extendedblockstorage.getExtSkylightValue(i, j & 15, k);
        l = l - amount;
        int i1 = extendedblockstorage.getExtBlocklightValue(i, j & 15, k);

        if (i1 > l)
        {
            l = i1;
        }

        return l;
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:26,代码来源:Chunk.java

示例3: getAreLevelsEmpty

import net.minecraft.world.chunk.storage.ExtendedBlockStorage; //导入依赖的package包/类
/**
 * Returns whether the ExtendedBlockStorages containing levels (in blocks) from arg 1 to arg 2 are fully empty
 * (true) or not (false).
 */
public boolean getAreLevelsEmpty(int startY, int endY)
{
    if (startY < 0)
    {
        startY = 0;
    }

    if (endY >= 256)
    {
        endY = 255;
    }

    for (int i = startY; i <= endY; i += 16)
    {
        ExtendedBlockStorage extendedblockstorage = this.storageArrays[i >> 4];

        if (extendedblockstorage != null && !extendedblockstorage.isEmpty())
        {
            return false;
        }
    }

    return true;
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:29,代码来源:Chunk.java

示例4: Chunk

import net.minecraft.world.chunk.storage.ExtendedBlockStorage; //导入依赖的package包/类
public Chunk(World worldIn, int x, int z)
{
    this.storageArrays = new ExtendedBlockStorage[16];
    this.blockBiomeArray = new byte[256];
    this.precipitationHeightMap = new int[256];
    this.updateSkylightColumns = new boolean[256];
    this.chunkTileEntityMap = Maps.<BlockPos, TileEntity>newHashMap();
    this.queuedLightChecks = 4096;
    this.tileEntityPosQueue = Queues.<BlockPos>newConcurrentLinkedQueue();
    this.entityLists = (ClassInheritanceMultiMap[])(new ClassInheritanceMultiMap[16]);
    this.worldObj = worldIn;
    this.xPosition = x;
    this.zPosition = z;
    this.heightMap = new int[256];

    for (int i = 0; i < this.entityLists.length; ++i)
    {
        this.entityLists[i] = new ClassInheritanceMultiMap(Entity.class);
    }

    Arrays.fill((int[])this.precipitationHeightMap, (int) - 999);
    Arrays.fill(this.blockBiomeArray, (byte) - 1);
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:24,代码来源:Chunk.java

示例5: getLightSubtracted

import net.minecraft.world.chunk.storage.ExtendedBlockStorage; //导入依赖的package包/类
public int getLightSubtracted(BlockPos pos, int amount)
{
    int i = pos.getX() & 15;
    int j = pos.getY();
    int k = pos.getZ() & 15;
    ExtendedBlockStorage extendedblockstorage = this.storageArrays[j >> 4];

    if (extendedblockstorage == NULL_BLOCK_STORAGE)
    {
        return this.worldObj.provider.func_191066_m() && amount < EnumSkyBlock.SKY.defaultLightValue ? EnumSkyBlock.SKY.defaultLightValue - amount : 0;
    }
    else
    {
        int l = !this.worldObj.provider.func_191066_m() ? 0 : extendedblockstorage.getExtSkylightValue(i, j & 15, k);
        l = l - amount;
        int i1 = extendedblockstorage.getExtBlocklightValue(i, j & 15, k);

        if (i1 > l)
        {
            l = i1;
        }

        return l;
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:26,代码来源:Chunk.java

示例6: getAreLevelsEmpty

import net.minecraft.world.chunk.storage.ExtendedBlockStorage; //导入依赖的package包/类
/**
 * Returns whether the ExtendedBlockStorages containing levels (in blocks) from arg 1 to arg 2 are fully empty
 * (true) or not (false).
 */
public boolean getAreLevelsEmpty(int startY, int endY)
{
    if (startY < 0)
    {
        startY = 0;
    }

    if (endY >= 256)
    {
        endY = 255;
    }

    for (int i = startY; i <= endY; i += 16)
    {
        ExtendedBlockStorage extendedblockstorage = this.storageArrays[i >> 4];

        if (extendedblockstorage != NULL_BLOCK_STORAGE && !extendedblockstorage.isEmpty())
        {
            return false;
        }
    }

    return true;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:29,代码来源:Chunk.java

示例7: getLightSubtracted

import net.minecraft.world.chunk.storage.ExtendedBlockStorage; //导入依赖的package包/类
public int getLightSubtracted(BlockPos pos, int amount)
{
    int i = pos.getX() & 15;
    int j = pos.getY();
    int k = pos.getZ() & 15;
    ExtendedBlockStorage extendedblockstorage = this.storageArrays[j >> 4];

    if (extendedblockstorage == NULL_BLOCK_STORAGE)
    {
        return !this.worldObj.provider.getHasNoSky() && amount < EnumSkyBlock.SKY.defaultLightValue ? EnumSkyBlock.SKY.defaultLightValue - amount : 0;
    }
    else
    {
        int l = this.worldObj.provider.getHasNoSky() ? 0 : extendedblockstorage.getExtSkylightValue(i, j & 15, k);
        l = l - amount;
        int i1 = extendedblockstorage.getExtBlocklightValue(i, j & 15, k);

        if (i1 > l)
        {
            l = i1;
        }

        return l;
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:26,代码来源:Chunk.java

示例8: updateChunk

import net.minecraft.world.chunk.storage.ExtendedBlockStorage; //导入依赖的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

示例9: updateChunkFirst

import net.minecraft.world.chunk.storage.ExtendedBlockStorage; //导入依赖的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

示例10: getStorage

import net.minecraft.world.chunk.storage.ExtendedBlockStorage; //导入依赖的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

示例11: loadChunk

import net.minecraft.world.chunk.storage.ExtendedBlockStorage; //导入依赖的package包/类
private void loadChunk(int id, Shader shader, ExtendedBlockStorage storage) {
	ObjectIntIdentityMap<IBlockState> map = GameData.getBlockStateIDMap();
	int[] data = new int[chunkSize*2];
	for (int y = 0; y < 16; y++) {
		for (int z = 0; z < 16; z++) {
			for (int x = 0; x < 16; x++) {
				IBlockState state = storage.get(x, y, z);
				boolean fullBlock = state.isFullBlock();
				boolean cube = state.isFullCube();
				if (fullBlock != cube) {
					Log.info(state.getBlock().getUnlocalizedName() + ": " + fullBlock);
				}
				if (fullBlock) {
					stateSet.add(state);
				}
				int stateId = map.get(state); //TODO
				data[(y<<9) + (z<<5) + (x<<1)] = Block.getIdFromBlock(storage.get(x, y, z).getBlock());
			}
		}
	}
	
	for (int y = 0; y < 16; y++) {
		for (int z = 0; z < 16; z++) {
			for (int x = 0; x < 16; x++) {
				data[(y<<9) + (z<<5) + (x<<1) + 1] = storage.getBlocklightArray().get(x, y, z);
			}
		}
	}
	
	IntBuffer buffer = BufferUtils.createIntBuffer(chunkSize*2);
	buffer.put(data);
	buffer.flip();
	GL15.glBindBuffer(GL43.GL_SHADER_STORAGE_BUFFER, shader.getChunkSsbo());
	GL15.glBufferSubData(GL43.GL_SHADER_STORAGE_BUFFER, (id-1)*chunkSize*2*4, buffer);
	GL15.glBindBuffer(GL43.GL_SHADER_STORAGE_BUFFER, 0);
}
 
开发者ID:18107,项目名称:MC-Ray-Tracer,代码行数:37,代码来源:WorldLoader.java

示例12: loadMetadata

import net.minecraft.world.chunk.storage.ExtendedBlockStorage; //导入依赖的package包/类
/**
 * 
 * @param id
 * @param shader
 * @param storage
 * @return true if the id was used, false if there was nothing to upload
 */
private boolean loadMetadata(int id, Shader shader, ExtendedBlockStorage storage) {
	int[] data = new int[chunkSize];
	boolean containsValues = false;
	for (int y = 0; y < 16; y++) {
		for (int z = 0; z < 16; z++) {
			for (int x = 0; x < 16; x++) {
				int metadata = storage.get(x, y, z).getBlock().getMetaFromState(storage.get(x, y, z));
				data[(y<<8) + (z<<4) + x] = metadata;
				if (metadata != 0) {
					containsValues = true;
				}
			}
		}
	}
	
	if (containsValues) {
		IntBuffer buffer = BufferUtils.createIntBuffer(chunkSize);
		buffer.put(data);
		buffer.flip();
		GL15.glBindBuffer(GL43.GL_SHADER_STORAGE_BUFFER, shader.getMetadataSsbo());
		GL15.glBufferSubData(GL43.GL_SHADER_STORAGE_BUFFER, (id-1)*chunkSize*4, buffer);
		GL15.glBindBuffer(GL43.GL_SHADER_STORAGE_BUFFER, 0);
	}
	
	return containsValues;
}
 
开发者ID:18107,项目名称:MC-Ray-Tracer,代码行数:34,代码来源:WorldLoader.java

示例13: getBlockState

import net.minecraft.world.chunk.storage.ExtendedBlockStorage; //导入依赖的package包/类
/**
 * Get block state from the world
 * @param pos Block position
 * @return Block state
 */
public UBlockState getBlockState(UBlockPos pos) {
    ExtendedBlockStorage storage = getStorage(world.getChunkFromBlockCoords(pos.getBlockPos()), pos.getY());
    if (storage != null) {
        return new UBlockState(storage.get(pos.getX() & 15, pos.getY() & 15, pos.getZ() & 15));
    }
    return UBlocks.AIR.getState();
}
 
开发者ID:ternsip,项目名称:StructPro,代码行数:13,代码来源:UWorld.java

示例14: Chunk

import net.minecraft.world.chunk.storage.ExtendedBlockStorage; //导入依赖的package包/类
public Chunk(World worldIn, ChunkPrimer primer, int x, int z)
{
    this(worldIn, x, z);
    int i = 256;
    boolean flag = !worldIn.provider.getHasNoSky();

    for (int j = 0; j < 16; ++j)
    {
        for (int k = 0; k < 16; ++k)
        {
            for (int l = 0; l < i; ++l)
            {
                int i1 = j * i * 16 | k * i | l;
                IBlockState iblockstate = primer.getBlockState(i1);

                if (iblockstate.getBlock().getMaterial() != Material.air)
                {
                    int j1 = l >> 4;

                    if (this.storageArrays[j1] == null)
                    {
                        this.storageArrays[j1] = new ExtendedBlockStorage(j1 << 4, flag);
                    }

                    this.storageArrays[j1].set(j, l & 15, k, iblockstate);
                }
            }
        }
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:31,代码来源:Chunk.java

示例15: updateBlock

import net.minecraft.world.chunk.storage.ExtendedBlockStorage; //导入依赖的package包/类
/**
 * Updates queued data
 * @param pos Block position to update
 */
public void updateBlock(UBlockPos pos) {
    ExtendedBlockStorage storage = getStorage(world.getChunkFromBlockCoords(pos.getBlockPos()), pos.getY());
    if (storage != null) {
        UBlockState state = getBlockState(pos);
        UBlock block = state.getBlock();
        try {
            world.notifyNeighborsOfStateChange(pos.getBlockPos(), block.getBlock(), true);
            world.immediateBlockTick(pos.getBlockPos(), state.getState(), new Random());
            world.notifyLightSet(pos.getBlockPos());
        } catch (Throwable ignored) {}
    }
}
 
开发者ID:ternsip,项目名称:StructPro,代码行数:17,代码来源:UWorld.java


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