From a7e0c9b6a2c63f0c1d86da1053d274b6069e9e91 Mon Sep 17 00:00:00 2001 From: DarkGuardsman Date: Tue, 3 Sep 2013 00:16:22 -0400 Subject: [PATCH] Created first advanced config block This will be the first block of many to have its own config file. The idea when i created the BlockRegistry was to also implement a system to allow blocks to declare custom configs. In other words allowing them to define settings that can easily be linked to the block without large config files. --- src/dark/common/transmit/BlockWire.java | 8 +++++--- src/dark/common/transmit/TileEntityWire.java | 4 ++-- src/dark/prefab/tilenetwork/NetworkTileEntities.java | 1 - 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/dark/common/transmit/BlockWire.java b/src/dark/common/transmit/BlockWire.java index 86b5f628..330d6d26 100644 --- a/src/dark/common/transmit/BlockWire.java +++ b/src/dark/common/transmit/BlockWire.java @@ -24,7 +24,8 @@ import dark.prefab.helpers.Pair; public class BlockWire extends BlockMachine implements IExtraObjectInfo { - + public static float wireResistance = 0.001f; + public static float ampMax = 10000f; public boolean isWireCollision = true; public Vector3 minVector = new Vector3(0.3, 0.3, 0.3); public Vector3 maxVector = new Vector3(0.7, 0.7, 0.7); @@ -240,13 +241,14 @@ public class BlockWire extends BlockMachine implements IExtraObjectInfo @Override public boolean hasExtraConfigs() { - return false; + return true; } @Override public void loadExtraConfigs(Configuration config) { - //TODO add config options for max amps, and resistance + this.wireResistance = config.get("Settings", "miliOhms", 1,"Resistance of the wire in 1/1000 of an ohm").getInt()/1000; + this.ampMax = config.get("Settings", "maxAmps", 10000,"Amp limit of the wire").getInt(); } diff --git a/src/dark/common/transmit/TileEntityWire.java b/src/dark/common/transmit/TileEntityWire.java index 6b1e371f..e8cb4ec0 100644 --- a/src/dark/common/transmit/TileEntityWire.java +++ b/src/dark/common/transmit/TileEntityWire.java @@ -20,13 +20,13 @@ public class TileEntityWire extends TileEntityUniversalConductor @Override public float getResistance() { - return 0.001f; + return BlockWire.wireResistance; } @Override public float getCurrentCapacity() { - return 10000f; + return BlockWire.ampMax; } @Override diff --git a/src/dark/prefab/tilenetwork/NetworkTileEntities.java b/src/dark/prefab/tilenetwork/NetworkTileEntities.java index 1e31225a..c0d87a2e 100644 --- a/src/dark/prefab/tilenetwork/NetworkTileEntities.java +++ b/src/dark/prefab/tilenetwork/NetworkTileEntities.java @@ -95,7 +95,6 @@ public abstract class NetworkTileEntities else { part.setTileNetwork(this); - } }