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;
}
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;
}
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;
}
Aggregations