Search in sources :

Example 1 with EnumIOMode

use of crazypants.enderio.base.render.property.IOMode.EnumIOMode in project EnderIO by SleepyTrousers.

the class ReservoirBlockRenderMapper method mapOverlayLayer.

@Override
@SideOnly(Side.CLIENT)
public EnumMap<EnumFacing, EnumIOMode> mapOverlayLayer(@Nonnull IBlockStateWrapper state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, boolean isPainted) {
    TileEntity tileEntity = state.getTileEntity();
    if ((tileEntity instanceof TileReservoir) && ((TileReservoir) tileEntity).isAutoEject()) {
        EnumMap<EnumFacing, EnumIOMode> result = new EnumMap<EnumFacing, EnumIOMode>(EnumFacing.class);
        for (NNIterator<EnumFacing> itr = NNList.FACING.fastIterator(); itr.hasNext(); ) {
            EnumFacing face = itr.next();
            IBlockState neighborState = world.getBlockState(pos.offset(face));
            if (!isSameKind(state, neighborState)) {
                result.put(face, EnumIOMode.RESERVOIR);
            }
        }
        return result.isEmpty() ? null : result;
    }
    return null;
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) IBlockState(net.minecraft.block.state.IBlockState) EnumFacing(net.minecraft.util.EnumFacing) EnumIOMode(crazypants.enderio.base.render.property.IOMode.EnumIOMode) EnumMap(java.util.EnumMap) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 2 with EnumIOMode

use of crazypants.enderio.base.render.property.IOMode.EnumIOMode in project EnderIO by SleepyTrousers.

the class InvPanelRenderMapper method renderIO.

@Override
@SideOnly(Side.CLIENT)
protected EnumMap<EnumFacing, EnumIOMode> renderIO(@Nonnull AbstractMachineEntity tileEntity, @Nonnull AbstractMachineBlock<?> block) {
    EnumMap<EnumFacing, EnumIOMode> result = new EnumMap<EnumFacing, EnumIOMode>(EnumFacing.class);
    EnumFacing face = tileEntity.getFacing().getOpposite();
    IoMode ioMode = tileEntity.getIoMode(face);
    if (ioMode != IoMode.NONE) {
        result.put(face, block.mapIOMode(ioMode, face));
        return result;
    }
    return null;
}
Also used : EnumFacing(net.minecraft.util.EnumFacing) EnumIOMode(crazypants.enderio.base.render.property.IOMode.EnumIOMode) IoMode(crazypants.enderio.base.machine.modes.IoMode) EnumMap(java.util.EnumMap) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 3 with EnumIOMode

use of crazypants.enderio.base.render.property.IOMode.EnumIOMode in project EnderIO by SleepyTrousers.

the class ImpulseRenderMapper method renderIO.

@SideOnly(Side.CLIENT)
protected EnumMap<EnumFacing, EnumIOMode> renderIO(@Nonnull TileImpulseHopper tileEntity, @Nonnull BlockImpulseHopper block) {
    EnumMap<EnumFacing, EnumIOMode> result = new EnumMap<EnumFacing, EnumIOMode>(EnumFacing.class);
    for (EnumFacing face : EnumFacing.values()) {
        IoMode ioMode = tileEntity.getIoMode(face);
        if (ioMode != IoMode.NONE) {
            EnumIOMode iOMode = mapIOMode(ioMode);
            result.put(face, iOMode);
        }
    }
    return result.isEmpty() ? null : result;
}
Also used : EnumFacing(net.minecraft.util.EnumFacing) EnumIOMode(crazypants.enderio.base.render.property.IOMode.EnumIOMode) IoMode(crazypants.enderio.base.machine.modes.IoMode) EnumMap(java.util.EnumMap) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 4 with EnumIOMode

use of crazypants.enderio.base.render.property.IOMode.EnumIOMode 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 5 with EnumIOMode

use of crazypants.enderio.base.render.property.IOMode.EnumIOMode in project EnderIO by SleepyTrousers.

the class MachineRenderMapper method renderIO.

@SideOnly(Side.CLIENT)
protected EnumMap<EnumFacing, EnumIOMode> renderIO(@Nonnull AbstractMachineEntity tileEntity, @Nonnull AbstractMachineBlock<?> block) {
    EnumMap<EnumFacing, EnumIOMode> result = new EnumMap<EnumFacing, EnumIOMode>(EnumFacing.class);
    for (EnumFacing face : EnumFacing.values()) {
        IoMode ioMode = tileEntity.getIoMode(face);
        if (ioMode != IoMode.NONE) {
            EnumIOMode iOMode = block.mapIOMode(ioMode, face);
            result.put(face, iOMode);
        }
    }
    return result.isEmpty() ? null : result;
}
Also used : EnumFacing(net.minecraft.util.EnumFacing) EnumIOMode(crazypants.enderio.base.render.property.IOMode.EnumIOMode) IoMode(crazypants.enderio.base.machine.modes.IoMode) EnumMap(java.util.EnumMap) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Aggregations

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