Gui config
MrStickyPiston opened this issue · 15 comments
The Gui itself (if you are reffering to the subclass within Configurable interface) is used only as grouping of GUI specific subinterfaces for improved readability.
For example there is @NumberFormat
annotation which is used to specify DecimalFormat of numbers which will be displayed on gui, or @ColorValue
which adds color picker to your string config field and so on.
For example there is @numberformat annotation which is used to specify DecimalFormat of numbers which will be displayed on gui
But what gui is that used in?
The GUI is generated automatically and the fields with @Configurable
annotation are displayed. The GUI subclasses only edit specific attributes of the generated GUI elements, you cannot configure entire GUI.
The GUI can be accessed within the Mods
directory on Forge, or by using ModMenu mod on Fabric.
Or maybe you could specify in detail what you exactly want to do
The screenshot was not from the development environment but in a normal client environment.
This is my config, am i doing something wrong?
import dev.toma.configuration.config.Config;
import dev.toma.configuration.config.Configurable;
@Config(id = BuildersJetpack.MOD_ID)
public class ModConfig {
public enum fuelHudType {
NONE,
BAR,
PERCENTAGE,
NUMBER
}
// Client
@Configurable
@Configurable.Comment("The particle that will be displayed under the player while flying")
public String PARTICLE = "minecraft:cloud";
@Configurable
@Configurable.Comment("The sound that will be played when the player uses the jetpack fuel item")
public String FUEL_ITEM_SUCCESS = "minecraft:item.bucket.fill_lava";
@Configurable
@Configurable.Comment("Hide the fuel hud if chat is open to avoid overlapping")
public boolean FUEL_HUD_CHAT_FIX = true;
@Configurable
@Configurable.Comment("X location of the fuel hud")
public float FUEL_HUD_X = 10;
@Configurable
@Configurable.Comment("Y location of the fuel hud")
public float FUEL_HUD_Y = 10;
@Configurable
@Configurable.Comment("How the amount of fuel will be displayed. (NONE, BAR, PERCENTAGE, NUMBER)")
public fuelHudType FUEL_HUD_TYPE = fuelHudType.BAR;
@Configurable
@Configurable.Comment("Fuel icon used for the fuel bar")
public String FUEL_BAR_ICON = "▊";
@Configurable
@Configurable.Comment("Color code for the remaining fuel in the fuel bar")
public String FUEL_BAR_REMAINING_COLOR = "§f";
@Configurable
@Configurable.Comment("Color code for the used fuel in the fuel bar")
public String FUEL_BAR_USED_COLOR = "§8";
// Server
@Configurable
@Configurable.Comment("The maximum amount of fuel a jetpack can have")
@Configurable.Range(min=0)
public int MAX_FUEL = 1000;
@Configurable
@Configurable.Comment("The base fuel cost per tick while flying")
@Configurable.DecimalRange(min=0)
@Configurable.Gui.NumberFormat("0.000#")
public float FLY_BASE_FUEL_COST = 0.002F;
@Configurable
@Configurable.Comment("The cost per speed of flying with formula SPEED/COST")
@Configurable.DecimalRange(min=0.00001)
@Configurable.Gui.NumberFormat("0.000#")
public float FLY_MOVEMENT_FUEL_COST = 40F;
@Configurable
@Configurable.Comment("Show warnings in chat when fuel reaches a certain amount")
public boolean FUEL_WARNING = true;
@Configurable
@Configurable.Comment("The milestones a warning is sent if fuel warning is true")
@Configurable.Range(min=0)
public int[] FUEL_WARNINGS = {100, 50, 25, 10, 5, 4, 3, 2, 1};
@Configurable
@Configurable.Comment("The amount of fuel the fuel item adds to the jetpack")
@Configurable.Range(min=0)
public int FUEL_ITEM_AMOUNT = 100;
@Configurable
@Configurable.Comment("The amount of speed the fuel cost will be capped")
@Configurable.DecimalRange(min=0)
public float FUEL_SPEED_CAP = 1.4F;
}
I have not touched fabric in a long time, but I believe there was some issue with the config gui display within development environment.
If the config file is created normally (i.e. exists in the config directory) then everything should be okay on your side. If not, then it means that you have not registered your config.
The config file generates and values edited appear in game, so its just the gui thats broken?
Weird, this should not be needed as it should be automatically integrated using the ModMenu API - implemented here
I'll look into it more
I got it working using
public class ModMenuApiImpl implements ModMenuApi {
@Override
public ConfigScreenFactory<?> getModConfigScreenFactory() {
return parent -> Configuration.getConfigScreenByGroup(BuildersJetpack.MOD_ID, parent);
}
}
May be worth to notice this in the setup guide.