Skip to content

Commit

Permalink
Switch over to TunnelType API
Browse files Browse the repository at this point in the history
  • Loading branch information
NotMyWing committed Jun 10, 2024
1 parent 30ec2b4 commit 753bc40
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 77 deletions.
6 changes: 0 additions & 6 deletions src/main/java/co/neeve/nae2/NAE2API.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
package co.neeve.nae2;

import co.neeve.nae2.common.api.ExposerAPI;
import co.neeve.nae2.common.api.TunnelConversionAPI;

public class NAE2API {
private final ExposerAPI exposerAPI = new ExposerAPI();
private final TunnelConversionAPI tunnelConversionAPI = new TunnelConversionAPI();

NAE2API() {}

Expand All @@ -17,8 +15,4 @@ public class NAE2API {
public ExposerAPI exposer() {
return this.exposerAPI;
}

public TunnelConversionAPI tunnelConversion() {
return this.tunnelConversionAPI;
}
}
19 changes: 0 additions & 19 deletions src/main/java/co/neeve/nae2/common/api/TunnelConversionAPI.java

This file was deleted.

11 changes: 8 additions & 3 deletions src/main/java/co/neeve/nae2/common/integration/ae2fc/AE2FC.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package co.neeve.nae2.common.integration.ae2fc;

import appeng.api.AEApi;
import appeng.api.config.TunnelType;
import co.neeve.nae2.NAE2;
import co.neeve.nae2.common.registration.definitions.Upgrades;
import com.glodblock.github.loader.FCBlocks;
Expand All @@ -16,9 +18,12 @@ public static void initInterfaceUpgrade(Upgrades.UpgradeType upgrade) {

public static void postInit(Side side) {
NAE2.definitions().parts().p2pTunnelInterface().maybeStack(1).ifPresent((p2pTunnel) -> {
var tc = NAE2.api().tunnelConversion();
tc.register(new ItemStack(FCBlocks.DUAL_INTERFACE), p2pTunnel);
tc.register(new ItemStack(FCItems.PART_DUAL_INTERFACE), p2pTunnel);
try {
var tunnelType = Enum.valueOf(TunnelType.class, "NAE2_IFACE_P2P");
var reg = AEApi.instance().registries().p2pTunnel();
reg.addNewAttunement(new ItemStack(FCBlocks.DUAL_INTERFACE), tunnelType);
reg.addNewAttunement(new ItemStack(FCItems.PART_DUAL_INTERFACE), tunnelType);
} catch (IllegalArgumentException ignored) {}
});
}
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package co.neeve.nae2.common.registration.definitions;

import appeng.api.AEApi;
import appeng.api.config.TunnelType;
import appeng.api.parts.IPart;
import appeng.bootstrap.components.IPostInitComponent;
import appeng.core.Api;
import appeng.core.features.DamagedItemDefinition;
import appeng.core.localization.GuiText;
import appeng.util.Platform;
import co.neeve.nae2.NAE2;
import co.neeve.nae2.Tags;
import co.neeve.nae2.common.features.Features;
import co.neeve.nae2.common.features.IFeature;
Expand Down Expand Up @@ -59,19 +59,22 @@ public Parts(Registry registry) {
this.p2pTunnelInterface = this.createPart(this.itemPart, PartType.P2P_TUNNEL_INTERFACE);
this.p2pTunnelInterface.maybeStack(1)
.ifPresent((tunnelStack) -> registry.addBootstrapComponent((IPostInitComponent) (r) -> {
var tunnelType = AEApi.instance().registries().p2pTunnel()
.registerTunnelType("NAE2_IFACE_P2P", tunnelStack);

var definitions = Api.INSTANCE.definitions();

definitions.blocks().iface().maybeStack(1)
.ifPresent((stack) -> registerTunnelConversion(tunnelStack, stack));
.ifPresent((stack) -> registerTunnelConversion(tunnelType, stack));

definitions.parts().iface().maybeStack(1)
.ifPresent((stack) -> registerTunnelConversion(tunnelStack, stack));
.ifPresent((stack) -> registerTunnelConversion(tunnelType, stack));
}));
this.exposer = this.createPart(this.itemPart, PartType.EXPOSER);
}

private static void registerTunnelConversion(ItemStack tunnelStack, ItemStack stack) {
NAE2.api().tunnelConversion().register(stack, tunnelStack);
private static void registerTunnelConversion(TunnelType tunnelType, ItemStack stack) {
AEApi.instance().registries().p2pTunnel().addNewAttunement(stack, tunnelType);
}

public static Optional<PartType> getById(int itemDamage) {
Expand Down
43 changes: 0 additions & 43 deletions src/main/java/co/neeve/nae2/mixin/core/MixinTunnelConversion.java

This file was deleted.

1 change: 0 additions & 1 deletion src/main/resources/mixins.nae2.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"minVersion": "0.8",
"compatibilityLevel": "JAVA_8",
"mixins": [
"core.MixinTunnelConversion",
"core.crafting.patterntransform.MixinCraftingCPUCluster",
"core.crafting.patterntransform.MixinCraftingGrid"
],
Expand Down

0 comments on commit 753bc40

Please sign in to comment.