added support for \n in tooltip strings

added \n test tooltip localization
fixed int/double conversion error in slider entry
added test slider scenario that highlighted conversion error
This commit is contained in:
bspkrs committed 2014-07-24 16:51:15 -04:00
1 parent 5643237fb9
commit 09d68fb7bd
3 files changed
+7 -7

No files matched your search

@@ -75,7 +75,7 @@ public class FMLConfigGuiFactory implements IModGuiFactory
// Numbers category
numbersList.add((new DummyConfigElement<Integer>("basicInteger", 42, ConfigGuiType.INTEGER, "fml.config.sample.basicInteger")));
numbersList.add((new DummyConfigElement<Integer>("boundedInteger", 42, ConfigGuiType.INTEGER, "fml.config.sample.boundedInteger", -1, 256)));
numbersList.add((new DummyConfigElement<Integer>("sliderInteger", 42, ConfigGuiType.INTEGER, "fml.config.sample.sliderInteger", -1, 256)).setCustomListEntryClass(NumberSliderEntry.class));
numbersList.add((new DummyConfigElement<Integer>("sliderInteger", 2000, ConfigGuiType.INTEGER, "fml.config.sample.sliderInteger", 100, 10000)).setCustomListEntryClass(NumberSliderEntry.class));
numbersList.add(new DummyConfigElement<Double>("basicDouble", 42.4242D, ConfigGuiType.DOUBLE, "fml.config.sample.basicDouble"));
numbersList.add(new DummyConfigElement<Double>("boundedDouble", 42.4242D, ConfigGuiType.DOUBLE, "fml.config.sample.boundedDouble", -1.0D, 256.256D));
numbersList.add(new DummyConfigElement<Double>("sliderDouble", 42.4242D, ConfigGuiType.DOUBLE, "fml.config.sample.sliderDouble", -1.0D, 256.256D).setCustomListEntryClass(NumberSliderEntry.class));
@@ -812,7 +812,7 @@ public class GuiConfigEntries extends GuiListExtended
public boolean isDefault()
{
if (configElement.getType() == ConfigGuiType.INTEGER)
return (int) ((GuiSlider) this.btnValue).getValue() == Integer.valueOf(configElement.getDefault().toString());
return ((GuiSlider) this.btnValue).getValueInt() == Integer.valueOf(configElement.getDefault().toString());
else
return ((GuiSlider) this.btnValue).getValue() == Double.valueOf(configElement.getDefault().toString());
}
@@ -831,7 +831,7 @@ public class GuiConfigEntries extends GuiListExtended
public boolean isChanged()
{
if (configElement.getType() == ConfigGuiType.INTEGER)
return (int) ((GuiSlider) this.btnValue).getValue() != (int) beforeValue;
return ((GuiSlider) this.btnValue).getValueInt() != (int) Math.round(beforeValue);
else
return ((GuiSlider) this.btnValue).getValue() != beforeValue;
}
@@ -852,7 +852,7 @@ public class GuiConfigEntries extends GuiListExtended
if (this.enabled() && this.isChanged())
{
if (configElement.getType() == ConfigGuiType.INTEGER)
configElement.set((int) ((GuiSlider) this.btnValue).getValue());
configElement.set(((GuiSlider) this.btnValue).getValueInt());
else
configElement.set(((GuiSlider) this.btnValue).getValue());
return configElement.requiresMcRestart();
@@ -864,7 +864,7 @@ public class GuiConfigEntries extends GuiListExtended
public Object getCurrentValue()
{
if (configElement.getType() == ConfigGuiType.INTEGER)
return (int) ((GuiSlider) this.btnValue).getValue();
return ((GuiSlider) this.btnValue).getValueInt();
else
return ((GuiSlider) this.btnValue).getValue();
}
@@ -1501,7 +1501,7 @@ public class GuiConfigEntries extends GuiListExtended
String comment;
comment = I18n.format(configElement.getLanguageKey() + ".tooltip");
comment = I18n.format(configElement.getLanguageKey() + ".tooltip").replace("\\n", "\n");
if (!comment.equals(configElement.getLanguageKey() + ".tooltip"))
toolTip = new ArrayList<String>(this.mc.fontRenderer.listFormattedStringToWidth(
@@ -36,7 +36,7 @@ fml.config.sample.imABoolean.tooltip=Yep, that's pretty much it... I'm a Boolean
fml.config.sample.imABoolean=I'm a Boolean
fml.config.sample.imADouble.tooltip=There are two of me. Or maybe I work for both the CIA and the KGB. Not sure.
fml.config.sample.imADouble=I'm a Double
fml.config.sample.imAString.tooltip=Aah. Now, I understand you want us to advertise your washing powder. <*String.*> String, washing powder, what's the difference? We can sell anything. <*Good. Well I have this large quantity of string, 122,000 miles of it to be exact, which I inherited, and I thought if I advertised it...*> Of course! A national campaign. Useful stuff, string, no trouble there. <*Ah, but there's a snag, you see. Due to bad planning, the 122,000 miles is in three inch lengths. So it's not very useful.*> Well, that's our selling point! SIMPSON'S INDIVIDUAL STRINGETTES! THE NOW STRING! READY CUT, EASY TO HANDLE, SIMPSON'S INDIVIDUAL EMPEROR STRINGETTES - JUST THE RIGHT LENGTH!
fml.config.sample.imAString.tooltip=Aah. Now, I understand you want us to advertise your washing powder. \n<*String.*> \nString, washing powder, what's the difference? We can sell anything. \n<*Good. Well I have this large quantity of string, 122,000 miles of it to be exact, which I inherited, and I thought if I advertised it...*> \nOf course! A national campaign. Useful stuff, string, no trouble there. \n<*Ah, but there's a snag, you see. Due to bad planning, the 122,000 miles is in three inch lengths. So it's not very useful.*> \nWell, that's our selling point! SIMPSON'S INDIVIDUAL STRINGETTES! THE NOW STRING! READY CUT, EASY TO HANDLE, SIMPSON'S INDIVIDUAL EMPEROR STRINGETTES - JUST THE RIGHT LENGTH!
fml.config.sample.imAString=I'm a String
fml.config.sample.imAnInteger.tooltip=Did I say that I'm an Integer? Oh, I see.
fml.config.sample.imAnInteger=I'm an Integer