Skip to content

Commit

Permalink
Properly register AE2WTLib integration menu
Browse files Browse the repository at this point in the history
  • Loading branch information
62832 committed Nov 17, 2024
1 parent 38289cc commit 372f710
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
5 changes: 1 addition & 4 deletions src/main/java/gripe/_90/appliede/AppliedE.java
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,6 @@ public final class AppliedE {
id("main"), () -> PROTOCOL_VERSION, PROTOCOL_VERSION::equals, PROTOCOL_VERSION::equals);

static {
if (Addons.AE2WTLIB.isLoaded()) {
MENU_TYPES.register("wireless_transmutation_terminal", () -> AE2WTIntegration.MENU);
}

TABS.register(MODID, () -> CreativeModeTab.builder()
.title(Component.translatable("mod." + MODID))
.icon(() -> EMC_INTERFACE.get().asItem().getDefaultInstance())
Expand Down Expand Up @@ -201,6 +197,7 @@ public AppliedE() {
});

if (Addons.AE2WTLIB.isLoaded()) {
bus.addListener(AE2WTIntegration::registerTerminalMenu);
bus.addListener(AE2WTIntegration::addTerminalToAE2WTLibTab);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
package gripe._90.appliede.integration.ae2wtlib;

import net.minecraft.world.inventory.MenuType;
import net.minecraft.core.registries.Registries;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraftforge.event.BuildCreativeModeTabContentsEvent;
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.registries.RegisterEvent;

import appeng.api.config.Actionable;
import appeng.api.features.GridLinkables;
import appeng.core.AppEng;
import appeng.init.client.InitScreens;
import appeng.items.tools.powered.WirelessTerminalItem;

import gripe._90.appliede.integration.Addons;

public class AE2WTIntegration {
private static final Item TERMINAL = new WTTItem();
public static final MenuType<?> MENU = WTTMenu.TYPE;

static {
GridLinkables.register(TERMINAL, WirelessTerminalItem.LINKABLE_HANDLER);
Expand All @@ -31,6 +33,12 @@ public static ItemStack getChargedTerminal() {
return stack;
}

public static void registerTerminalMenu(RegisterEvent event) {
if (event.getRegistryKey().equals(Registries.MENU)) {
ForgeRegistries.MENU_TYPES.register(AppEng.makeId("wireless_transmutation_terminal"), WTTMenu.TYPE);
}
}

public static void addTerminalToAE2WTLibTab(BuildCreativeModeTabContentsEvent event) {
if (event.getTabKey().location().getNamespace().equals(Addons.AE2WTLIB.getModId())) {
event.accept(TERMINAL);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package gripe._90.appliede.menu;

import org.jetbrains.annotations.NotNull;

import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.entity.player.Inventory;
import net.minecraft.world.entity.player.Player;
Expand Down Expand Up @@ -149,6 +151,7 @@ public void decrementUnlearnedTicks() {
}
}

@NotNull
@Override
public ItemStack quickMoveStack(Player player, int idx) {
if (shiftToTransmute) {
Expand Down

0 comments on commit 372f710

Please sign in to comment.