Skip to content

Commit

Permalink
add all terminals to the universal terminal in the creative tab (fix #…
Browse files Browse the repository at this point in the history
  • Loading branch information
Mari023 committed May 23, 2024
1 parent 618ea9d commit 68956c4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/main/java/de/mari_023/ae2wtlib/AE2wtlib.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ static void addToCreativeTab() {
AE2wtlibCreativeTab.addTerminal(AEItems.WIRELESS_CRAFTING_TERMINAL.asItem());
AE2wtlibCreativeTab.addTerminal(AE2wtlibItems.PATTERN_ENCODING_TERMINAL);
AE2wtlibCreativeTab.addTerminal(AE2wtlibItems.PATTERN_ACCESS_TERMINAL);
AE2wtlibCreativeTab.addTerminal(AE2wtlibItems.UNIVERSAL_TERMINAL);
AE2wtlibCreativeTab.addUniversalTerminal(AE2wtlibItems.UNIVERSAL_TERMINAL);
AE2wtlibCreativeTab.add(AE2wtlibItems.QUANTUM_BRIDGE_CARD);
AE2wtlibCreativeTab.add(AE2wtlibItems.MAGNET_CARD);
}
Expand Down
14 changes: 13 additions & 1 deletion src/main/java/de/mari_023/ae2wtlib/AE2wtlibCreativeTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,18 @@
import appeng.api.config.Actionable;
import appeng.items.tools.powered.WirelessTerminalItem;

import de.mari_023.ae2wtlib.wut.ItemWUT;
import de.mari_023.ae2wtlib.wut.WUTHandler;
import de.mari_023.ae2wtlib.wut.recipe.Common;

public class AE2wtlibCreativeTab {
private static final List<ItemStack> items = new ArrayList<>();

public static void init() {
var tab = CreativeModeTab.builder()
.title(TextConstants.CREATIVE_TAB)
.icon(() -> {
var terminal = AE2wtlibItems.UNIVERSAL_TERMINAL;
var terminal = AE2wtlibItems.UNIVERSAL_TERMINAL;
var stack = new ItemStack(terminal);
terminal.injectAEPower(stack, terminal.getAEMaxPower(stack), Actionable.MODULATE);
return stack;
Expand All @@ -40,6 +44,14 @@ public static synchronized void addTerminal(WirelessTerminalItem terminal) {
items.add(stack);
}

public static synchronized void addUniversalTerminal(ItemWUT wut) {
var stack = new ItemStack(wut);
items.add(stack.copy());
for (var terminal : WUTHandler.wirelessTerminals.entrySet()) {
Common.mergeTerminal(stack, new ItemStack(terminal.getValue().item()), terminal.getKey());
}
}

private static synchronized void buildDisplayItems(CreativeModeTab.ItemDisplayParameters itemDisplayParameters,
CreativeModeTab.Output output) {
output.acceptAll(items);
Expand Down

0 comments on commit 68956c4

Please sign in to comment.