Skip to content

Commit

Permalink
Move some registration code
Browse files Browse the repository at this point in the history
  • Loading branch information
62832 committed Apr 29, 2024
1 parent 24c11a4 commit 7290097
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 14 deletions.
11 changes: 6 additions & 5 deletions src/main/java/gripe/_90/appliede/AppliedE.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import appeng.api.parts.IPart;
import appeng.api.parts.IPartItem;
import appeng.api.parts.PartModels;
import appeng.api.stacks.AEKeyTypes;
import appeng.blockentity.AEBaseBlockEntity;
import appeng.core.AppEng;
import appeng.items.parts.PartItem;
Expand Down Expand Up @@ -58,8 +59,11 @@ public static ResourceLocation id(String path) {
private static final DeferredRegister<CreativeModeTab> TABS =
DeferredRegister.create(Registries.CREATIVE_MODE_TAB, MODID);

public static final RegistryObject<Item> EMC_MODULE =
ITEMS.register("emc_module", () -> part(EMCModulePart.class, EMCModulePart::new));
public static final RegistryObject<Item> EMC_MODULE = ITEMS.register("emc_module", () -> {
AEKeyTypes.register(EMCKeyType.TYPE);
GridServices.register(KnowledgeService.class, KnowledgeService.class);
return part(EMCModulePart.class, EMCModulePart::new);
});
public static final RegistryObject<Item> TRANSMUTATION_PATTERN =
ITEMS.register("transmutation_pattern", TransmutationPatternItem::new);

Expand Down Expand Up @@ -102,9 +106,6 @@ public AppliedE() {
MENU_TYPES.register(bus);
BE_TYPES.register(bus);
TABS.register(bus);
bus.addListener(EMCKeyType::register);

GridServices.register(KnowledgeService.class, KnowledgeService.class);

if (FMLEnvironment.dist.isClient()) {
bus.addListener(EMCRenderer::register);
Expand Down
9 changes: 0 additions & 9 deletions src/main/java/gripe/_90/appliede/key/EMCKeyType.java
Original file line number Diff line number Diff line change
@@ -1,27 +1,18 @@
package gripe._90.appliede.key;

import net.minecraft.core.registries.Registries;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.network.chat.Component;
import net.minecraftforge.registries.RegisterEvent;

import appeng.api.stacks.AEKey;
import appeng.api.stacks.AEKeyType;
import appeng.api.stacks.AEKeyTypes;

import gripe._90.appliede.AppliedE;

public final class EMCKeyType extends AEKeyType {
static final Component EMC = Component.translatable("key." + AppliedE.MODID + ".emc");
public static final EMCKeyType TYPE = new EMCKeyType();

public static void register(RegisterEvent event) {
if (event.getRegistryKey().equals(Registries.ITEM)) {
AEKeyTypes.register(TYPE);
}
}

private EMCKeyType() {
super(AppliedE.id("emc"), EMCKey.class, EMC);
}
Expand Down

0 comments on commit 7290097

Please sign in to comment.