private Set<EnumFacing> getVisibleFacings(BlockPos pos) { VisGraph visgraph = new VisGraph(); BlockPos blockpos = new BlockPos(pos.getX() >> 4 << 4, pos.getY() >> 4 << 4, pos.getZ() >> 4 << 4); Chunk chunk = this.theWorld.getChunkFromBlockCoords(blockpos); for (BlockPos.MutableBlockPos blockpos$mutableblockpos : BlockPos.getAllInBoxMutable(blockpos, blockpos.add(15, 15, 15))) { if (chunk.getBlockState(blockpos$mutableblockpos).isOpaqueCube()) { visgraph.setOpaqueCube(blockpos$mutableblockpos); } } return visgraph.getVisibleFacings(pos); }
private Set<EnumFacing> getVisibleFacings(BlockPos pos) { VisGraph visgraph = new VisGraph(); BlockPos blockpos = new BlockPos(pos.getX() >> 4 << 4, pos.getY() >> 4 << 4, pos.getZ() >> 4 << 4); Chunk chunk = this.theWorld.getChunkFromBlockCoords(blockpos); for (BlockPos.MutableBlockPos blockpos$mutableblockpos : BlockPos.getAllInBoxMutable(blockpos, blockpos.add(15, 15, 15))) { if (chunk.getBlock(blockpos$mutableblockpos).isOpaqueCube()) { visgraph.func_178606_a(blockpos$mutableblockpos); } } return visgraph.func_178609_b(pos); }
private Set getVisibleFacings(BlockPos pos) { VisGraph visgraph = new VisGraph(); BlockPos blockpos = new BlockPos(pos.getX() >> 4 << 4, pos.getY() >> 4 << 4, pos.getZ() >> 4 << 4); Chunk chunk = this.theWorld.getChunkFromBlockCoords(blockpos); for (BlockPos.MutableBlockPos blockpos$mutableblockpos : BlockPos.getAllInBoxMutable(blockpos, blockpos.add(15, 15, 15))) { if (chunk.getBlock(blockpos$mutableblockpos).isOpaqueCube()) { visgraph.func_178606_a(blockpos$mutableblockpos); } } return visgraph.func_178609_b(pos); }
private Set<EnumFacing> getVisibleFacings(BlockPos pos) { VisGraph visibility = new VisGraph(); BlockPos cornerPos = new BlockPos(pos.getX() >> 4 << 4, pos.getY() >> 4 << 4, pos.getZ() >> 4 << 4); Chunk chunk = this.blockSystem.getChunkFromBlockCoords(cornerPos); for (BlockPos.MutableBlockPos blockPos : BlockPos.getAllInBoxMutable(cornerPos, cornerPos.add(15, 15, 15))) { if (chunk.getBlockState(blockPos).isOpaqueCube()) { visibility.setOpaqueCube(blockPos); } } return visibility.getVisibleFacings(pos); }
public ComputeVisibilityEvent(VisGraph visGraph, SetVisibility setVisibility) { this.visGraph = visGraph; this.setVisibility = setVisibility; }
public VisGraph getVisGraph() { return visGraph; }
@Override public void rebuildChunk(float x, float y, float z, ChunkCompileTaskGenerator generator) { CompiledChunk compiledchunk = new CompiledChunk(); BlockPos blockpos = this.position; BlockPos blockpos1 = blockpos.add(15, 15, 15); generator.getLock().lock(); RegionRenderCache regionrendercache; try { if (generator.getStatus() != ChunkCompileTaskGenerator.Status.COMPILING) { return; } regionrendercache = new RegionRenderCacheBlocksteps(this.world, blockpos.add(-1, -1, -1), blockpos1.add(1, 1, 1), 1); generator.setCompiledChunk(compiledchunk); } finally { generator.getLock().unlock(); } VisGraph visgraph = new VisGraph(); Minecraft mc = Minecraft.getMinecraft(); if (!regionrendercache.extendedLevelsInChunkCache()) { ++renderChunksUpdated; Iterator iterator = BlockPos.getAllInBoxMutable(blockpos, blockpos1).iterator(); while (iterator.hasNext()) { BlockPos.MutableBlockPos mutableblockpos = (BlockPos.MutableBlockPos)iterator.next(); IBlockState iblockstate = regionrendercache.getBlockState(mutableblockpos); Block block = iblockstate.getBlock(); if(Blocksteps.config.mapType == 2) { synchronized(Blocksteps.eventHandler.threadCrawlBlocks.surface) { renderBlock(mutableblockpos, iblockstate, block, visgraph, regionrendercache, generator, compiledchunk, blockpos, mc); } } else { renderBlock(mutableblockpos, iblockstate, block, visgraph, regionrendercache, generator, compiledchunk, blockpos, mc); } } BlockRenderLayer[] aenumworldblocklayer = BlockRenderLayer.values(); int j = aenumworldblocklayer.length; for (int k = 0; k < j; ++k) { BlockRenderLayer enumworldblocklayer = aenumworldblocklayer[k]; if (compiledchunk.isLayerStarted(enumworldblocklayer)) { this.postRenderBlocks(enumworldblocklayer, x, y, z, generator.getRegionRenderCacheBuilder().getWorldRendererByLayer(enumworldblocklayer), compiledchunk); } } } compiledchunk.setVisibility(visgraph.computeVisibility()); }
public void renderBlock(BlockPos.MutableBlockPos mutableblockpos, IBlockState iblockstate, Block block, VisGraph visgraph, RegionRenderCache regionrendercache, ChunkCompileTaskGenerator generator, CompiledChunk compiledchunk, BlockPos blockpos, Minecraft mc) { boolean hasBlock = ChunkStore.contains(mutableblockpos) || Blocksteps.config.mapType == 3 || Blocksteps.config.mapType == 4; if (block.isOpaqueCube()) { visgraph.func_178606_a(mutableblockpos); } if (hasBlock && block.hasTileEntity(iblockstate)) { TileEntity tileentity = regionrendercache.getTileEntity(new BlockPos(mutableblockpos)); if (tileentity != null && TileEntityRendererDispatcher.instance.hasSpecialRenderer(tileentity)) { compiledchunk.addTileEntity(tileentity); } } for(BlockRenderLayer enumworldblocklayer1 : BlockRenderLayer.values()) { if(!block.canRenderInLayer(enumworldblocklayer1)) continue; net.minecraftforge.client.ForgeHooksClient.setRenderLayer(enumworldblocklayer1); int i = enumworldblocklayer1.ordinal(); if (block.getDefaultState().getRenderType() != EnumBlockRenderType.INVISIBLE) { WorldRenderer worldrenderer = generator.getRegionRenderCacheBuilder().getWorldRendererByLayerId(i); if (!compiledchunk.isLayerStarted(enumworldblocklayer1)) { compiledchunk.setLayerStarted(enumworldblocklayer1); this.preRenderBlocks(worldrenderer, blockpos); } if (hasBlock && mc.getBlockRendererDispatcher().renderBlock(iblockstate, mutableblockpos, regionrendercache, worldrenderer)) { compiledchunk.setLayerUsed(enumworldblocklayer1); } } } }