Fixes #4741: Rework Crafting CPU cycling and extract commonalities into a separate class. (#4742)

Also Fixes:
- Enter key confirms the "Confirm Crafting" dialog again
- Right Mouse Button correctly cycles backwards through CPUs, while left mouse button forward
- Fixes an internal problem with syncing CPU names
- Naming of unnamed CPUs begins at #1 now
This commit is contained in:
shartte
2020-09-20 00:26:34 +02:00
committed by GitHub
parent 971a9d22e8
commit e6fb553a53
13 changed files with 279 additions and 284 deletions
@@ -66,7 +66,7 @@ public class CraftingCPUContainer extends AEBaseContainer implements IMEMonitorH
private final IItemList<IAEItemStack> list = Api.instance().storage().getStorageChannel(IItemStorageChannel.class)
.createList();
private IGrid network;
private final IGrid network;
private CraftingCPUCluster monitor = null;
@GuiSync(0)
@@ -81,7 +81,9 @@ public class CraftingCPUContainer extends AEBaseContainer implements IMEMonitorH
final IActionHost host = (IActionHost) (te instanceof IActionHost ? te : null);
if (host != null && host.getActionableNode() != null) {
this.setNetwork(host.getActionableNode().getGrid());
this.network = host.getActionableNode().getGrid();
} else {
this.network = null;
}
if (te instanceof CraftingTileEntity) {
@@ -118,13 +120,13 @@ public class CraftingCPUContainer extends AEBaseContainer implements IMEMonitorH
}
if (c instanceof CraftingCPUCluster) {
this.setMonitor((CraftingCPUCluster) c);
this.monitor = (CraftingCPUCluster) c;
this.list.resetStatus();
this.getMonitor().getListOfItem(this.list, CraftingItemList.ALL);
this.getMonitor().addListener(this, null);
this.setEstimatedTime(0);
} else {
this.setMonitor(null);
this.monitor = null;
this.setEstimatedTime(-1);
}
}
@@ -232,15 +234,8 @@ public class CraftingCPUContainer extends AEBaseContainer implements IMEMonitorH
return this.monitor;
}
private void setMonitor(final CraftingCPUCluster monitor) {
this.monitor = monitor;
}
IGrid getNetwork() {
return this.network;
}
private void setNetwork(final IGrid network) {
this.network = network;
}
}