Merge pull request #484 from bspkrs/master

Added support for \n in GuiConfig tooltip strings + a slider fix
This commit is contained in:
LexManos 2014-08-07 14:41:51 -07:00
commit 12d4047459
3 changed files with 7 additions and 7 deletions

View File

@ -76,7 +76,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));

View File

@ -830,7 +830,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());
}
@ -849,7 +849,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;
}
@ -871,7 +871,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();
@ -883,7 +883,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();
}
@ -1529,7 +1529,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(

View File

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