Skip to content

Commit 499abef

Browse files
authored
Merge 2b2f9d1 into 016c6c2
2 parents 016c6c2 + 2b2f9d1 commit 499abef

File tree

22 files changed

+310
-33
lines changed

22 files changed

+310
-33
lines changed
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1-
// 1.19.2 2024-05-28T14:53:16.653667 Tags for minecraft:item
1+
// 1.19.2 2025-01-20T07:59:27.474151 Tags for minecraft:item
2+
de4b4f45ec18b2b1f0db1c36882981042e20ee23 data/advancedperipherals/tags/items/p2p_attunements/cable_p2p_tunnel.json
23
72eba3b11f69e16c87488f7c4ba7cfdad42c378e data/advancedperipherals/tags/items/smart_glasses.json
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
// 1.19.2 2025-01-16T15:59:34.693839 Languages: en_us
2-
d0fe3ab5a88d6b925369860038c76f23d9910143 assets/advancedperipherals/lang/en_us.json
1+
// 1.19.2 2025-01-20T07:50:09.44057 Languages: en_us
2+
ebf2194b8fece940adb61f1ae317f68799bd498f assets/advancedperipherals/lang/en_us.json

src/generated/resources/assets/advancedperipherals/lang/en_us.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
"block.advancedperipherals.rs_bridge": "RS Bridge",
3535
"curios.identifier.glasses": "Glasses",
3636
"entity.minecraft.villager.advancedperipherals.computer_scientist": "Computer Scientist",
37+
"item.advancedperipherals.cable_p2p_tunnel": "Cable P2P Tunnel",
3738
"item.advancedperipherals.chunk_controller": "Chunk Controller",
3839
"item.advancedperipherals.computer_tool": "Computer Tool",
3940
"item.advancedperipherals.end_automata_core": "End Automata Core",
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"values": [
3+
"computercraft:cable",
4+
"computercraft:wired_modem",
5+
"computercraft:wired_modem_full"
6+
]
7+
}

src/main/java/de/srendi/advancedperipherals/AdvancedPeripherals.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package de.srendi.advancedperipherals;
22

33
import de.srendi.advancedperipherals.common.addons.APAddons;
4+
import de.srendi.advancedperipherals.common.addons.ae2.AE2Registries;
45
import de.srendi.advancedperipherals.common.configuration.APConfig;
56
import de.srendi.advancedperipherals.common.network.APNetworking;
67
import de.srendi.advancedperipherals.common.setup.APRegistration;
@@ -11,6 +12,7 @@
1112
import net.minecraftforge.fml.ModLoadingContext;
1213
import net.minecraftforge.fml.common.Mod;
1314
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
15+
import net.minecraftforge.fml.event.lifecycle.FMLLoadCompleteEvent;
1416
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
1517
import org.apache.logging.log4j.Level;
1618
import org.apache.logging.log4j.LogManager;
@@ -35,6 +37,7 @@ public AdvancedPeripherals() {
3537
APConfig.register(ModLoadingContext.get());
3638

3739
modBus.addListener(this::commonSetup);
40+
modBus.addListener(this::onLoadComplete);
3841
APRegistration.register();
3942
MinecraftForge.EVENT_BUS.register(this);
4043
new APAddons();
@@ -67,4 +70,11 @@ public void commonSetup(FMLCommonSetupEvent event) {
6770
});
6871
}
6972

73+
public void onLoadComplete(FMLLoadCompleteEvent event) {
74+
event.enqueueWork(() -> {
75+
if (APAddons.appliedEnergisticsLoaded) {
76+
AE2Registries.finishRegister();
77+
}
78+
});
79+
}
7080
}

src/main/java/de/srendi/advancedperipherals/common/addons/APAddons.java

Lines changed: 27 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -23,38 +23,51 @@
2323
@Mod.EventBusSubscriber(modid = AdvancedPeripherals.MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD)
2424
public class APAddons {
2525

26-
public static final String CURIOS_MODID = "curios";
27-
public static final String REFINEDSTORAGE_MODID = "refinedstorage";
26+
public static final String AE_ADDITIONS_MODID = "ae2additions";
2827
public static final String AE_THINGS_MODID = "ae2things";
2928
public static final String APPLIEDENERGISTICS_MODID = "ae2";
30-
public static final String MEKANISM_MODID = "mekanism";
31-
public static final String AE_ADDITIONS_MODID = "ae2additions";
3229
public static final String APP_MEKANISTICS_MODID = "appmek";
30+
public static final String BOTANIA_MODID = "botania";
31+
public static final String CREATE_MODID = "create";
32+
public static final String CURIOS_MODID = "curios";
33+
public static final String DIMSTORAGE_MODID = "dimstorage";
34+
public static final String MEKANISM_MODID = "mekanism";
35+
public static final String POWAH_MODID = "powah";
36+
public static final String REFINEDSTORAGE_MODID = "refinedstorage";
3337
public static final String VALKYRIEN_SKIES_MODID = "valkyrienskies";
3438

35-
public static boolean curiosLoaded;
36-
public static boolean refinedStorageLoaded;
39+
public static boolean aeAdditionsLoaded;
3740
public static boolean aeThingsLoaded;
41+
public static boolean appMekLoaded;
3842
public static boolean appliedEnergisticsLoaded;
43+
public static boolean botaniaLoaded;
44+
public static boolean createLoaded;
45+
public static boolean curiosLoaded;
46+
public static boolean dimstorageLoaded;
3947
public static boolean mekanismLoaded;
40-
public static boolean aeAdditionsLoaded;
41-
public static boolean appMekLoaded;
48+
public static boolean powahLoaded;
49+
public static boolean refinedStorageLoaded;
4250
public static boolean vs2Loaded;
4351

4452
// Use static so these checks run as early as possible, so we can use them for our registries
4553
static {
4654
ModList modList = ModList.get();
47-
curiosLoaded = modList.isLoaded(CURIOS_MODID);
48-
refinedStorageLoaded = modList.isLoaded(REFINEDSTORAGE_MODID);
49-
appliedEnergisticsLoaded = modList.isLoaded(APPLIEDENERGISTICS_MODID);
50-
mekanismLoaded = modList.isLoaded(MEKANISM_MODID);
51-
aeThingsLoaded = modList.isLoaded(AE_THINGS_MODID);
5255
aeAdditionsLoaded = modList.isLoaded(AE_ADDITIONS_MODID);
56+
aeThingsLoaded = modList.isLoaded(AE_THINGS_MODID);
5357
appMekLoaded = modList.isLoaded(APP_MEKANISTICS_MODID);
58+
appliedEnergisticsLoaded = modList.isLoaded(APPLIEDENERGISTICS_MODID);
59+
botaniaLoaded = modList.isLoaded(BOTANIA_MODID);
60+
createLoaded = modList.isLoaded(CREATE_MODID);
61+
curiosLoaded = modList.isLoaded(CURIOS_MODID);
62+
dimstorageLoaded = modList.isLoaded(DIMSTORAGE_MODID);
63+
mekanismLoaded = modList.isLoaded(MEKANISM_MODID);
64+
powahLoaded = modList.isLoaded(POWAH_MODID);
65+
refinedStorageLoaded = modList.isLoaded(REFINEDSTORAGE_MODID);
5466
vs2Loaded = modList.isLoaded(VALKYRIEN_SKIES_MODID);
5567

56-
if (refinedStorageLoaded)
68+
if (refinedStorageLoaded) {
5769
RefinedStorage.instance = new RefinedStorage();
70+
}
5871
}
5972

6073
@SubscribeEvent
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
package de.srendi.advancedperipherals.common.addons.ae2;
2+
3+
import appeng.api.features.P2PTunnelAttunement;
4+
import appeng.api.parts.IPart;
5+
import appeng.api.parts.IPartItem;
6+
import appeng.api.parts.PartModels;
7+
import appeng.items.parts.PartItem;
8+
import appeng.items.parts.PartModelsHelper;
9+
import dan200.computercraft.shared.Registry.ModItems;
10+
import de.srendi.advancedperipherals.common.setup.APRegistration;
11+
import net.minecraft.data.tags.TagsProvider;
12+
import net.minecraft.tags.TagKey;
13+
import net.minecraft.world.item.Item;
14+
import net.minecraftforge.registries.RegistryObject;
15+
16+
import java.util.function.Function;
17+
18+
public final class AE2Registries {
19+
private AE2Registries() {}
20+
21+
public static final RegistryObject<PartItem<WiredCableP2PTunnelPart>> CABLE_P2P_TUNNEL = registerPart("cable_p2p_tunnel", WiredCableP2PTunnelPart.class, WiredCableP2PTunnelPart::new);
22+
23+
private static <T extends IPart> RegistryObject<PartItem<T>> registerPart(String id, Class<T> clazz, Function<IPartItem<T>, T> factory) {
24+
PartModels.registerModels(PartModelsHelper.createModels(clazz));
25+
return APRegistration.ITEMS.register(id, () -> new PartItem<>(new Item.Properties(), clazz, factory));
26+
}
27+
28+
public static void finishRegister() {
29+
P2PTunnelAttunement.registerAttunementTag(CABLE_P2P_TUNNEL.get());
30+
}
31+
32+
public static TagKey<Item> getCableP2PTag() {
33+
return P2PTunnelAttunement.getAttunementTag(CABLE_P2P_TUNNEL.get());
34+
}
35+
36+
public static void registerTags(Function<TagKey<Item>, TagsProvider.TagAppender<Item>> tagger) {
37+
tagger.apply(getCableP2PTag())
38+
.add(ModItems.CABLE.get())
39+
.add(ModItems.WIRED_MODEM.get())
40+
.add(ModItems.WIRED_MODEM_FULL.get());
41+
}
42+
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package de.srendi.advancedperipherals.common.addons.appliedenergistics;
1+
package de.srendi.advancedperipherals.common.addons.ae2;
22

33
import appeng.api.crafting.IPatternDetails;
44
import appeng.api.inventories.InternalInventory;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package de.srendi.advancedperipherals.common.addons.appliedenergistics;
1+
package de.srendi.advancedperipherals.common.addons.ae2;
22

33
import appeng.api.networking.IGrid;
44
import appeng.api.networking.IGridNode;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package de.srendi.advancedperipherals.common.addons.appliedenergistics;
1+
package de.srendi.advancedperipherals.common.addons.ae2;
22

33
import appeng.api.networking.IGridNode;
44
import appeng.api.networking.IGridNodeListener;

0 commit comments

Comments
 (0)