mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-28 02:05:39 +00:00
Refactor Ability GUI to support third-party extensibility
This refactoring allows third-party mods to provide their own custom GUI for ability type settings by extending SubGuiAbilityConfig. Changes: - Refactored SubGuiAbilityConfig as base class with GuiMenuTopButton tabs - Added virtual methods: initTypeTab(), handleTypeButton(), handleTypeTextField() - Added createConfigGui() method to Ability base class for GUI instantiation - Created 15 SubGuiAbility* subclasses in new ability package - Updated GuiNPCAbilities and GuiNpcManageAbilities to use ability.createConfigGui() Third-party mods can now: 1. Create a custom Ability subclass 2. Extend SubGuiAbilityConfig with their own GUI 3. Override createConfigGui() to return their custom GUI
This commit is contained in:
34 files changed
+1634
-964
No files matched your search
@@ -241,6 +241,22 @@ public abstract class Ability implements IAbility {
|
||||
*/
|
||||
public int getTypeSettingsRowCount() { return 0; }
|
||||
|
||||
/**
|
||||
* Creates the GUI for configuring this ability.
|
||||
* Override this method to provide a custom GUI subclass for type-specific settings.
|
||||
*
|
||||
* Third-party mods can extend SubGuiAbilityConfig and override initTypeTab(),
|
||||
* handleTypeButton(), and handleTypeTextField() to provide custom type settings.
|
||||
*
|
||||
* @param callback The callback to notify when the ability is saved
|
||||
* @return A SubGuiAbilityConfig instance (or subclass) for configuring this ability
|
||||
*/
|
||||
@cpw.mods.fml.relauncher.SideOnly(cpw.mods.fml.relauncher.Side.CLIENT)
|
||||
public noppes.npcs.client.gui.advanced.SubGuiAbilityConfig createConfigGui(
|
||||
noppes.npcs.client.gui.advanced.IAbilityConfigCallback callback) {
|
||||
return new noppes.npcs.client.gui.advanced.SubGuiAbilityConfig(this, callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a telegraph instance for this ability.
|
||||
* Override for custom telegraph shapes.
|
||||
|
||||
Reference in new issue
Block a user