Skip to content

Commit

Permalink
remove ae2.Integration and rename ae2.Registries to ae2.AE2Registries
Browse files Browse the repository at this point in the history
  • Loading branch information
zyxkad committed Jan 21, 2025
1 parent 04c6f27 commit 2b2f9d1
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 30 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package de.srendi.advancedperipherals;

import de.srendi.advancedperipherals.common.addons.APAddons;
import de.srendi.advancedperipherals.common.addons.ae2.AE2Registries;
import de.srendi.advancedperipherals.common.configuration.APConfig;
import de.srendi.advancedperipherals.common.network.APNetworking;
import de.srendi.advancedperipherals.common.setup.APRegistration;
Expand Down Expand Up @@ -72,7 +73,7 @@ public void commonSetup(FMLCommonSetupEvent event) {
public void onLoadComplete(FMLLoadCompleteEvent event) {
event.enqueueWork(() -> {
if (APAddons.appliedEnergisticsLoaded) {
de.srendi.advancedperipherals.common.addons.ae2.Integration.onComplete();
AE2Registries.finishRegister();
}
});
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,42 @@
package de.srendi.advancedperipherals.common.addons.ae2;

import appeng.api.features.P2PTunnelAttunement;
import appeng.api.parts.IPart;
import appeng.api.parts.IPartItem;
import appeng.api.parts.PartModels;
import appeng.items.parts.PartItem;
import appeng.items.parts.PartModelsHelper;
import dan200.computercraft.shared.Registry.ModItems;
import de.srendi.advancedperipherals.common.setup.APRegistration;
import net.minecraft.data.tags.TagsProvider;
import net.minecraft.tags.TagKey;
import net.minecraft.world.item.Item;
import net.minecraftforge.registries.RegistryObject;

import java.util.function.Function;

public final class Registries {
private Registries() {}
public final class AE2Registries {
private AE2Registries() {}

public static final RegistryObject<PartItem<WiredCableP2PTunnelPart>> CABLE_P2P_TUNNEL = registerPart("cable_p2p_tunnel", WiredCableP2PTunnelPart.class, WiredCableP2PTunnelPart::new);

private static <T extends IPart> RegistryObject<PartItem<T>> registerPart(String id, Class<T> clazz, Function<IPartItem<T>, T> factory) {
PartModels.registerModels(PartModelsHelper.createModels(clazz));
return APRegistration.ITEMS.register(id, () -> new PartItem<>(new Item.Properties(), clazz, factory));
}

public static void finishRegister() {
P2PTunnelAttunement.registerAttunementTag(CABLE_P2P_TUNNEL.get());
}

public static TagKey<Item> getCableP2PTag() {
return P2PTunnelAttunement.getAttunementTag(CABLE_P2P_TUNNEL.get());
}

public static void registerTags(Function<TagKey<Item>, TagsProvider.TagAppender<Item>> tagger) {
tagger.apply(getCableP2PTag())
.add(ModItems.CABLE.get())
.add(ModItems.WIRED_MODEM.get())
.add(ModItems.WIRED_MODEM_FULL.get());
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
public class IntegrationPeripheralProvider implements IPeripheralProvider {

private static final String[] SUPPORTED_MODS = new String[]{
APAddons.APPLIEDENERGISTICS_MODID,
APAddons.BOTANIA_MODID,
APAddons.CREATE_MODID,
APAddons.MEKANISM_MODID,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package de.srendi.advancedperipherals.common.data;

import de.srendi.advancedperipherals.AdvancedPeripherals;
import de.srendi.advancedperipherals.common.addons.ae2.AE2Registries;
import de.srendi.advancedperipherals.common.setup.APItems;
import de.srendi.advancedperipherals.common.setup.APTags;
import net.minecraft.core.Registry;
Expand All @@ -18,10 +19,9 @@ protected ItemTagsProvider(DataGenerator generator, @Nullable ExistingFileHelper

@Override
protected void addTags() {
tag(APTags.Items.SMART_GLASSES).add(APItems.SMART_GLASSES.get()).add(APItems.SMART_GLASSES_NETHERITE.get());
tag(de.srendi.advancedperipherals.common.addons.ae2.Integration.getCableP2PTag())
.add(dan200.computercraft.shared.Registry.ModItems.CABLE.get())
.add(dan200.computercraft.shared.Registry.ModItems.WIRED_MODEM.get())
.add(dan200.computercraft.shared.Registry.ModItems.WIRED_MODEM_FULL.get());
tag(APTags.Items.SMART_GLASSES)
.add(APItems.SMART_GLASSES.get())
.add(APItems.SMART_GLASSES_NETHERITE.get());
AE2Registries.registerTags(this::tag);
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package de.srendi.advancedperipherals.common.setup;

import de.srendi.advancedperipherals.common.addons.APAddons;
import de.srendi.advancedperipherals.common.addons.ae2.AE2Registries;
import de.srendi.advancedperipherals.common.configuration.APConfig;
import de.srendi.advancedperipherals.common.items.APItem;
import de.srendi.advancedperipherals.common.items.MemoryCardItem;
Expand All @@ -16,7 +17,7 @@

public class APItems {

public static final RegistryObject<Item> CABLE_P2P_TUNNEL = APAddons.appliedEnergisticsLoaded ? (RegistryObject<Item>) (RegistryObject<?>) de.srendi.advancedperipherals.common.addons.ae2.Registries.CABLE_P2P_TUNNEL : null;
public static final RegistryObject<Item> CABLE_P2P_TUNNEL = APAddons.appliedEnergisticsLoaded ? (RegistryObject<Item>) (RegistryObject<?>) AE2Registries.CABLE_P2P_TUNNEL : null;
public static final RegistryObject<Item> CHUNK_CONTROLLER = APRegistration.ITEMS.register("chunk_controller", () -> new APItem(new Item.Properties().stacksTo(16), APConfig.PERIPHERALS_CONFIG.enableChunkyTurtle));
public static final RegistryObject<Item> COMPUTER_TOOL = APRegistration.ITEMS.register("computer_tool", () -> new APItem(new Item.Properties().stacksTo(1), () -> true));
public static final RegistryObject<Item> END_AUTOMATA_CORE = APRegistration.ITEMS.register("end_automata_core", () -> new APItem(new Item.Properties().stacksTo(1), APConfig.METAPHYSICS_CONFIG.enableEndAutomataCore));
Expand Down

0 comments on commit 2b2f9d1

Please sign in to comment.