From 05354515b12d8f3f4da21fe43187cb2de4e4b33f Mon Sep 17 00:00:00 2001 From: CrazyPants Date: Mon, 8 Sep 2014 15:09:11 +0800 Subject: [PATCH] #989 Power conduit IO tooltip doesn't update with config changes --- .../conduit/power/ItemPowerConduit.java | 2 +- .../enderio/conduit/power/PowerConduit.java | 23 ++++++++++++------- .../crazypants/enderio/config/Config.java | 12 +++++----- 3 files changed, 22 insertions(+), 15 deletions(-) diff --git a/src/main/java/crazypants/enderio/conduit/power/ItemPowerConduit.java b/src/main/java/crazypants/enderio/conduit/power/ItemPowerConduit.java index 565bf80b..e78ec630 100644 --- a/src/main/java/crazypants/enderio/conduit/power/ItemPowerConduit.java +++ b/src/main/java/crazypants/enderio/conduit/power/ItemPowerConduit.java @@ -53,7 +53,7 @@ public class ItemPowerConduit extends AbstractItemConduit { PREFIX = Lang.localize("power.maxOutput") + " "; } super.addInformation(itemStack, par2EntityPlayer, list, par4); - ICapacitor cap = PowerConduit.CAPACITORS[itemStack.getItemDamage()]; + ICapacitor cap = PowerConduit.getCapacitors()[itemStack.getItemDamage()]; list.add(PREFIX + PowerDisplayUtil.formatPower(cap.getMaxEnergyExtracted()) + POSTFIX); } diff --git a/src/main/java/crazypants/enderio/conduit/power/PowerConduit.java b/src/main/java/crazypants/enderio/conduit/power/PowerConduit.java index 06718ce0..643517d3 100644 --- a/src/main/java/crazypants/enderio/conduit/power/PowerConduit.java +++ b/src/main/java/crazypants/enderio/conduit/power/PowerConduit.java @@ -44,15 +44,22 @@ import crazypants.vecmath.Vector3d; public class PowerConduit extends AbstractConduit implements IPowerConduit { static final Map ICONS = new HashMap(); - - static final ICapacitor[] CAPACITORS = new BasicCapacitor[] { - new BasicCapacitor(Config.powerConduitTierOneRF, Config.powerConduitTierOneRF), - new BasicCapacitor(Config.powerConduitTierTwoRF, Config.powerConduitTierTwoRF), - new BasicCapacitor(Config.powerConduitTierThreeRF, Config.powerConduitTierThreeRF) - }; + + private static ICapacitor[] capacitors; static final String[] POSTFIX = new String[] { "", "Enhanced", "Ender" }; + static ICapacitor[] getCapacitors() { + if(capacitors == null) { + capacitors = new BasicCapacitor[] { + new BasicCapacitor(Config.powerConduitTierOneRF, Config.powerConduitTierOneRF), + new BasicCapacitor(Config.powerConduitTierTwoRF, Config.powerConduitTierTwoRF), + new BasicCapacitor(Config.powerConduitTierThreeRF, Config.powerConduitTierThreeRF) + }; + } + return capacitors; + } + static ItemStack createItemStackForSubtype(int subtype) { ItemStack result = new ItemStack(EnderIO.itemPowerConduit, 1, subtype); return result; @@ -157,7 +164,7 @@ public class PowerConduit extends AbstractConduit implements IPowerConduit { @Override public ICapacitor getCapacitor() { - return CAPACITORS[subtype]; + return getCapacitors()[subtype]; } @Override @@ -514,7 +521,7 @@ public class PowerConduit extends AbstractConduit implements IPowerConduit { @Override public int getMaxEnergyStored() { - return CAPACITORS[subtype].getMaxEnergyStored(); + return getCapacitors()[subtype].getMaxEnergyStored(); } } diff --git a/src/main/java/crazypants/enderio/config/Config.java b/src/main/java/crazypants/enderio/config/Config.java index e4e10ba5..f8a2965b 100644 --- a/src/main/java/crazypants/enderio/config/Config.java +++ b/src/main/java/crazypants/enderio/config/Config.java @@ -330,7 +330,7 @@ public final class Config { .getInt(powerConduitTierOneRF); powerConduitTierTwoRF = config.get(sectionPower.name, "powerConduitTierTwoRF", powerConduitTierTwoRF, "The maximum IO for the tier 2 power conduit") .getInt(powerConduitTierTwoRF); - powerConduitTierThreeRF = config.get(sectionPower.name, "powerConduitTierThreeRF", powerConduitTierTwoRF, "The maximum IO for the tier 3 power conduit") + powerConduitTierThreeRF = config.get(sectionPower.name, "powerConduitTierThreeRF", powerConduitTierThreeRF, "The maximum IO for the tier 3 power conduit") .getInt(powerConduitTierThreeRF); powerConduitCanDifferentTiersConnect = config .getBoolean("powerConduitCanDifferentTiersConnect", sectionPower.name, powerConduitCanDifferentTiersConnect, @@ -409,9 +409,9 @@ public final class Config { transceiverUpkeepCostRF = config.get(sectionPower.name, "transceiverUpkeepCostRF", transceiverUpkeepCostRF, "Number of RF/t required to keep a Dimensional Transceiver connection open").getInt(transceiverUpkeepCostRF); transceiverMaxIoRF = config.get(sectionPower.name, "transceiverMaxIoRF", transceiverMaxIoRF, - "Maximum MJ/t sent and recieved by a Dimensional Transceiver per tick. Input and output limits are not cumulative").getInt(transceiverMaxIoRF); + "Maximum RF/t sent and recieved by a Dimensional Transceiver per tick. Input and output limits are not cumulative").getInt(transceiverMaxIoRF); transceiverBucketTransmissionCostRF = config.get(sectionEfficiency.name, "transceiverBucketTransmissionCostRF", transceiverBucketTransmissionCostRF, - "The cost in MJ of transporting a bucket of fluid via a Dimensional Transceiver.").getInt(transceiverBucketTransmissionCostRF); + "The cost in RF of transporting a bucket of fluid via a Dimensional Transceiver.").getInt(transceiverBucketTransmissionCostRF); vatPowerUserPerTickRF = config.get(sectionPower.name, "vatPowerUserPerTickRF", vatPowerUserPerTickRF, "Power use (RF/t) used by the vat.").getInt(vatPowerUserPerTickRF); @@ -421,7 +421,7 @@ public final class Config { sectionAdvanced.name, "perInterfacePowerTrackingEnabled", detailedPowerTrackingEnabled, - "Enable per tick sampling on individual power inputs and outputs. This allows slightly more detailed messages from the MJ Reader but has a negative impact on server performance.") + "Enable per tick sampling on individual power inputs and outputs. This allows slightly more detailed messages from the RF Reader but has a negative impact on server performance.") .getBoolean(detailedPowerTrackingEnabled); useSneakMouseWheelYetaWrench = config.get(sectionPersonal.name, "useSneakMouseWheelYetaWrench", useSneakMouseWheelYetaWrench, @@ -462,7 +462,7 @@ public final class Config { travelStaffMaxDistance = config.get(sectionStaff.name, "travelStaffMaxDistance", travelStaffMaxDistance, "Maximum number of blocks that can be traveled using the Staff of the Traveling.").getInt(travelStaffMaxDistance); travelStaffPowerPerBlockRF = (float) config.get(sectionStaff.name, "travelStaffPowerPerBlockRF", travelStaffPowerPerBlockRF, - "Number of MJ required per block travelled using the Staff of the Traveling.").getDouble(travelStaffPowerPerBlockRF); + "Number of RF required per block travelled using the Staff of the Traveling.").getDouble(travelStaffPowerPerBlockRF); travelStaffMaxBlinkDistance = config.get(sectionStaff.name, "travelStaffMaxBlinkDistance", travelStaffMaxBlinkDistance, "Max number of blocks teleported when shift clicking the staff.").getInt(travelStaffMaxBlinkDistance); @@ -651,7 +651,7 @@ public final class Config { "The amount of power generated per tick.").getInt(stirlingGeneratorBaseRfPerTick); addFuelTooltipsToAllFluidContainers = config.get(sectionPersonal.name, "addFuelTooltipsToAllFluidContainers", addFuelTooltipsToAllFluidContainers, - "If true, the MJ/t and burn time of the fuel will be displayed in all tooltips for fluid containers with fuel.").getBoolean( + "If true, the RF/t and burn time of the fuel will be displayed in all tooltips for fluid containers with fuel.").getBoolean( addFuelTooltipsToAllFluidContainers); addDurabilityTootip = config.get(sectionPersonal.name, "addDurabilityTootip", addFuelTooltipsToAllFluidContainers, "If true, adds durability tooltips to tools and armor").getBoolean(