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


Java ExtendedBlockStorage.get方法代码示例

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


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

示例1: 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

示例2: 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

示例3: getBlockState

import net.minecraft.world.chunk.storage.ExtendedBlockStorage; //导入方法依赖的package包/类
public IBlockState getBlockState(final BlockPos pos)
{
    if (this.worldObj.getWorldType() == WorldType.DEBUG_WORLD)
    {
        IBlockState iblockstate = null;

        if (pos.getY() == 60)
        {
            iblockstate = Blocks.barrier.getDefaultState();
        }

        if (pos.getY() == 70)
        {
            iblockstate = ChunkProviderDebug.func_177461_b(pos.getX(), pos.getZ());
        }

        return iblockstate == null ? Blocks.air.getDefaultState() : iblockstate;
    }
    else
    {
        try
        {
            if (pos.getY() >= 0 && pos.getY() >> 4 < this.storageArrays.length)
            {
                ExtendedBlockStorage extendedblockstorage = this.storageArrays[pos.getY() >> 4];

                if (extendedblockstorage != null)
                {
                    int j = pos.getX() & 15;
                    int k = pos.getY() & 15;
                    int i = pos.getZ() & 15;
                    return extendedblockstorage.get(j, k, i);
                }
            }

            return Blocks.air.getDefaultState();
        }
        catch (Throwable throwable)
        {
            CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Getting block state");
            CrashReportCategory crashreportcategory = crashreport.makeCategory("Block being got");
            crashreportcategory.addCrashSectionCallable("Location", new Callable<String>()
            {
                public String call() throws Exception
                {
                    return CrashReportCategory.getCoordinateInfo(pos);
                }
            });
            throw new ReportedException(crashreport);
        }
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:53,代码来源:Chunk.java

示例4: getBlockState

import net.minecraft.world.chunk.storage.ExtendedBlockStorage; //导入方法依赖的package包/类
public IBlockState getBlockState(final int x, final int y, final int z)
{
    if (this.worldObj.getWorldType() == WorldType.DEBUG_WORLD)
    {
        IBlockState iblockstate = null;

        if (y == 60)
        {
            iblockstate = Blocks.BARRIER.getDefaultState();
        }

        if (y == 70)
        {
            iblockstate = ChunkProviderDebug.getBlockStateFor(x, z);
        }

        return iblockstate == null ? Blocks.AIR.getDefaultState() : iblockstate;
    }
    else
    {
        try
        {
            if (y >= 0 && y >> 4 < this.storageArrays.length)
            {
                ExtendedBlockStorage extendedblockstorage = this.storageArrays[y >> 4];

                if (extendedblockstorage != NULL_BLOCK_STORAGE)
                {
                    return extendedblockstorage.get(x & 15, y & 15, z & 15);
                }
            }

            return Blocks.AIR.getDefaultState();
        }
        catch (Throwable throwable)
        {
            CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Getting block state");
            CrashReportCategory crashreportcategory = crashreport.makeCategory("Block being got");
            crashreportcategory.setDetail("Location", new ICrashReportDetail<String>()
            {
                public String call() throws Exception
                {
                    return CrashReportCategory.getCoordinateInfo(x, y, z);
                }
            });
            throw new ReportedException(crashreport);
        }
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:50,代码来源:Chunk.java


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