BlockPos pos = Minecraft.getMinecraft().objectMouseOver.getBlockPos(); IBlockState state = world.getBlockState(pos); state = state.getActualState(world, pos); state = state.getBlock().getExtendedState(state, world, pos); if (state instanceof IExtendedBlockState) {
@Override public @Nonnull IBlockState getActualState(@Nonnull IBlockAccess blockAccess, @Nonnull BlockPos pos1) { return state.getActualState(blockAccess, pos1); }
@Override public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, IBlockAccess worldIn, BlockPos pos) { blockState = blockState.getActualState(worldIn, pos); return CLIP_AABB_BY_INDEX[getAABBIndex(blockState)]; }
blockState = blockState.getActualState( facadeAccess, pos );
@Override public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) { state = state.getActualState(source, pos); return BOUNDING_BOX[getBoundingBoxId(state)]; }
@Override public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) { state = state.getActualState(source, pos); return AABB_BY_INDEX[getAABBIndex(state)]; }
@Override @SuppressWarnings("deprecation") public boolean isSideSolid(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing side) { return state.getActualState(world, pos).getValue(FULL); }
/** * Gets the actual state of the block. * * @param world The world. * @param pos The position. * @return The actual block state. */ public static IBlockState getActualState (World world, BlockPos pos) { return world.getBlockState(pos).getActualState(world, pos); }
@Override @SuppressWarnings("deprecation") public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) { // todo: depend on fill level? return state.getActualState(source, pos).getValue(FULL) ? FULL_BLOCK_AABB : AABB; }
public Section getSection() { if (section != null) return section; else { IBlockState state = world.getBlockState(pos); IBlockState actualState = state.getActualState(world, pos); section = actualState.getValue(BlockTrough.SECTION); } return section; }
@Override public boolean isFireSource(World world, BlockPos pos, EnumFacing side) { return world.getBlockState(pos).getActualState(world, pos).getValue(LIT); } }
public EnumFacing getFacing() { if (facing != null) return facing; else { IBlockState state = world.getBlockState(pos); IBlockState actualState = state.getActualState(world, pos); facing = actualState.getValue(BlockTrough.FACING); } return facing; } }
@Override public boolean isBurning(IBlockAccess world, BlockPos pos) { return world.getBlockState(pos).getActualState(world, pos).getValue(LIT); }
@Override @ParametersAreNonnullByDefault public int getLightValue(IBlockState state, IBlockAccess world, BlockPos pos) { if (state.getBlock() instanceof BlockTurretBase) { return state.getActualState(world, pos).getValue(LIGHT_VALUE); } return super.getLightValue(state, world, pos); }
@Override public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) { boolean pipe = state.getActualState(source, pos).getValue(ON_PIPE); float minX = 6.5F * BlockRuptureDisc.UNIT; float minY = 6.5F * BlockRuptureDisc.UNIT; float minZ = (pipe ? -4F : 0F) * BlockRuptureDisc.UNIT; float maxX = 9.5F * BlockRuptureDisc.UNIT; float maxY = 16F * BlockRuptureDisc.UNIT; float maxZ = (pipe ? 1.5F : 5.5F) * BlockRuptureDisc.UNIT; return WorldHelper.getDirectionalBoundingBox(state.getValue(FACING), minX, minY, minZ, maxX, maxY, maxZ, false); } }
@Override public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) { boolean pipe = state.getActualState(source, pos).getValue(ON_PIPE); float minX = 4 * UNIT; float minY = 4 * UNIT; float minZ = pipe ? -5 * UNIT : 0F; float maxX = 12 * UNIT; float maxY = 12 * UNIT; float maxZ = pipe ? -2 * UNIT + 0.0005F : 3 * UNIT; return WorldHelper.getDirectionalBoundingBox(state.getValue(FACING), minX, minY, minZ, maxX, maxY, maxZ, true); } }
@Override public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) { boolean pipe = state.getActualState(source, pos).getValue(ON_PIPE); float minX = 4 * BlockRuptureDisc.UNIT; float minY = 4 * BlockRuptureDisc.UNIT; float minZ = pipe ? -4 * BlockRuptureDisc.UNIT : 0F; float maxX = 12 * BlockRuptureDisc.UNIT; float maxY = 12 * BlockRuptureDisc.UNIT; float maxZ = pipe ? -3 * BlockRuptureDisc.UNIT + 0.0005F : BlockRuptureDisc.UNIT; return WorldHelper.getDirectionalBoundingBox(state.getValue(FACING), minX, minY, minZ, maxX, maxY, maxZ, false); }
@Override @SideOnly(Side.CLIENT) public AxisAlignedBB getSelectedBoundingBox(IBlockState state, World world, BlockPos pos) { AxisAlignedBB box = AABB_NONE.offset(pos); state = state.getActualState(world, pos); for (EnumFacing side : EnumFacing.VALUES) { if (state.getValue(PROPERTIES.get(side)).isHollow() == false) { box = box.union(AABB_SIDES.get(side).offset(pos)); } } return box; }
@Override public void apply(@Nonnull BlockPos pos) { IBlockState bs = world.getBlockState(pos); Block block = bs.getBlock(); bs = bs.getActualState(world, pos); if (block.canRenderInLayer(bs, layer)) { renderBlock(bs, pos, world, Tessellator.getInstance().getBuffer()); } } });
protected boolean canConnect(IBlockAccess world, BlockPos pos, EnumFacing direction, IBlockState state) { if ((state.getBlock() instanceof ElectricFenceWireBlock && ((ElectricFenceWireBlock) state.getBlock()).getType().equals(type)) || (state.getBlock() instanceof ElectricFencePoleBlock) && ((ElectricFencePoleBlock) state.getBlock()).getType().equals(type)) { return true; } else { IBlockState down = world.getBlockState(pos.down()); if (down.getBlock() instanceof ElectricFenceWireBlock && down.getActualState(world, pos).getValue(ElectricFenceWireBlock.UP_DIRECTION).getOpposite() == direction) { return true; } } return false; }