Search in sources :

Example 1 with ComputerScreenModule

use of mcjty.rftools.blocks.screens.modules.ComputerScreenModule in project RFTools by McJty.

the class ScreenControllerTileEntity method clearText.

private Object[] clearText(String tag) {
    for (Coordinate screen : connectedScreens) {
        TileEntity te = worldObj.getTileEntity(screen.getX(), screen.getY(), screen.getZ());
        if (te instanceof ScreenTileEntity) {
            ScreenTileEntity screenTileEntity = (ScreenTileEntity) te;
            List<ComputerScreenModule> computerScreenModules = screenTileEntity.getComputerModules(tag);
            if (computerScreenModules != null) {
                for (ComputerScreenModule screenModule : computerScreenModules) {
                    screenModule.clearText();
                }
            }
        }
    }
    return null;
}
Also used : GenericEnergyReceiverTileEntity(mcjty.lib.entity.GenericEnergyReceiverTileEntity) TileEntity(net.minecraft.tileentity.TileEntity) Coordinate(mcjty.lib.varia.Coordinate) ComputerScreenModule(mcjty.rftools.blocks.screens.modules.ComputerScreenModule)

Example 2 with ComputerScreenModule

use of mcjty.rftools.blocks.screens.modules.ComputerScreenModule in project RFTools by McJty.

the class ScreenControllerTileEntity method addText.

private Object[] addText(String tag, String text, int color) {
    for (Coordinate screen : connectedScreens) {
        TileEntity te = worldObj.getTileEntity(screen.getX(), screen.getY(), screen.getZ());
        if (te instanceof ScreenTileEntity) {
            ScreenTileEntity screenTileEntity = (ScreenTileEntity) te;
            List<ComputerScreenModule> computerScreenModules = screenTileEntity.getComputerModules(tag);
            if (computerScreenModules != null) {
                for (ComputerScreenModule screenModule : computerScreenModules) {
                    screenModule.addText(text, color);
                }
            }
        }
    }
    return null;
}
Also used : GenericEnergyReceiverTileEntity(mcjty.lib.entity.GenericEnergyReceiverTileEntity) TileEntity(net.minecraft.tileentity.TileEntity) Coordinate(mcjty.lib.varia.Coordinate) ComputerScreenModule(mcjty.rftools.blocks.screens.modules.ComputerScreenModule)

Example 3 with ComputerScreenModule

use of mcjty.rftools.blocks.screens.modules.ComputerScreenModule in project RFTools by McJty.

the class ScreenTileEntity method getScreenModules.

// This is called server side.
public List<ScreenModule> getScreenModules() {
    if (screenModules == null) {
        totalRfPerTick = 0;
        screenModules = new ArrayList<ScreenModule>();
        for (int i = 0; i < inventoryHelper.getCount(); i++) {
            ItemStack itemStack = inventoryHelper.getStackInSlot(i);
            if (itemStack != null && itemStack.getItem() instanceof ModuleProvider) {
                ModuleProvider moduleProvider = (ModuleProvider) itemStack.getItem();
                ScreenModule screenModule;
                try {
                    screenModule = moduleProvider.getServerScreenModule().newInstance();
                } catch (InstantiationException e) {
                    e.printStackTrace();
                    continue;
                } catch (IllegalAccessException e) {
                    e.printStackTrace();
                    continue;
                }
                screenModule.setupFromNBT(itemStack.getTagCompound(), worldObj.provider.dimensionId, xCoord, yCoord, zCoord);
                screenModules.add(screenModule);
                totalRfPerTick += screenModule.getRfPerTick();
                if (screenModule instanceof ComputerScreenModule) {
                    ComputerScreenModule computerScreenModule = (ComputerScreenModule) screenModule;
                    String tag = computerScreenModule.getTag();
                    if (!computerModules.containsKey(tag)) {
                        computerModules.put(tag, new ArrayList<ComputerScreenModule>());
                    }
                    computerModules.get(tag).add(computerScreenModule);
                }
            } else {
                // To keep the indexing correct so that the modules correspond with there slot number.
                screenModules.add(null);
            }
        }
    }
    return screenModules;
}
Also used : ScreenModule(mcjty.rftools.blocks.screens.modules.ScreenModule) ComputerScreenModule(mcjty.rftools.blocks.screens.modules.ComputerScreenModule) ClientScreenModule(mcjty.rftools.blocks.screens.modulesclient.ClientScreenModule) ItemStack(net.minecraft.item.ItemStack) ComputerScreenModule(mcjty.rftools.blocks.screens.modules.ComputerScreenModule)

Aggregations

ComputerScreenModule (mcjty.rftools.blocks.screens.modules.ComputerScreenModule)3 GenericEnergyReceiverTileEntity (mcjty.lib.entity.GenericEnergyReceiverTileEntity)2 Coordinate (mcjty.lib.varia.Coordinate)2 TileEntity (net.minecraft.tileentity.TileEntity)2 ScreenModule (mcjty.rftools.blocks.screens.modules.ScreenModule)1 ClientScreenModule (mcjty.rftools.blocks.screens.modulesclient.ClientScreenModule)1 ItemStack (net.minecraft.item.ItemStack)1