Java Code Examples for net.minecraft.block.state.IBlockState#getActualState()
The following examples show how to use
net.minecraft.block.state.IBlockState#getActualState() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BlockYubaNoren.java From TofuCraftReload with MIT License | 6 votes |
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) { state = state.getActualState(source, pos); EnumFacing enumfacing = (EnumFacing) state.getValue(FACING); switch (enumfacing) { case EAST: return EAST_AABB; case SOUTH: return SOUTH_AABB; case WEST: return WEST_AABB; case NORTH: default: return NORTH_AABB; } }
Example 2
Source File: BlockNoren.java From Sakura_mod with MIT License | 6 votes |
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) { state = state.getActualState(source, pos); EnumFacing enumfacing = state.getValue(FACING); switch (enumfacing) { case EAST: return EAST_AABB; case SOUTH: return SOUTH_AABB; case WEST: return WEST_AABB; case NORTH: default: return NORTH_AABB; } }
Example 3
Source File: BlockPortalPanel.java From enderutilities with GNU Lesser General Public License v3.0 | 6 votes |
@Override public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess blockAccess, BlockPos pos) { state = state.getActualState(blockAccess, pos); switch (state.getValue(FACING)) { case EAST: return PANEL_BOUNDS_EAST; case WEST: return PANEL_BOUNDS_WEST; case NORTH: return PANEL_BOUNDS_NORTH; case SOUTH: return PANEL_BOUNDS_SOUTH; case UP: return PANEL_BOUNDS_UP; default: return PANEL_BOUNDS_DOWN; } }
Example 4
Source File: BlockElevatorSlab.java From enderutilities with GNU Lesser General Public License v3.0 | 6 votes |
@Override public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess blockAccess, BlockPos pos) { if (this == EnderUtilitiesBlocks.ELEVATOR_SLAB) { state = state.getActualState(blockAccess, pos); return state.getValue(HALF) == EnumBlockHalf.TOP ? BOUNDS_SLAB_TOP : BOUNDS_SLAB_BOTTOM; } else if (this == EnderUtilitiesBlocks.ELEVATOR_LAYER) { state = state.getActualState(blockAccess, pos); return state.getValue(HALF) == EnumBlockHalf.TOP ? BOUNDS_LAYER_TOP : BOUNDS_LAYER_BOTTOM; } return FULL_BLOCK_AABB; }
Example 5
Source File: RenderEventHandler.java From enderutilities with GNU Lesser General Public License v3.0 | 6 votes |
@SubscribeEvent public void onBlockHilight(DrawBlockHighlightEvent event) { RayTraceResult trace = event.getTarget(); if (trace != null && trace.typeOfHit == RayTraceResult.Type.BLOCK) { World world = this.mc.world; BlockPos pos = trace.getBlockPos(); IBlockState state = world.getBlockState(pos); Block block = state.getBlock(); if (block == EnderUtilitiesBlocks.PORTAL_PANEL || block == EnderUtilitiesBlocks.INSERTER) { state = state.getActualState(world, pos); this.updatePointedBlockHilight(world, trace.getBlockPos(), state, (BlockEnderUtilities) block, event.getPartialTicks()); } if (block == EnderUtilitiesBlocks.PORTAL_PANEL) { this.renderPortalPanelText(this.mc.world, trace.getBlockPos(), (BlockEnderUtilities) block, this.mc.player, event.getPartialTicks()); } } }
Example 6
Source File: OverlayRenderer.java From litematica with GNU Lesser General Public License v3.0 | 5 votes |
private void updateBlockInfoLines(RayTraceWrapper traceWrapper, Minecraft mc) { this.blockInfoLines.clear(); BlockPos pos = traceWrapper.getRayTraceResult().getBlockPos(); IBlockState stateClient = mc.world.getBlockState(pos); stateClient = stateClient.getActualState(mc.world, pos); World worldSchematic = SchematicWorldHandler.getSchematicWorld(); IBlockState stateSchematic = worldSchematic.getBlockState(pos); stateSchematic = stateSchematic.getActualState(worldSchematic, pos); IBlockState air = Blocks.AIR.getDefaultState(); String ul = GuiBase.TXT_UNDERLINE; if (stateSchematic != stateClient && stateSchematic != air && stateClient != air) { this.blockInfoLines.add(ul + "Schematic:"); this.addBlockInfoLines(stateSchematic); this.blockInfoLines.add(""); this.blockInfoLines.add(ul + "Client:"); this.addBlockInfoLines(stateClient); } else if (traceWrapper.getHitType() == RayTraceWrapper.HitType.SCHEMATIC_BLOCK) { this.blockInfoLines.add(ul + "Schematic:"); this.addBlockInfoLines(stateSchematic); } }
Example 7
Source File: BlockBeaconPost.java From Cyberware with MIT License | 5 votes |
public void addCollisionBoxToList(IBlockState state, World worldIn, BlockPos pos, AxisAlignedBB entityBox, List<AxisAlignedBB> collidingBoxes, @Nullable Entity entityIn) { state = state.getActualState(worldIn, pos); if (state.getValue(TRANSFORMED) > 0) { addCollisionBoxToList(pos, entityBox, collidingBoxes, getBoundingBox(state, worldIn, pos)); return; } addCollisionBoxToList(pos, entityBox, collidingBoxes, PILLAR_AABB); if (((Boolean)state.getValue(NORTH)).booleanValue()) { addCollisionBoxToList(pos, entityBox, collidingBoxes, NORTH_AABB); } if (((Boolean)state.getValue(EAST)).booleanValue()) { addCollisionBoxToList(pos, entityBox, collidingBoxes, EAST_AABB); } if (((Boolean)state.getValue(SOUTH)).booleanValue()) { addCollisionBoxToList(pos, entityBox, collidingBoxes, SOUTH_AABB); } if (((Boolean)state.getValue(WEST)).booleanValue()) { addCollisionBoxToList(pos, entityBox, collidingBoxes, WEST_AABB); } }
Example 8
Source File: BlockInfo.java From enderutilities with GNU Lesser General Public License v3.0 | 5 votes |
public static BlockInfo getBlockInfo(World world, BlockPos pos) { IBlockState state = world.getBlockState(pos); IBlockState stateActual = state.getActualState(world, pos); Block block = state.getBlock(); @SuppressWarnings("deprecation") ItemStack stack = block.getItem(world, pos, state); return new BlockInfo(state, stateActual, block, block.getMetaFromState(state), stack.isEmpty() == false ? stack.getMetadata() : 0); }
Example 9
Source File: RenderChunkSchematicVbo.java From litematica with GNU Lesser General Public License v3.0 | 4 votes |
protected void renderBlocksAndOverlay(BlockPos pos, Set<TileEntity> tileEntities, boolean[] usedLayers, CompiledChunkSchematic data, BufferBuilderCache buffers) { IBlockState stateSchematic = this.schematicWorldView.getBlockState(pos); IBlockState stateClient = this.clientWorldView.getBlockState(pos); stateSchematic = stateSchematic.getActualState(this.schematicWorldView, pos); stateClient = stateClient.getActualState(this.clientWorldView, pos); Block blockSchematic = stateSchematic.getBlock(); Block blockClient = stateClient.getBlock(); boolean clientHasAir = blockClient == Blocks.AIR; boolean schematicHasAir = blockSchematic == Blocks.AIR; if (clientHasAir && schematicHasAir) { return; } // Schematic has a block, client has air if (clientHasAir || (stateSchematic != stateClient && this.renderColliding)) { if (blockSchematic.hasTileEntity()) { this.addTileEntity(pos, data, tileEntities); } BlockRenderLayer layer = this.renderAsTranslucent ? BlockRenderLayer.TRANSLUCENT : blockSchematic.getRenderLayer(); int layerIndex = layer.ordinal(); if (stateSchematic.getRenderType() != EnumBlockRenderType.INVISIBLE) { BufferBuilder bufferSchematic = buffers.getWorldRendererByLayerId(layerIndex); if (data.isLayerStarted(layer) == false) { data.setLayerStarted(layer); this.preRenderBlocks(bufferSchematic, this.getPosition()); } usedLayers[layerIndex] |= this.renderGlobal.renderBlock(stateSchematic, pos, this.schematicWorldView, bufferSchematic); } } if (this.overlayEnabled) { OverlayType type = this.getOverlayType(stateSchematic, stateClient); Color4f overlayColor = this.getOverlayColor(type); if (overlayColor != null) { this.renderOverlay(pos, stateSchematic, type, overlayColor, data, buffers); } } }