Skip to content

Commit

Permalink
fix Feature Toggle Config Name length
Browse files Browse the repository at this point in the history
  • Loading branch information
sakura-ryoko committed Dec 2, 2024
1 parent 370a669 commit 0e3c6d2
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 34 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ mod_file_name = tweakeroo-fabric
mod_version = 0.22.2

# Required malilib version
malilib_version = 374820e625
malilib_version = fb23fa3224

# Minecraft, Fabric Loader and API and mappings versions
minecraft_version_out = 1.21.3
Expand Down
69 changes: 37 additions & 32 deletions src/main/java/fi/dy/masa/tweakeroo/config/FeatureToggle.java
Original file line number Diff line number Diff line change
Expand Up @@ -250,15 +250,13 @@ public String getName()
@Override
public String getConfigGuiDisplayName()
{
// This doesn't get called ?
String name = StringUtils.getTranslatedOrFallback(this.translatedName, this.name);

if (this.singlePlayer)
{
name = GuiBase.TXT_GOLD + name + GuiBase.TXT_RST;
}

//System.out.printf("FeatureToggle#getConfigGuiDisplayName(): translatedName [%s] // test [%s]\n", this.translatedName, name);
return name;
}

Expand All @@ -270,35 +268,16 @@ public String getPrettyName()
}

@Override
public String getStringValue()
{
return String.valueOf(this.valueBoolean);
}

@Override
public String getDefaultStringValue()
{
return String.valueOf(this.defaultValueBoolean);
}

@Override
public void setValueFromString(String value)
public String getTranslatedName()
{
}
String name = StringUtils.getTranslatedOrFallback(this.translatedName, this.name);

@Override
public void onValueChanged()
{
if (this.callback != null)
if (this.singlePlayer)
{
this.callback.onValueChanged(this);
name = GuiBase.TXT_GOLD + name + GuiBase.TXT_RST;
}
}

@Override
public void setValueChangeCallback(IValueChangeCallback<IConfigBoolean> callback)
{
this.callback = callback;
return name;
}

@Override
Expand All @@ -315,12 +294,6 @@ public String getComment()
return comment;
}

@Override
public String getTranslatedName()
{
return this.translatedName;
}

@Override
public void setPrettyName(String s)
{
Expand All @@ -344,6 +317,38 @@ private static String buildTranslateName(String name, String type)
return FEATURE_KEY + "." + type + "." + name;
}

@Override
public String getStringValue()
{
return String.valueOf(this.valueBoolean);
}

@Override
public String getDefaultStringValue()
{
return String.valueOf(this.defaultValueBoolean);
}

@Override
public void setValueFromString(String value)
{
}

@Override
public void onValueChanged()
{
if (this.callback != null)
{
this.callback.onValueChanged(this);
}
}

@Override
public void setValueChangeCallback(IValueChangeCallback<IConfigBoolean> callback)
{
this.callback = callback;
}

@Override
public IKeybind getKeybind()
{
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@

"depends": {
"minecraft": ">=1.21.2 <=1.21.3",
"malilib": ">=0.22.1"
"malilib": ">=0.22.3"
}
}

0 comments on commit 0e3c6d2

Please sign in to comment.