From 8962cd1bcb79f6091dbe31ee17c3f31c28109a19 Mon Sep 17 00:00:00 2001 From: malte0811 Date: Sat, 25 Aug 2018 17:48:17 +0200 Subject: [PATCH] Updated documentation/manual Register the wires and connectors even if IC2 isn't installed --- .../industrialWires/IMixedConnector.java | 1 - .../industrialWires/IndustrialWires.java | 34 ++++---- .../industrialWires/client/ClientProxy.java | 81 ++++++++++--------- .../industrialWires/wires/EnergyType.java | 2 +- .../assets/industrialwires/lang/en_US.lang | 4 +- 5 files changed, 60 insertions(+), 62 deletions(-) diff --git a/src/main/java/malte0811/industrialWires/IMixedConnector.java b/src/main/java/malte0811/industrialWires/IMixedConnector.java index a018088..a03403a 100644 --- a/src/main/java/malte0811/industrialWires/IMixedConnector.java +++ b/src/main/java/malte0811/industrialWires/IMixedConnector.java @@ -29,7 +29,6 @@ public interface IMixedConnector extends IImmersiveConnectable { @Override default float getDamageAmount(Entity e, ImmersiveNetHandler.Connection c) { - //TODO different damage for EU anf FE return (float) Math.ceil(IImmersiveConnectable.super.getDamageAmount(e, c) * ConversionUtil.euPerJoule());//Same as IC2 uses } } diff --git a/src/main/java/malte0811/industrialWires/IndustrialWires.java b/src/main/java/malte0811/industrialWires/IndustrialWires.java index 8235149..b141a90 100644 --- a/src/main/java/malte0811/industrialWires/IndustrialWires.java +++ b/src/main/java/malte0811/industrialWires/IndustrialWires.java @@ -163,27 +163,25 @@ public class IndustrialWires { double ieThreshold = 12.74275; String ieVer = Loader.instance().getIndexedModList().get(ImmersiveEngineering.MODID).getDisplayVersion(); int firstDash = ieVer.indexOf('-'); - String end = ieVer.substring(firstDash+1); + String end = ieVer.substring(firstDash + 1); String start = ieVer.substring(0, firstDash); end = end.replaceAll("[^0-9]", ""); start = start.replaceAll("[^0-9]", ""); - double ieVerDouble = Double.parseDouble(start+"."+end); - isOldIE = ieVerDouble tinCableList = Arrays.asList(tinCable.getMatchingStacks()); + Ingredient copperCable = IC2TRHelper.getStack("cable", "type:copper,insulation:0"); + Object2IntMap copperCables = new Object2IntLinkedOpenHashMap<>(); + for (ItemStack itemStack : copperCable.getMatchingStacks()) { + copperCables.put(itemStack, 1); + } + copperCables.put(new ItemStack(IEObjects.itemWireCoil, 1, 0), 8); + List copperCableList = new ArrayList<>(copperCables.keySet()); for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { - wireRecipes[0][3 * i + j] = new PositionedItemStack(tinCableList, 18 * i + xBase, 18 * j); + wireRecipes[0][3 * i + j] = new PositionedItemStack(copperCableList, 18 * i + xBase, 18 * j); } } - ItemStack tmp = new ItemStack(IndustrialWires.coil); - ItemIC2Coil.setLength(tmp, 9); - wireRecipes[0][9] = new PositionedItemStack(tmp, 18 * 4 + xBase, 18); + ItemStack copperCoil = new ItemStack(IndustrialWires.coil, 1, 1); + ItemIC2Coil.setLength(copperCoil, 9); + wireRecipes[0][9] = new PositionedItemStack(copperCoil, 18 * 4 + xBase, 18); Random r = new Random(); for (int i = 1; i < 3; i++) { int lengthSum = 0; for (int j1 = 0; j1 < 3; j1++) { for (int j2 = 0; j2 < 3; j2++) { - if (r.nextBoolean()) { + if (r.nextDouble() > 1 / (1. + copperCables.size())) { // cable - lengthSum++; - wireRecipes[i][3 * j1 + j2] = new PositionedItemStack(tinCableList, 18 * j1 + xBase, 18 * j2); + ItemStack chosen = copperCableList.get(r.nextInt(copperCables.size())); + lengthSum += copperCables.getInt(chosen); + wireRecipes[i][3 * j1 + j2] = new PositionedItemStack(chosen, 18 * j1 + xBase, 18 * j2); } else { // wire coil int length = r.nextInt(99) + 1; - tmp = new ItemStack(IndustrialWires.coil); - ItemIC2Coil.setLength(tmp, length); - wireRecipes[i][3 * j1 + j2] = new PositionedItemStack(tmp, 18 * j1 + xBase, 18 * j2); + copperCoil = new ItemStack(IndustrialWires.coil, 1, 1); + ItemIC2Coil.setLength(copperCoil, length); + wireRecipes[i][3 * j1 + j2] = new PositionedItemStack(copperCoil, 18 * j1 + xBase, 18 * j2); lengthSum += length; } } } - tmp = new ItemStack(IndustrialWires.coil); - ItemIC2Coil.setLength(tmp, lengthSum); - wireRecipes[i][9] = new PositionedItemStack(tmp, 18 * 4 + xBase, 18); + copperCoil = new ItemStack(IndustrialWires.coil); + ItemIC2Coil.setLength(copperCoil, lengthSum); + wireRecipes[i][9] = new PositionedItemStack(copperCoil, 18 * 4 + xBase, 18); } - m.addEntry("industrialwires.wires", "industrialwires", - new ManualPages.CraftingMulti(m, "industrialwires.wires0", new ItemStack(IndustrialWires.ic2conn, 1, 0), new ItemStack(IndustrialWires.ic2conn, 1, 1), new ItemStack(IndustrialWires.ic2conn, 1, 2), new ItemStack(IndustrialWires.ic2conn, 1, 3), - new ItemStack(IndustrialWires.ic2conn, 1, 4), new ItemStack(IndustrialWires.ic2conn, 1, 5), new ItemStack(IndustrialWires.ic2conn, 1, 6), new ItemStack(IndustrialWires.ic2conn, 1, 7)), - new ManualPages.Text(m, "industrialwires.wires1"), - new ManualPages.CraftingMulti(m, "industrialwires.wires2", (Object[]) wireRecipes) + splitter = new TextSplitter(m); + splitter.addSpecialPage(0, 0, 10, + s->new ManualPages.CraftingMulti(m, s, (Object[]) wireRecipes)); + String text = I18n.format("ie.manual.entry.industrialwires.wires"); + splitter.split(text); + List entry = splitter.toManualEntry(); + m.addEntry("industrialwires.wires", IndustrialWires.MODID, entry.toArray(new IManualPage[0])); + } + if (hasIC2 && IndustrialWires.mechConv != null) { + m.addEntry("industrialwires.mechConv", "industrialwires", + new ManualPages.Crafting(m, "industrialwires.mechConv0", new ItemStack(IndustrialWires.mechConv, 1, 1)), + new ManualPages.Crafting(m, "industrialwires.mechConv1", new ItemStack(IndustrialWires.mechConv, 1, 2)), + new ManualPages.Crafting(m, "industrialwires.mechConv2", new ItemStack(IndustrialWires.mechConv, 1, 0)) ); - if (IndustrialWires.mechConv != null) { - m.addEntry("industrialwires.mechConv", "industrialwires", - new ManualPages.Crafting(m, "industrialwires.mechConv0", new ItemStack(IndustrialWires.mechConv, 1, 1)), - new ManualPages.Crafting(m, "industrialwires.mechConv1", new ItemStack(IndustrialWires.mechConv, 1, 2)), - new ManualPages.Crafting(m, "industrialwires.mechConv2", new ItemStack(IndustrialWires.mechConv, 1, 0)) - ); - } } addUnblockableSounds(TINNITUS, TURN_FAST, TURN_SLOW); @@ -236,8 +243,8 @@ public class ClientProxy extends CommonProxy { new ManualPages.Text(m, "industrialwires.panel_creator2") ); String text = I18n.format("ie.manual.entry.industrialwires.redstone"); - TextSplitter splitter = new TextSplitter(m); - splitter.addSpecialPage(-1, 0, 10, s->new ManualPages.CraftingMulti(m, s, + splitter = new TextSplitter(m); + splitter.addSpecialPage(-1, 0, 10, s -> new ManualPages.CraftingMulti(m, s, new ResourceLocation(IndustrialWires.MODID, "control_panel_rs_other"), new ResourceLocation(IndustrialWires.MODID, "control_panel_rs_wire"))); splitter.split(text); @@ -289,9 +296,9 @@ public class ClientProxy extends CommonProxy { String[][] flywheelTable; { - List flywheelTableList = new ArrayList<>(1+Material.values().length); + List flywheelTableList = new ArrayList<>(1 + Material.values().length); flywheelTableList.add(new String[]{"industrialwires.desc.material", "industrialwires.desc.inertia", "industrialwires.desc.max_speed"}); - for (Material mat:Material.values()) { + for (Material mat : Material.values()) { MechPartFlywheel f = new MechPartFlywheel(mat); flywheelTableList.add(new String[]{mat.oreName(), Utils.formatDouble(f.getInertia(), "0.#"), Utils.formatDouble(f.getMaxSpeed(), "0.#")}); @@ -302,7 +309,7 @@ public class ClientProxy extends CommonProxy { splitter = new TextSplitter(m); splitter.addSpecialPage(0, 0, 10, (s) -> new ManualPageMultiblock(m, s, MechMBPart.getManualMBForPart(MechPartFlywheel.class))); - splitter.addSpecialPage(1, 0, 1, s->new ManualPages.Table(m, "", flywheelTable, true)); + splitter.addSpecialPage(1, 0, 1, s -> new ManualPages.Table(m, "", flywheelTable, true)); splitter.addSpecialPage(2, 0, 10, (s) -> new ManualPageMultiblock(m, s, MechMBPart.getManualMBForPart(MechPartSingleCoil.class))); splitter.addSpecialPage(3, 0, 10, (s) -> new ManualPageMultiblock(m, s, diff --git a/src/main/java/malte0811/industrialWires/wires/EnergyType.java b/src/main/java/malte0811/industrialWires/wires/EnergyType.java index 6ed20ae..1765803 100644 --- a/src/main/java/malte0811/industrialWires/wires/EnergyType.java +++ b/src/main/java/malte0811/industrialWires/wires/EnergyType.java @@ -21,7 +21,7 @@ public enum EnergyType { FE_AC() { @Override public double getLoss(double averageLossRate, double available, double outMax) { - return Math.min(averageLossRate, 1)*outMax;//TODO fix this + return Math.min(averageLossRate, 1)*outMax; } }, EU_DC() { diff --git a/src/main/resources/assets/industrialwires/lang/en_US.lang b/src/main/resources/assets/industrialwires/lang/en_US.lang index 9cedf91..0040ad4 100644 --- a/src/main/resources/assets/industrialwires/lang/en_US.lang +++ b/src/main/resources/assets/industrialwires/lang/en_US.lang @@ -137,9 +137,7 @@ ie.manual.category.control_panels.name=Control Panels ie.manual.entry.industrialwires.wires.name=Industrial Wires ie.manual.entry.industrialwires.wires.subtext=No complex impedance! -ie.manual.entry.industrialwires.wires0=Wires from the IndustrialWires company allow you to transfer energy like you can with cables from the IndustrialCraft2 company.
You use them exactly as you would use wires from Immersive Engineering. Each wire transfers as much EU as the corresponding cable would, so -ie.manual.entry.industrialwires.wires1=attaching a connector to a power source that would destroy the cable will destroy the connector.
The wire coils for the IC2 cable are different from the Immersive Engineering wire coils in that longer connections use up more wire: The coils are crafted by placing any combination of uninsulated IC2 cables and the corresponding wire coils in a crafting grid. The next page shows some examples of valid recipes and their outputs. The uninsulated -ie.manual.entry.industrialwires.wires2=tin cables can be replaced by uninsulated copper, gold or HV cables or by glass fiber cable to craft the other coils. +ie.manual.entry.industrialwires.wires=Wires from the IndustrialWires company behave nearly like wires provided by Immersive Engineering with two important differences:
1. They can transfer both DC (EU) and AC (IF). However they can not transfer both at the same time, sources of DC and sources of AC should never be connected to one another.
2. The amount of wire consumed for a connection depends on the length of the connection. The maximum stack size for the wire coils is 1, however this single coil can contain up to 1024 or 2048 meters/blocks of wire.
<&0>The wire coils can be created by placing any combination of existing wire coils of this type, wire coils from Immersive Engineering of the corresponding type and IndustrialCraft cables of the corresponding type. Wire coils will combine automatically when picked up. ie.manual.entry.industrialwires.mechConv.name=Mechanical Converters ie.manual.entry.industrialwires.mechConv.subtext=I made rotational energy for this!