Search in sources :

Example 1 with BlockCapBank

use of crazypants.enderio.powertools.machine.capbank.BlockCapBank in project EnderIO by SleepyTrousers.

the class CapBankBlockRenderMapper method renderBody.

@Override
@SideOnly(Side.CLIENT)
protected List<IBlockState> renderBody(@Nonnull IBlockStateWrapper state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, BlockRenderLayer blockLayer, @Nonnull QuadCollector quadCollector) {
    List<IBlockState> states = new ArrayList<IBlockState>();
    TileEntity tileEntity = state.getTileEntity();
    if (tileEntity instanceof TileCapBank && state.getBlock() instanceof BlockCapBank) {
        NNList.FACING.apply(new Callback<EnumFacing>() {

            @Override
            public void apply(@Nonnull EnumFacing face) {
                IoMode ioMode = ((TileCapBank) tileEntity).getIoMode(face);
                InfoDisplayType displayType = ((TileCapBank) tileEntity).getDisplayType(face);
                EnumIOMode iOMode = ((BlockCapBank) state.getBlock()).mapIOMode(displayType, ioMode);
                states.add(ModObject.block_machine_io.getBlockNN().getDefaultState().withProperty(IOMode.IO, IOMode.get(face, iOMode)));
            }
        });
    } else {
        states.add(state.getState().withProperty(RENDER, EnumMergingBlockRenderMode.sides).withProperty(CapBankType.KIND, CapBankType.NONE));
    }
    return states;
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) TileCapBank(crazypants.enderio.powertools.machine.capbank.TileCapBank) IBlockState(net.minecraft.block.state.IBlockState) BlockCapBank(crazypants.enderio.powertools.machine.capbank.BlockCapBank) EnumFacing(net.minecraft.util.EnumFacing) ArrayList(java.util.ArrayList) EnumIOMode(crazypants.enderio.base.render.property.IOMode.EnumIOMode) IoMode(crazypants.enderio.base.machine.modes.IoMode) InfoDisplayType(crazypants.enderio.powertools.machine.capbank.InfoDisplayType) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 2 with BlockCapBank

use of crazypants.enderio.powertools.machine.capbank.BlockCapBank in project EnderIO by SleepyTrousers.

the class FillGaugeBakery method countNeighbors.

private void countNeighbors() {
    if (world != null && pos != null) {
        height = 1;
        myOffset = 0;
        BlockPos other = pos;
        while (true) {
            other = other.up();
            IBlockState state = world.getBlockState(other);
            if (!(state.getBlock() instanceof BlockCapBank) || state.getValue(CapBankType.KIND) != bankType) {
                break;
            }
            IBlockState infrontOfOther = world.getBlockState(other.offset(face));
            @SuppressWarnings("null") boolean isCovered = infrontOfOther.isSideSolid(world, other.offset(face), face.getOpposite());
            if (isCovered) {
                break;
            }
            @SuppressWarnings("null") TileEntity tileEntity = BlockEnder.getAnyTileEntitySafe(world, other);
            if (!(tileEntity instanceof TileCapBank) || ((TileCapBank) tileEntity).getDisplayType(face) != InfoDisplayType.LEVEL_BAR) {
                break;
            }
            height++;
            connectUp = true;
        }
        other = pos;
        while (true) {
            other = other.down();
            IBlockState state = world.getBlockState(other);
            if (!(state.getBlock() instanceof BlockCapBank) || state.getValue(CapBankType.KIND) != bankType) {
                break;
            }
            IBlockState infrontOfOther = world.getBlockState(other.offset(face));
            @SuppressWarnings("null") boolean isCovered = infrontOfOther.isSideSolid(world, other.offset(face), face.getOpposite());
            if (isCovered) {
                break;
            }
            @SuppressWarnings("null") TileEntity tileEntity = BlockEnder.getAnyTileEntitySafe(world, other);
            if (!(tileEntity instanceof TileCapBank) || ((TileCapBank) tileEntity).getDisplayType(face) != InfoDisplayType.LEVEL_BAR) {
                break;
            }
            height++;
            myOffset++;
            connectDown = true;
        }
    }
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) TileCapBank(crazypants.enderio.powertools.machine.capbank.TileCapBank) IBlockState(net.minecraft.block.state.IBlockState) BlockCapBank(crazypants.enderio.powertools.machine.capbank.BlockCapBank) BlockPos(net.minecraft.util.math.BlockPos)

Aggregations

BlockCapBank (crazypants.enderio.powertools.machine.capbank.BlockCapBank)2 TileCapBank (crazypants.enderio.powertools.machine.capbank.TileCapBank)2 IBlockState (net.minecraft.block.state.IBlockState)2 TileEntity (net.minecraft.tileentity.TileEntity)2 IoMode (crazypants.enderio.base.machine.modes.IoMode)1 EnumIOMode (crazypants.enderio.base.render.property.IOMode.EnumIOMode)1 InfoDisplayType (crazypants.enderio.powertools.machine.capbank.InfoDisplayType)1 ArrayList (java.util.ArrayList)1 EnumFacing (net.minecraft.util.EnumFacing)1 BlockPos (net.minecraft.util.math.BlockPos)1 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)1