From e0ddb92b81815e375e06e0a0df2856db9dbd56f4 Mon Sep 17 00:00:00 2001 From: PrototypeTrousers Date: Thu, 20 Jan 2022 13:28:08 -0300 Subject: [PATCH] attune gtce p2p with cables --- .../registries/P2PTunnelRegistry.java | 38 ++++++++++++++----- 1 file changed, 29 insertions(+), 9 deletions(-) diff --git a/src/main/java/appeng/core/features/registries/P2PTunnelRegistry.java b/src/main/java/appeng/core/features/registries/P2PTunnelRegistry.java index a9a2b4455..b0245a3be 100644 --- a/src/main/java/appeng/core/features/registries/P2PTunnelRegistry.java +++ b/src/main/java/appeng/core/features/registries/P2PTunnelRegistry.java @@ -19,16 +19,14 @@ package appeng.core.features.registries; -import java.util.HashMap; -import java.util.Map; +import java.util.*; import java.util.Map.Entry; import javax.annotation.Nonnull; import javax.annotation.Nullable; -import gregtech.api.unification.material.Materials; -import gregtech.api.unification.ore.OrePrefix; -import gregtech.api.unification.stack.UnificationEntry; +import appeng.core.AELog; +import appeng.util.item.OreHelper; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.Item; @@ -57,8 +55,7 @@ public final class P2PTunnelRegistry implements IP2PTunnelRegistry private final Map modIdTunnels = new HashMap<>( INITIAL_CAPACITY ); private final Map, TunnelType> capTunnels = new HashMap<>( INITIAL_CAPACITY ); - public void configure() - { + public void configure() { final IDefinitions definitions = AEApi.instance().definitions(); final IBlocks blocks = definitions.blocks(); @@ -67,8 +64,31 @@ public final class P2PTunnelRegistry implements IP2PTunnelRegistry /** * light! */ - this.addNewAttunement( new ItemStack( Blocks.TORCH ), TunnelType.LIGHT ); - this.addNewAttunement( new ItemStack( Blocks.GLOWSTONE ), TunnelType.LIGHT ); + this.addNewAttunement(new ItemStack(Blocks.TORCH), TunnelType.LIGHT); + this.addNewAttunement(new ItemStack(Blocks.GLOWSTONE), TunnelType.LIGHT); + + List gtceOreDict = new ArrayList<>(); + gtceOreDict.add("wireGtHex"); + gtceOreDict.add("wireGtOctal"); + gtceOreDict.add("wireGtQuadruple"); + gtceOreDict.add("wireGtDouble"); + gtceOreDict.add("wireGtSingle"); + gtceOreDict.add("cableGtHex"); + gtceOreDict.add("cableGtOctal"); + gtceOreDict.add("cableGtQuadruple"); + gtceOreDict.add("cableGtDouble"); + gtceOreDict.add("cableGtSingle"); + + for(String oreDict : gtceOreDict) { + Arrays.stream(OreDictionary.getOreNames()).filter(s -> s.startsWith(oreDict)).forEach(s -> { + OreHelper.INSTANCE.getCachedOres(s).forEach( + stack -> { + this.addNewAttunement(stack, TunnelType.GTCEU_POWER); + AELog.info("Added " + stack + " to P2P Tunnel Registry"); + }); + } + ); + } /** * Forge energy tunnel items