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.
This commit is contained in:
DarkGuardsman 2013-09-03 00:16:22 -04:00
parent bd3b4e58b2
commit a7e0c9b6a2
3 changed files with 7 additions and 6 deletions

View file

@ -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();
}

View file

@ -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

View file

@ -95,7 +95,6 @@ public abstract class NetworkTileEntities
else
{
part.setTileNetwork(this);
}
}