use of mcjty.xnet.clientinfo.ControllerChannelClientInfo in project XNet by McJty.
the class TileEntityRouter method findLocalChannelInfo.
@Nonnull
private List<ControllerChannelClientInfo> findLocalChannelInfo(boolean onlyPublished) {
List<ControllerChannelClientInfo> list = new ArrayList<>();
LogicTools.connectors(getWorld(), getPos()).map(connectorPos -> LogicTools.getControllerForConnector(getWorld(), connectorPos)).filter(Objects::nonNull).forEach(controller -> {
for (int i = 0; i < MAX_CHANNELS; i++) {
ChannelInfo channelInfo = controller.getChannels()[i];
if (channelInfo != null && !channelInfo.getChannelName().isEmpty()) {
LocalChannelId id = new LocalChannelId(controller.getPos(), i);
String publishedName = publishedChannels.get(id);
if (publishedName == null) {
publishedName = "";
}
if ((!onlyPublished) || !publishedName.isEmpty()) {
ControllerChannelClientInfo ci = new ControllerChannelClientInfo(channelInfo.getChannelName(), publishedName, controller.getPos(), channelInfo.getType(), i);
list.add(ci);
}
}
}
});
return list;
}
use of mcjty.xnet.clientinfo.ControllerChannelClientInfo in project XNet by McJty.
the class GuiRouter method populateList.
private void populateList() {
if (!listsReady()) {
return;
}
if (!needsRefresh) {
return;
}
needsRefresh = false;
localChannelList.removeChildren();
localChannelList.setRowheight(40);
int sel = localChannelList.getSelected();
for (ControllerChannelClientInfo channel : fromServer_localChannels) {
localChannelList.addChild(makeChannelLine(channel, true));
}
localChannelList.setSelected(sel);
remoteChannelList.removeChildren();
remoteChannelList.setRowheight(40);
sel = remoteChannelList.getSelected();
for (ControllerChannelClientInfo channel : fromServer_remoteChannels) {
remoteChannelList.addChild(makeChannelLine(channel, false));
}
remoteChannelList.setSelected(sel);
}
use of mcjty.xnet.clientinfo.ControllerChannelClientInfo in project XNet by McJty.
the class TileEntityRouter method findRemoteChannelInfo.
@Nonnull
private List<ControllerChannelClientInfo> findRemoteChannelInfo() {
List<ControllerChannelClientInfo> list = new ArrayList<>();
NetworkId networkId = findRoutingNetwork();
if (networkId != null) {
LogicTools.consumers(getWorld(), networkId).forEach(consumerPos -> LogicTools.routers(getWorld(), consumerPos).filter(r -> r != this).forEach(router -> list.addAll(router.findLocalChannelInfo(true))));
}
return list;
}
Aggregations