Declarative ability GUI: replace 18 SubGui classes with FieldDef system

All ability GUI tabs (General, Target, Effects, Type, Visual) are now
fully declarative via FieldDef definitions. Deleted 18 SubGuiAbility*
classes (~3100 lines) and rewrote SubGuiAbilityConfig to use
GuiScrollWindow for every tab with a unified field renderer.

- Add FieldDef, FieldType, TabTarget, ColumnHint, TabDef gui framework
- Add getFieldDefinitions() to all 18 ability subclasses
- Add getBaseFieldDefinitions() to Ability.java for shared tabs
- Merge COLOR/EFFECTS into SUB_GUI with convenience factories
- Net reduction: ~3100 lines removed

Co-Authored-By: Claude Opus 4.5 <[email protected]>
This commit is contained in:
KamandClaude Opus 4.5 committed 2026-02-02 16:17:37 -05:00
1 parent 17eb003a12
commit 0ff501bb16
43 files changed
+1232 -3998

No files matched your search

File diff suppressed because it is too large. Load diff
@@ -1,92 +0,0 @@
package noppes.npcs.client.gui.advanced.ability;
import kamkeel.npcs.controllers.data.ability.AbilityEffect;
import kamkeel.npcs.controllers.data.ability.type.AbilityCharge;
import noppes.npcs.client.gui.advanced.SubGuiAbilityConfig;
import noppes.npcs.client.gui.util.GuiNpcButton;
import noppes.npcs.client.gui.util.GuiNpcLabel;
import noppes.npcs.client.gui.util.GuiNpcTextField;
import noppes.npcs.client.gui.util.IAbilityConfigCallback;
import noppes.npcs.client.gui.util.SubGuiInterface;
import java.util.List;
/**
* GUI for configuring Charge ability type-specific settings.
*/
public class SubGuiAbilityCharge extends SubGuiAbilityConfig {
private final AbilityCharge charge;
public SubGuiAbilityCharge(AbilityCharge ability, IAbilityConfigCallback callback) {
super(ability, callback);
this.charge = ability;
}
@Override
protected void initTypeTab(int startY) {
int y = startY;
int labelX = guiLeft + 8;
int fieldX = guiLeft + 85;
int col2LabelX = guiLeft + 145;
int col2FieldX = guiLeft + 205;
// Row 1: Damage + Speed
addLabel(new GuiNpcLabel(100, "enchantment.damage", labelX, y + 5));
addTextField(createFloatField(100, fieldX, y, 50, charge.getDamage()));
addLabel(new GuiNpcLabel(101, "stats.speed", col2LabelX, y + 5));
addTextField(createFloatField(101, col2FieldX, y, 50, charge.getChargeSpeed()));
y += 24;
// Row 2: Knockback
addLabel(new GuiNpcLabel(102, "ability.knockback", labelX, y + 5));
addTextField(createFloatField(102, fieldX, y, 50, charge.getKnockback()));
y += 24;
// Row 3: Hit Width + Effects
addLabel(new GuiNpcLabel(104, "ability.hitWidth", labelX, y + 5));
addTextField(createFloatField(104, fieldX, y, 50, charge.getHitWidth()));
addButton(new GuiNpcButton(150, col2LabelX, y, 80, 20, "ability.effects"));
}
@Override
protected void handleTypeButton(int id, GuiNpcButton button) {
if (id == 150) {
setSubGui(new SubGuiAbilityEffects(charge.getEffects()));
}
}
@Override
public void subGuiClosed(SubGuiInterface subgui) {
super.subGuiClosed(subgui);
if (subgui instanceof SubGuiAbilityEffects) {
SubGuiAbilityEffects effectsGui = (SubGuiAbilityEffects) subgui;
List<AbilityEffect> result = effectsGui.getResult();
if (result != null) {
charge.setEffects(result);
}
}
}
@Override
protected void handleTypeTextField(int id, GuiNpcTextField field) {
switch (id) {
case 100:
charge.setDamage(parseFloat(field, charge.getDamage()));
break;
case 101:
charge.setChargeSpeed(parseFloat(field, charge.getChargeSpeed()));
break;
case 102:
charge.setKnockback(parseFloat(field, charge.getKnockback()));
break;
case 104:
charge.setHitWidth(parseFloat(field, charge.getHitWidth()));
break;
}
}
}
@@ -1,141 +0,0 @@
package noppes.npcs.client.gui.advanced.ability;
import kamkeel.npcs.controllers.data.ability.AbilityEffect;
import kamkeel.npcs.controllers.data.ability.type.AbilityCutter;
import noppes.npcs.client.gui.advanced.SubGuiAbilityConfig;
import noppes.npcs.client.gui.util.GuiNpcButton;
import noppes.npcs.client.gui.util.GuiNpcLabel;
import noppes.npcs.client.gui.util.GuiNpcTextField;
import noppes.npcs.client.gui.util.IAbilityConfigCallback;
import noppes.npcs.client.gui.util.SubGuiInterface;
import java.util.List;
/**
* GUI for configuring Cutter ability type-specific settings.
*/
public class SubGuiAbilityCutter extends SubGuiAbilityConfig {
private final AbilityCutter cutter;
public SubGuiAbilityCutter(AbilityCutter ability, IAbilityConfigCallback callback) {
super(ability, callback);
this.cutter = ability;
}
@Override
protected void initTypeTab(int startY) {
int y = startY;
int labelX = guiLeft + 8;
int fieldX = guiLeft + 85;
int col2LabelX = guiLeft + 145;
int col2FieldX = guiLeft + 205;
// Row 1: Damage + Range
addLabel(new GuiNpcLabel(100, "enchantment.damage", labelX, y + 5));
addTextField(createFloatField(100, fieldX, y, 50, cutter.getDamage()));
addLabel(new GuiNpcLabel(101, "gui.range", col2LabelX, y + 5));
addTextField(createFloatField(101, col2FieldX, y, 50, cutter.getRange()));
y += 24;
// Row 2: Arc Angle + Inner Radius
addLabel(new GuiNpcLabel(102, "ability.arcAngle", labelX, y + 5));
addTextField(createFloatField(102, fieldX, y, 50, cutter.getArcAngle()));
addLabel(new GuiNpcLabel(103, "ability.innerRadius", col2LabelX, y + 5));
addTextField(createFloatField(103, col2FieldX, y, 50, cutter.getInnerRadius()));
y += 24;
// Row 3: Knockback + Sweep Speed
addLabel(new GuiNpcLabel(104, "ability.knockback", labelX, y + 5));
addTextField(createFloatField(104, fieldX, y, 50, cutter.getKnockback()));
addLabel(new GuiNpcLabel(105, "ability.sweepSpeed", col2LabelX, y + 5));
addTextField(createFloatField(105, col2FieldX, y, 50, cutter.getSweepSpeed()));
y += 24;
// Row 4: Sweep Mode + Piercing
addLabel(new GuiNpcLabel(106, "ability.sweepMode", labelX, y + 5));
String[] sweepModes = {"Swipe", "Spin"};
GuiNpcButton sweepModeBtn = new GuiNpcButton(106, fieldX, y, 70, 20, sweepModes, cutter.getSweepModeEnum().ordinal());
sweepModeBtn.setHoverText("ability.hover.sweepMode");
addButton(sweepModeBtn);
addLabel(new GuiNpcLabel(107, "ability.piercing", col2LabelX, y + 5));
GuiNpcButton piercingBtn = new GuiNpcButton(107, col2FieldX, y, 50, 20, new String[]{"gui.no", "gui.yes"}, cutter.isPiercing() ? 1 : 0);
piercingBtn.setHoverText("ability.hover.piercing");
addButton(piercingBtn);
y += 24;
// Row 5: Spin Duration (only for SPIN mode) + Effects button
if (cutter.getSweepModeEnum() == AbilityCutter.SweepMode.SPIN) {
addLabel(new GuiNpcLabel(108, "ability.duration", labelX, y + 5));
GuiNpcTextField durationField = createIntField(108, fieldX, y, 50, cutter.getSpinDurationTicks());
durationField.setMinMaxDefault(1, 1000, 60);
addTextField(durationField);
}
addButton(new GuiNpcButton(150, col2LabelX, y, 80, 20, "ability.effects"));
}
@Override
protected void handleTypeButton(int id, GuiNpcButton button) {
int value = button.getValue();
switch (id) {
case 106:
cutter.setSweepModeEnum(AbilityCutter.SweepMode.values()[value]);
initGui(); // Refresh to show/hide duration field
break;
case 107:
cutter.setPiercing(value == 1);
break;
case 150:
setSubGui(new SubGuiAbilityEffects(cutter.getEffects()));
break;
}
}
@Override
public void subGuiClosed(SubGuiInterface subgui) {
super.subGuiClosed(subgui);
if (subgui instanceof SubGuiAbilityEffects) {
SubGuiAbilityEffects effectsGui = (SubGuiAbilityEffects) subgui;
List<AbilityEffect> result = effectsGui.getResult();
if (result != null) {
cutter.setEffects(result);
}
}
}
@Override
protected void handleTypeTextField(int id, GuiNpcTextField field) {
switch (id) {
case 100:
cutter.setDamage(parseFloat(field, cutter.getDamage()));
break;
case 101:
cutter.setRange(parseFloat(field, cutter.getRange()));
break;
case 102:
cutter.setArcAngle(parseFloat(field, cutter.getArcAngle()));
break;
case 103:
cutter.setInnerRadius(parseFloat(field, cutter.getInnerRadius()));
break;
case 104:
cutter.setKnockback(parseFloat(field, cutter.getKnockback()));
break;
case 105:
cutter.setSweepSpeed(parseFloat(field, cutter.getSweepSpeed()));
break;
case 108:
cutter.setSpinDurationTicks(field.getInteger());
break;
}
}
}
@@ -1,65 +0,0 @@
package noppes.npcs.client.gui.advanced.ability;
import kamkeel.npcs.controllers.data.ability.type.AbilityDash;
import noppes.npcs.client.gui.advanced.SubGuiAbilityConfig;
import noppes.npcs.client.gui.util.GuiNpcButton;
import noppes.npcs.client.gui.util.GuiNpcLabel;
import noppes.npcs.client.gui.util.GuiNpcTextField;
import noppes.npcs.client.gui.util.IAbilityConfigCallback;
/**
* GUI for configuring Dash ability type-specific settings.
*/
public class SubGuiAbilityDash extends SubGuiAbilityConfig {
private final AbilityDash dash;
public SubGuiAbilityDash(AbilityDash ability, IAbilityConfigCallback callback) {
super(ability, callback);
this.dash = ability;
}
@Override
protected void initTypeTab(int startY) {
int y = startY;
int labelX = guiLeft + 8;
int fieldX = guiLeft + 85;
int col2LabelX = guiLeft + 145;
int col2FieldX = guiLeft + 205;
// Row 1: Dash Mode
addLabel(new GuiNpcLabel(100, "ability.mode", labelX, y + 5));
String[] dashModes = {"Aggressive", "Defensive"};
GuiNpcButton modeBtn = new GuiNpcButton(100, fieldX, y, 80, 20, dashModes, dash.getDashModeEnum().ordinal());
modeBtn.setHoverText("ability.hover.dashMode");
addButton(modeBtn);
y += 24;
// Row 2: Dash Distance + Dash Speed
addLabel(new GuiNpcLabel(101, "ability.dashDist", labelX, y + 5));
addTextField(createFloatField(101, fieldX, y, 50, dash.getDashDistance()));
addLabel(new GuiNpcLabel(102, "ability.dashSpeed", col2LabelX, y + 5));
addTextField(createFloatField(102, col2FieldX, y, 50, dash.getDashSpeed()));
}
@Override
protected void handleTypeButton(int id, GuiNpcButton button) {
if (id == 100) {
dash.setDashModeEnum(AbilityDash.DashMode.values()[button.getValue()]);
}
}
@Override
protected void handleTypeTextField(int id, GuiNpcTextField field) {
switch (id) {
case 101:
dash.setDashDistance(parseFloat(field, dash.getDashDistance()));
break;
case 102:
dash.setDashSpeed(parseFloat(field, dash.getDashSpeed()));
break;
}
}
}
@@ -1,323 +0,0 @@
package noppes.npcs.client.gui.advanced.ability;
import kamkeel.npcs.controllers.data.ability.AbilityEffect;
import kamkeel.npcs.controllers.data.ability.AnchorPoint;
import kamkeel.npcs.controllers.data.ability.type.AbilityDisc;
import noppes.npcs.client.gui.SubGuiColorSelector;
import noppes.npcs.client.gui.advanced.SubGuiAbilityConfig;
import noppes.npcs.client.gui.util.GuiNpcButton;
import noppes.npcs.client.gui.util.GuiNpcLabel;
import noppes.npcs.client.gui.util.GuiNpcTextField;
import noppes.npcs.client.gui.util.IAbilityConfigCallback;
import noppes.npcs.client.gui.util.SubGuiInterface;
import java.util.List;
/**
* GUI for configuring Disc ability type-specific settings.
*/
public class SubGuiAbilityDisc extends SubGuiAbilityConfig {
private final AbilityDisc disc;
private int editingVisualColorId = 0;
public SubGuiAbilityDisc(AbilityDisc ability, IAbilityConfigCallback callback) {
super(ability, callback);
this.disc = ability;
}
@Override
protected boolean hasVisualSettings() {
return true;
}
@Override
protected void initTypeTab(int startY) {
int y = startY;
int labelX = guiLeft + 8;
int fieldX = guiLeft + 85;
int col2LabelX = guiLeft + 145;
int col2FieldX = guiLeft + 205;
// Row 1: Damage + Speed
addLabel(new GuiNpcLabel(100, "enchantment.damage", labelX, y + 5));
addTextField(createFloatField(100, fieldX, y, 50, disc.getDamage()));
addLabel(new GuiNpcLabel(101, "stats.speed", col2LabelX, y + 5));
addTextField(createFloatField(101, col2FieldX, y, 50, disc.getSpeed()));
y += 24;
// Row 2: Disc Radius + Disc Thickness
addLabel(new GuiNpcLabel(102, "ability.discRadius", labelX, y + 5));
addTextField(createFloatField(102, fieldX, y, 50, disc.getDiscRadius()));
addLabel(new GuiNpcLabel(103, "ability.discThickness", col2LabelX, y + 5));
addTextField(createFloatField(103, col2FieldX, y, 50, disc.getDiscThickness()));
y += 24;
// Row 3: Homing + Homing Strength (only show strength if homing)
addLabel(new GuiNpcLabel(104, "ability.homing", labelX, y + 5));
GuiNpcButton homingBtn = new GuiNpcButton(104, fieldX, y, 50, 20, new String[]{"gui.no", "gui.yes"}, disc.isHoming() ? 1 : 0);
homingBtn.setHoverText("ability.hover.homing");
addButton(homingBtn);
if (disc.isHoming()) {
addLabel(new GuiNpcLabel(105, "ability.homingStr", col2LabelX, y + 5));
addTextField(createFloatField(105, col2FieldX, y, 50, disc.getHomingStrength()));
}
y += 24;
// Row 4: Boomerang + Boomerang Delay (only show delay if boomerang)
addLabel(new GuiNpcLabel(106, "ability.boomerang", labelX, y + 5));
GuiNpcButton boomerangBtn = new GuiNpcButton(106, fieldX, y, 50, 20, new String[]{"gui.no", "gui.yes"}, disc.isBoomerang() ? 1 : 0);
boomerangBtn.setHoverText("ability.hover.boomerang");
addButton(boomerangBtn);
if (disc.isBoomerang()) {
addLabel(new GuiNpcLabel(107, "ability.boomerangDelay", col2LabelX, y + 5));
addTextField(createIntField(107, col2FieldX, y, 50, disc.getBoomerangDelay()));
}
y += 24;
// Row 5: Explosive + Explosion Radius (only show radius if explosive)
addLabel(new GuiNpcLabel(108, "ability.explosive", labelX, y + 5));
GuiNpcButton explosiveBtn = new GuiNpcButton(108, fieldX, y, 50, 20, new String[]{"gui.no", "gui.yes"}, disc.isExplosive() ? 1 : 0);
explosiveBtn.setHoverText("ability.hover.explosive");
addButton(explosiveBtn);
if (disc.isExplosive()) {
addLabel(new GuiNpcLabel(109, "ability.explosionRad", col2LabelX, y + 5));
addTextField(createFloatField(109, col2FieldX, y, 50, disc.getExplosionRadius()));
}
y += 24;
// Row 6: Knockback + Max Distance
addLabel(new GuiNpcLabel(110, "ability.knockback", labelX, y + 5));
addTextField(createFloatField(110, fieldX, y, 50, disc.getKnockback()));
addLabel(new GuiNpcLabel(111, "ability.maxDist", col2LabelX, y + 5));
addTextField(createFloatField(111, col2FieldX, y, 50, disc.getMaxDistance()));
y += 24;
// Row 7: Max Lifetime + Effects button
addLabel(new GuiNpcLabel(112, "ability.lifetime", labelX, y + 5));
addTextField(createIntField(112, fieldX, y, 50, disc.getMaxLifetime()));
addButton(new GuiNpcButton(150, col2LabelX, y, 80, 20, "ability.effects"));
}
@Override
protected void initVisualTab(int startY) {
int y = startY;
int labelX = guiLeft + 8;
int fieldX = guiLeft + 85;
int col2LabelX = guiLeft + 180;
int col2FieldX = guiLeft + 260;
// Row 1: Anchor Point
addLabel(new GuiNpcLabel(210, "ability.anchorPoint", labelX, y + 5));
GuiNpcButton anchorBtn = new GuiNpcButton(210, fieldX, y, 80, 20, AnchorPoint.getDisplayNames(), disc.getAnchorPointEnum().getId());
anchorBtn.setHoverText("ability.hover.anchorPoint");
addButton(anchorBtn);
y += 24;
// Row 2: Inner Color + Outer Color
addLabel(new GuiNpcLabel(200, "ability.innerColor", labelX, y + 5));
String innerHex = String.format("%06X", disc.getInnerColor() & 0xFFFFFF);
GuiNpcButton innerColorBtn = new GuiNpcButton(200, fieldX, y, 55, 20, innerHex);
innerColorBtn.setTextColor(disc.getInnerColor() & 0xFFFFFF);
addButton(innerColorBtn);
addLabel(new GuiNpcLabel(201, "ability.outerColor", col2LabelX, y + 5));
String outerHex = String.format("%06X", disc.getOuterColor() & 0xFFFFFF);
GuiNpcButton outerColorBtn = new GuiNpcButton(201, col2FieldX, y, 55, 20, outerHex);
outerColorBtn.setTextColor(disc.getOuterColor() & 0xFFFFFF);
outerColorBtn.setEnabled(disc.isOuterColorEnabled());
addButton(outerColorBtn);
y += 24;
// Row 2: Outer Color Enabled + Outer Color Width
addLabel(new GuiNpcLabel(202, "ability.outerEnabled", labelX, y + 5));
addButton(new GuiNpcButton(202, fieldX, y, 50, 20, new String[]{"gui.no", "gui.yes"}, disc.isOuterColorEnabled() ? 1 : 0));
addLabel(new GuiNpcLabel(203, "ability.outerWidth", col2LabelX, y + 5));
GuiNpcTextField widthField = createFloatField(203, col2FieldX, y, 55, disc.getOuterColorWidth());
widthField.setEnabled(disc.isOuterColorEnabled());
addTextField(widthField);
y += 24;
// Row 3: Outer Color Alpha
addLabel(new GuiNpcLabel(204, "ability.outerAlpha", labelX, y + 5));
GuiNpcTextField alphaField = createFloatField(204, fieldX, y, 55, disc.getOuterColorAlpha());
alphaField.setEnabled(disc.isOuterColorEnabled());
alphaField.setMinMaxDefaultFloat(0, 1, 0.5f);
addTextField(alphaField);
y += 24;
// Row 4: Rotation Speed
addLabel(new GuiNpcLabel(205, "ability.rotationSpeed", labelX, y + 5));
addTextField(createFloatField(205, fieldX, y, 50, disc.getRotationSpeed()));
y += 24;
// Row 5: Lightning Effect Enabled
addLabel(new GuiNpcLabel(206, "ability.lightning", labelX, y + 5));
GuiNpcButton lightningBtn = new GuiNpcButton(206, fieldX, y, 50, 20, new String[]{"gui.no", "gui.yes"}, disc.hasLightningEffect() ? 1 : 0);
lightningBtn.setHoverText("ability.hover.lightning");
addButton(lightningBtn);
// Only show Lightning settings if Lightning is enabled
if (disc.hasLightningEffect()) {
y += 24;
// Row 6: Density + Radius
addLabel(new GuiNpcLabel(207, "ability.lightningDensity", labelX, y + 5));
GuiNpcTextField densityField = new GuiNpcTextField(207, this, fontRendererObj, fieldX, y, 55, 18, String.valueOf(disc.getLightningDensity()));
densityField.setMinMaxDefaultFloat(0.01f, 5.0f, 0.15f);
addTextField(densityField);
addLabel(new GuiNpcLabel(208, "ability.lightningRadius", col2LabelX, y + 5));
GuiNpcTextField radiusField = new GuiNpcTextField(208, this, fontRendererObj, col2FieldX, y, 55, 18, String.valueOf(disc.getLightningRadius()));
radiusField.setMinMaxDefaultFloat(0.1f, 10.0f, 0.5f);
addTextField(radiusField);
}
}
@Override
protected void handleTypeButton(int id, GuiNpcButton button) {
int value = button.getValue();
switch (id) {
case 104:
disc.setHoming(value == 1);
initGui();
break;
case 106:
disc.setBoomerang(value == 1);
initGui();
break;
case 108:
disc.setExplosive(value == 1);
initGui();
break;
case 150:
setSubGui(new SubGuiAbilityEffects(disc.getEffects()));
break;
}
}
@Override
protected void handleVisualButton(int id, GuiNpcButton button) {
int value = button.getValue();
switch (id) {
case 200:
editingVisualColorId = 200;
setSubGui(new SubGuiColorSelector(disc.getInnerColor()));
break;
case 201:
editingVisualColorId = 201;
setSubGui(new SubGuiColorSelector(disc.getOuterColor()));
break;
case 202:
disc.setOuterColorEnabled(value == 1);
initGui();
break;
case 206:
disc.setLightningEffect(value == 1);
initGui();
break;
case 210:
disc.setAnchorPointEnum(AnchorPoint.fromId(value));
break;
}
}
@Override
public void subGuiClosed(SubGuiInterface subgui) {
if (subgui instanceof SubGuiColorSelector && editingVisualColorId != 0) {
SubGuiColorSelector colorSelector = (SubGuiColorSelector) subgui;
int rgb = colorSelector.color & 0x00FFFFFF;
if (editingVisualColorId == 200) {
disc.setInnerColor(rgb);
} else if (editingVisualColorId == 201) {
disc.setOuterColor(rgb);
}
editingVisualColorId = 0;
initGui();
} else if (subgui instanceof SubGuiAbilityEffects) {
SubGuiAbilityEffects effectsGui = (SubGuiAbilityEffects) subgui;
List<AbilityEffect> result = effectsGui.getResult();
if (result != null) {
disc.setEffects(result);
}
} else {
super.subGuiClosed(subgui);
}
}
@Override
protected void handleTypeTextField(int id, GuiNpcTextField field) {
switch (id) {
case 100:
disc.setDamage(parseFloat(field, disc.getDamage()));
break;
case 101:
disc.setSpeed(parseFloat(field, disc.getSpeed()));
break;
case 102:
disc.setDiscRadius(parseFloat(field, disc.getDiscRadius()));
break;
case 103:
disc.setDiscThickness(parseFloat(field, disc.getDiscThickness()));
break;
case 105:
disc.setHomingStrength(parseFloat(field, disc.getHomingStrength()));
break;
case 107:
disc.setBoomerangDelay(field.getInteger());
break;
case 109:
disc.setExplosionRadius(parseFloat(field, disc.getExplosionRadius()));
break;
case 110:
disc.setKnockback(parseFloat(field, disc.getKnockback()));
break;
case 111:
disc.setMaxDistance(parseFloat(field, disc.getMaxDistance()));
break;
case 112:
disc.setMaxLifetime(field.getInteger());
break;
}
}
@Override
protected void handleVisualTextField(int id, GuiNpcTextField field) {
switch (id) {
case 203:
disc.setOuterColorWidth(parseFloat(field, disc.getOuterColorWidth()));
break;
case 204:
disc.setOuterColorAlpha(parseFloat(field, disc.getOuterColorAlpha()));
break;
case 205:
disc.setRotationSpeed(parseFloat(field, disc.getRotationSpeed()));
break;
case 207:
disc.setLightningDensity(parseFloat(field, disc.getLightningDensity()));
break;
case 208:
disc.setLightningRadius(parseFloat(field, disc.getLightningRadius()));
break;
}
}
}
@@ -1,312 +0,0 @@
package noppes.npcs.client.gui.advanced.ability;
import kamkeel.npcs.controllers.data.ability.AbilityEffect;
import kamkeel.npcs.controllers.data.ability.AnchorPoint;
import kamkeel.npcs.controllers.data.ability.type.AbilityEnergyBeam;
import noppes.npcs.client.gui.SubGuiColorSelector;
import noppes.npcs.client.gui.advanced.SubGuiAbilityConfig;
import noppes.npcs.client.gui.util.GuiNpcButton;
import noppes.npcs.client.gui.util.GuiNpcLabel;
import noppes.npcs.client.gui.util.GuiNpcTextField;
import noppes.npcs.client.gui.util.IAbilityConfigCallback;
import noppes.npcs.client.gui.util.SubGuiInterface;
import java.util.List;
/**
* GUI for configuring Energy Beam ability type-specific settings.
* Energy Beam is a homing head with trailing path (DBZ-style).
*/
public class SubGuiAbilityEnergyBeam extends SubGuiAbilityConfig {
private final AbilityEnergyBeam beam;
private int editingVisualColorId = 0;
public SubGuiAbilityEnergyBeam(AbilityEnergyBeam ability, IAbilityConfigCallback callback) {
super(ability, callback);
this.beam = ability;
}
@Override
protected boolean hasVisualSettings() {
return true;
}
@Override
protected void initTypeTab(int startY) {
int y = startY;
int labelX = guiLeft + 8;
int fieldX = guiLeft + 85;
int col2LabelX = guiLeft + 145;
int col2FieldX = guiLeft + 205;
// Row 1: Damage + Speed
addLabel(new GuiNpcLabel(100, "enchantment.damage", labelX, y + 5));
addTextField(createFloatField(100, fieldX, y, 50, beam.getDamage()));
addLabel(new GuiNpcLabel(101, "stats.speed", col2LabelX, y + 5));
addTextField(createFloatField(101, col2FieldX, y, 50, beam.getSpeed()));
y += 24;
// Row 2: Beam Width + Head Size
addLabel(new GuiNpcLabel(102, "ability.beamWidth", labelX, y + 5));
addTextField(createFloatField(102, fieldX, y, 50, beam.getBeamWidth()));
addLabel(new GuiNpcLabel(103, "ability.headSize", col2LabelX, y + 5));
addTextField(createFloatField(103, col2FieldX, y, 50, beam.getHeadSize()));
y += 24;
// Row 3: Homing + Homing Strength (only show strength if homing)
addLabel(new GuiNpcLabel(104, "ability.homing", labelX, y + 5));
GuiNpcButton homingBtn = new GuiNpcButton(104, fieldX, y, 50, 20, new String[]{"gui.no", "gui.yes"}, beam.isHoming() ? 1 : 0);
homingBtn.setHoverText("ability.hover.homing");
addButton(homingBtn);
if (beam.isHoming()) {
addLabel(new GuiNpcLabel(105, "ability.homingStr", col2LabelX, y + 5));
addTextField(createFloatField(105, col2FieldX, y, 50, beam.getHomingStrength()));
}
y += 24;
// Row 4: Max Distance (+ Homing Range only if homing)
if (beam.isHoming()) {
addLabel(new GuiNpcLabel(106, "ability.homingRange", labelX, y + 5));
addTextField(createFloatField(106, fieldX, y, 50, beam.getHomingRange()));
}
addLabel(new GuiNpcLabel(107, "ability.maxDist", beam.isHoming() ? col2LabelX : labelX, y + 5));
addTextField(createFloatField(107, beam.isHoming() ? col2FieldX : fieldX, y, 50, beam.getMaxDistance()));
y += 24;
// Row 5: Explosive + Explosion Radius (only show radius if explosive)
addLabel(new GuiNpcLabel(108, "ability.explosive", labelX, y + 5));
GuiNpcButton explosiveBtn = new GuiNpcButton(108, fieldX, y, 50, 20, new String[]{"gui.no", "gui.yes"}, beam.isExplosive() ? 1 : 0);
explosiveBtn.setHoverText("ability.hover.explosive");
addButton(explosiveBtn);
if (beam.isExplosive()) {
addLabel(new GuiNpcLabel(109, "ability.explosionRad", col2LabelX, y + 5));
addTextField(createFloatField(109, col2FieldX, y, 50, beam.getExplosionRadius()));
}
y += 24;
// Row 6: Knockback + Max Lifetime
addLabel(new GuiNpcLabel(110, "ability.knockback", labelX, y + 5));
addTextField(createFloatField(110, fieldX, y, 50, beam.getKnockback()));
addLabel(new GuiNpcLabel(111, "ability.lifetime", col2LabelX, y + 5));
addTextField(createIntField(111, col2FieldX, y, 50, beam.getMaxLifetime()));
y += 24;
// Row 7: Effects button
addButton(new GuiNpcButton(150, labelX, y, 80, 20, "ability.effects"));
}
@Override
protected void initVisualTab(int startY) {
int y = startY;
int labelX = guiLeft + 8;
int fieldX = guiLeft + 85;
int col2LabelX = guiLeft + 180;
int col2FieldX = guiLeft + 260;
// Row 1: Anchor Point
addLabel(new GuiNpcLabel(210, "ability.anchorPoint", labelX, y + 5));
GuiNpcButton anchorBtn = new GuiNpcButton(210, fieldX, y, 80, 20, AnchorPoint.getDisplayNames(), beam.getAnchorPointEnum().getId());
anchorBtn.setHoverText("ability.hover.anchorPoint");
addButton(anchorBtn);
y += 24;
// Row 2: Inner Color + Outer Color
addLabel(new GuiNpcLabel(200, "ability.innerColor", labelX, y + 5));
String innerHex = String.format("%06X", beam.getInnerColor() & 0xFFFFFF);
GuiNpcButton innerColorBtn = new GuiNpcButton(200, fieldX, y, 55, 20, innerHex);
innerColorBtn.setTextColor(beam.getInnerColor() & 0xFFFFFF);
addButton(innerColorBtn);
addLabel(new GuiNpcLabel(201, "ability.outerColor", col2LabelX, y + 5));
String outerHex = String.format("%06X", beam.getOuterColor() & 0xFFFFFF);
GuiNpcButton outerColorBtn = new GuiNpcButton(201, col2FieldX, y, 55, 20, outerHex);
outerColorBtn.setTextColor(beam.getOuterColor() & 0xFFFFFF);
outerColorBtn.setEnabled(beam.isOuterColorEnabled());
addButton(outerColorBtn);
y += 24;
// Row 2: Outer Color Enabled + Outer Color Width
addLabel(new GuiNpcLabel(202, "ability.outerEnabled", labelX, y + 5));
addButton(new GuiNpcButton(202, fieldX, y, 50, 20, new String[]{"gui.no", "gui.yes"}, beam.isOuterColorEnabled() ? 1 : 0));
addLabel(new GuiNpcLabel(203, "ability.outerWidth", col2LabelX, y + 5));
GuiNpcTextField widthField = createFloatField(203, col2FieldX, y, 55, beam.getOuterColorWidth());
widthField.setEnabled(beam.isOuterColorEnabled());
addTextField(widthField);
y += 24;
// Row 3: Rotation Speed
addLabel(new GuiNpcLabel(204, "ability.outerAlpha", labelX, y + 5));
GuiNpcTextField alphaField = createFloatField(204, fieldX, y, 55, beam.getOuterColorAlpha());
alphaField.setEnabled(beam.isOuterColorEnabled());
alphaField.setMinMaxDefaultFloat(0, 1, 0.5f);
addTextField(alphaField);
addLabel(new GuiNpcLabel(205, "ability.rotationSpeed", col2LabelX, y + 5));
addTextField(createFloatField(205, col2FieldX, y, 50, beam.getRotationSpeed()));
y += 24;
// Row 4: Lightning Effect Enabled (only affects head)
addLabel(new GuiNpcLabel(206, "ability.lightning", labelX, y + 5));
GuiNpcButton lightningBtn = new GuiNpcButton(206, fieldX, y, 50, 20, new String[]{"gui.no", "gui.yes"}, beam.hasLightningEffect() ? 1 : 0);
lightningBtn.setHoverText("ability.hover.lightning");
addButton(lightningBtn);
// Only show Lightning settings if Lightning is enabled
if (beam.hasLightningEffect()) {
y += 24;
// Row 5: Density + Radius
addLabel(new GuiNpcLabel(207, "ability.lightningDensity", labelX, y + 5));
GuiNpcTextField densityField = new GuiNpcTextField(207, this, fontRendererObj, fieldX, y, 55, 18, String.valueOf(beam.getLightningDensity()));
densityField.setMinMaxDefaultFloat(0.01f, 5.0f, 0.15f);
addTextField(densityField);
addLabel(new GuiNpcLabel(208, "ability.lightningRadius", col2LabelX, y + 5));
GuiNpcTextField radiusField = new GuiNpcTextField(208, this, fontRendererObj, col2FieldX, y, 55, 18, String.valueOf(beam.getLightningRadius()));
radiusField.setMinMaxDefaultFloat(0.1f, 10.0f, 0.5f);
addTextField(radiusField);
}
}
@Override
protected void handleTypeButton(int id, GuiNpcButton button) {
int value = button.getValue();
switch (id) {
case 104:
beam.setHoming(value == 1);
initGui();
break;
case 108:
beam.setExplosive(value == 1);
initGui();
break;
case 150:
setSubGui(new SubGuiAbilityEffects(beam.getEffects()));
break;
}
}
@Override
protected void handleVisualButton(int id, GuiNpcButton button) {
int value = button.getValue();
switch (id) {
case 200:
editingVisualColorId = 200;
setSubGui(new SubGuiColorSelector(beam.getInnerColor()));
break;
case 201:
editingVisualColorId = 201;
setSubGui(new SubGuiColorSelector(beam.getOuterColor()));
break;
case 202:
beam.setOuterColorEnabled(value == 1);
initGui();
break;
case 206:
beam.setLightningEffect(value == 1);
initGui();
break;
case 210:
beam.setAnchorPointEnum(AnchorPoint.fromId(value));
break;
}
}
@Override
public void subGuiClosed(SubGuiInterface subgui) {
if (subgui instanceof SubGuiColorSelector && editingVisualColorId != 0) {
SubGuiColorSelector colorSelector = (SubGuiColorSelector) subgui;
int rgb = colorSelector.color & 0x00FFFFFF;
if (editingVisualColorId == 200) {
beam.setInnerColor(rgb);
} else if (editingVisualColorId == 201) {
beam.setOuterColor(rgb);
}
editingVisualColorId = 0;
initGui();
} else if (subgui instanceof SubGuiAbilityEffects) {
SubGuiAbilityEffects effectsGui = (SubGuiAbilityEffects) subgui;
List<AbilityEffect> result = effectsGui.getResult();
if (result != null) {
beam.setEffects(result);
}
} else {
super.subGuiClosed(subgui);
}
}
@Override
protected void handleTypeTextField(int id, GuiNpcTextField field) {
switch (id) {
case 100:
beam.setDamage(parseFloat(field, beam.getDamage()));
break;
case 101:
beam.setSpeed(parseFloat(field, beam.getSpeed()));
break;
case 102:
beam.setBeamWidth(parseFloat(field, beam.getBeamWidth()));
break;
case 103:
beam.setHeadSize(parseFloat(field, beam.getHeadSize()));
break;
case 105:
beam.setHomingStrength(parseFloat(field, beam.getHomingStrength()));
break;
case 106:
beam.setHomingRange(parseFloat(field, beam.getHomingRange()));
break;
case 107:
beam.setMaxDistance(parseFloat(field, beam.getMaxDistance()));
break;
case 109:
beam.setExplosionRadius(parseFloat(field, beam.getExplosionRadius()));
break;
case 110:
beam.setKnockback(parseFloat(field, beam.getKnockback()));
break;
case 111:
beam.setMaxLifetime(field.getInteger());
break;
}
}
@Override
protected void handleVisualTextField(int id, GuiNpcTextField field) {
switch (id) {
case 203:
beam.setOuterColorWidth(parseFloat(field, beam.getOuterColorWidth()));
break;
case 204:
beam.setOuterColorAlpha(parseFloat(field, beam.getOuterColorAlpha()));
break;
case 205:
beam.setRotationSpeed(parseFloat(field, beam.getRotationSpeed()));
break;
case 207:
beam.setLightningDensity(parseFloat(field, beam.getLightningDensity()));
break;
case 208:
beam.setLightningRadius(parseFloat(field, beam.getLightningRadius()));
break;
}
}
}
@@ -1,143 +0,0 @@
package noppes.npcs.client.gui.advanced.ability;
import kamkeel.npcs.controllers.data.ability.AbilityEffect;
import kamkeel.npcs.controllers.data.ability.type.AbilityGuard;
import noppes.npcs.client.gui.advanced.SubGuiAbilityConfig;
import noppes.npcs.client.gui.util.GuiNpcButton;
import noppes.npcs.client.gui.util.GuiNpcLabel;
import noppes.npcs.client.gui.util.GuiNpcTextField;
import noppes.npcs.client.gui.util.IAbilityConfigCallback;
import noppes.npcs.client.gui.util.SubGuiInterface;
import java.util.List;
/**
* GUI for configuring Guard ability type-specific settings.
*/
public class SubGuiAbilityGuard extends SubGuiAbilityConfig {
private final AbilityGuard guard;
public SubGuiAbilityGuard(AbilityGuard ability, IAbilityConfigCallback callback) {
super(ability, callback);
this.guard = ability;
}
@Override
protected void initTypeTab(int startY) {
int y = startY;
int labelX = guiLeft + 8;
int fieldX = guiLeft + 105;
int col2LabelX = guiLeft + 165;
int col2FieldX = guiLeft + 225;
// Row 1: Duration + Damage Reduction
addLabel(new GuiNpcLabel(99, "ability.duration", labelX, y + 5));
GuiNpcTextField durationField = createIntField(99, fieldX, y, 50, guard.getDurationTicks());
durationField.setMinMaxDefault(1, 1000, 60);
addTextField(durationField);
addLabel(new GuiNpcLabel(100, "ability.dmgReduce", col2LabelX, y + 5));
addTextField(createFloatField(100, col2FieldX, y, 50, guard.getDamageReduction()));
y += 24;
// Row 2: Can Counter + Counter Type
addLabel(new GuiNpcLabel(101, "ability.canCounter", labelX, y + 5));
GuiNpcButton canCounterBtn = new GuiNpcButton(101, fieldX, y, 50, 20, new String[]{"gui.no", "gui.yes"}, guard.isCanCounter() ? 1 : 0);
canCounterBtn.setHoverText("ability.hover.canCounter");
addButton(canCounterBtn);
addLabel(new GuiNpcLabel(102, "ability.counterType", col2LabelX, y + 5));
String[] types = {"Flat", "Percent"};
GuiNpcButton counterTypeButton = new GuiNpcButton(102, col2FieldX, y, 60, 20, types, guard.getCounterTypeEnum().ordinal());
counterTypeButton.setHoverText("ability.hover.counterType");
counterTypeButton.setEnabled(guard.isCanCounter());
addButton(counterTypeButton);
y += 24;
// Row 3: Counter Value + Counter Chance
addLabel(new GuiNpcLabel(103, "ability.counterValue", labelX, y + 5));
GuiNpcTextField counterValueField = createFloatField(103, fieldX, y, 50, guard.getCounterValue());
counterValueField.setEnabled(guard.isCanCounter());
addTextField(counterValueField);
addLabel(new GuiNpcLabel(104, "ability.counterChance", col2LabelX, y + 5));
GuiNpcTextField counterChanceField = createFloatField(104, col2FieldX, y, 50, guard.getCounterChance());
counterChanceField.setEnabled(guard.isCanCounter());
addTextField(counterChanceField);
y += 24;
// Row 4: Counter Sound + Counter Animation
addLabel(new GuiNpcLabel(105, "ability.counterSound", labelX, y + 5));
GuiNpcTextField counterSoundField = new GuiNpcTextField(105, this, fontRendererObj, fieldX, y, 100, 20, guard.getCounterSound());
counterSoundField.setEnabled(guard.isCanCounter());
addTextField(counterSoundField);
addLabel(new GuiNpcLabel(106, "ability.counterAnim", col2LabelX, y + 5));
GuiNpcTextField counterAnimField = createIntField(106, col2FieldX, y, 50, guard.getCounterAnimationId());
counterAnimField.setEnabled(guard.isCanCounter());
addTextField(counterAnimField);
y += 24;
// Row 5: Effects button (applies on counter)
GuiNpcButton effectsBtn = new GuiNpcButton(150, labelX, y, 80, 20, "ability.effects");
effectsBtn.setEnabled(guard.isCanCounter());
addButton(effectsBtn);
}
@Override
protected void handleTypeButton(int id, GuiNpcButton button) {
switch (id) {
case 101:
guard.setCanCounter(button.getValue() == 1);
initGui();
break;
case 102:
guard.setCounterTypeEnum(AbilityGuard.CounterType.values()[button.getValue()]);
break;
case 150:
setSubGui(new SubGuiAbilityEffects(guard.getEffects()));
break;
}
}
@Override
public void subGuiClosed(SubGuiInterface subgui) {
super.subGuiClosed(subgui);
if (subgui instanceof SubGuiAbilityEffects) {
SubGuiAbilityEffects effectsGui = (SubGuiAbilityEffects) subgui;
List<AbilityEffect> result = effectsGui.getResult();
if (result != null) {
guard.setEffects(result);
}
}
}
@Override
protected void handleTypeTextField(int id, GuiNpcTextField field) {
switch (id) {
case 99:
guard.setDurationTicks(field.getInteger());
break;
case 100:
guard.setDamageReduction(parseFloat(field, guard.getDamageReduction()));
break;
case 103:
guard.setCounterValue(parseFloat(field, guard.getCounterValue()));
break;
case 104:
guard.setCounterChance(parseFloat(field, guard.getCounterChance()));
break;
case 105:
guard.setCounterSound(field.getText());
break;
case 106:
guard.setCounterAnimationId(field.getInteger());
break;
}
}
}
@@ -1,159 +0,0 @@
package noppes.npcs.client.gui.advanced.ability;
import kamkeel.npcs.controllers.data.ability.AbilityEffect;
import kamkeel.npcs.controllers.data.ability.type.AbilityHazard;
import noppes.npcs.client.gui.advanced.SubGuiAbilityConfig;
import noppes.npcs.client.gui.util.GuiNpcButton;
import noppes.npcs.client.gui.util.GuiNpcLabel;
import noppes.npcs.client.gui.util.GuiNpcTextField;
import noppes.npcs.client.gui.util.IAbilityConfigCallback;
import noppes.npcs.client.gui.util.SubGuiInterface;
import java.util.List;
/**
* GUI for configuring Hazard ability type-specific settings.
*/
public class SubGuiAbilityHazard extends SubGuiAbilityConfig {
private final AbilityHazard hazard;
public SubGuiAbilityHazard(AbilityHazard ability, IAbilityConfigCallback callback) {
super(ability, callback);
this.hazard = ability;
}
@Override
protected void initTypeTab(int startY) {
int y = startY;
int labelX = guiLeft + 8;
int fieldX = guiLeft + 85;
int col2LabelX = guiLeft + 145;
int col2FieldX = guiLeft + 205;
// Row 1: Duration + Shape
addLabel(new GuiNpcLabel(99, "ability.duration", labelX, y + 5));
GuiNpcTextField durationField = createIntField(99, fieldX, y, 50, hazard.getDurationTicks());
durationField.setMinMaxDefault(1, 2000, 100);
addTextField(durationField);
addLabel(new GuiNpcLabel(100, "ability.shape", col2LabelX, y + 5));
String[] shapes = {"Circle", "Ring", "Cone"};
GuiNpcButton shapeBtn = new GuiNpcButton(100, col2FieldX, y, 55, 20, shapes, hazard.getShapeEnum().ordinal());
shapeBtn.setHoverText("ability.hover.shape");
addButton(shapeBtn);
y += 24;
// Row 2: Placement
addLabel(new GuiNpcLabel(101, "ability.placement", labelX, y + 5));
String[] placements = {"Caster", "Target", "FollowCast", "FollowTgt"};
GuiNpcButton placementBtn = new GuiNpcButton(101, fieldX, y, 70, 20, placements, hazard.getPlacementEnum().ordinal());
placementBtn.setHoverText("ability.hover.placement");
addButton(placementBtn);
y += 24;
// Row 2: Radius + Inner Radius
addLabel(new GuiNpcLabel(102, "ability.radius", labelX, y + 5));
addTextField(createFloatField(102, fieldX, y, 50, hazard.getRadius()));
addLabel(new GuiNpcLabel(103, "ability.innerRadius", col2LabelX, y + 5));
addTextField(createFloatField(103, col2FieldX, y, 50, hazard.getInnerRadius()));
y += 24;
// Row 3: Damage Per Second + Damage Interval
addLabel(new GuiNpcLabel(104, "ability.dmgPerSec", labelX, y + 5));
addTextField(createFloatField(104, fieldX, y, 50, hazard.getDamagePerSecond()));
addLabel(new GuiNpcLabel(105, "ability.dmgInterval", col2LabelX, y + 5));
addTextField(createIntField(105, col2FieldX, y, 50, hazard.getDamageInterval()));
y += 24;
// Row 4: Slowness Level + Debuff Duration
addLabel(new GuiNpcLabel(106, "ability.slownessLvl", labelX, y + 5));
addTextField(createIntField(106, fieldX, y, 50, hazard.getSlownessLevel()));
addLabel(new GuiNpcLabel(107, "ability.debuffDur", col2LabelX, y + 5));
addTextField(createIntField(107, col2FieldX, y, 50, hazard.getDebuffDuration()));
y += 24;
// Row 5: Poison Level + Affects Caster
addLabel(new GuiNpcLabel(108, "ability.poisonLvl", labelX, y + 5));
addTextField(createIntField(108, fieldX, y, 50, hazard.getPoisonLevel()));
addLabel(new GuiNpcLabel(109, "ability.affectsCaster", col2LabelX, y + 5));
GuiNpcButton affectsCasterBtn = new GuiNpcButton(109, col2FieldX, y, 50, 20, new String[]{"gui.no", "gui.yes"}, hazard.isAffectsCaster() ? 1 : 0);
affectsCasterBtn.setHoverText("ability.hover.affectsCaster");
addButton(affectsCasterBtn);
y += 24;
// Row 6: Effects button
addButton(new GuiNpcButton(150, labelX, y, 80, 20, "ability.effects"));
}
@Override
protected void handleTypeButton(int id, GuiNpcButton button) {
int value = button.getValue();
switch (id) {
case 100:
hazard.setShapeEnum(AbilityHazard.HazardShape.values()[value]);
break;
case 101:
hazard.setPlacementEnum(AbilityHazard.PlacementMode.values()[value]);
break;
case 109:
hazard.setAffectsCaster(value == 1);
break;
case 150:
setSubGui(new SubGuiAbilityEffects(hazard.getEffects()));
break;
}
}
@Override
public void subGuiClosed(SubGuiInterface subgui) {
super.subGuiClosed(subgui);
if (subgui instanceof SubGuiAbilityEffects) {
SubGuiAbilityEffects effectsGui = (SubGuiAbilityEffects) subgui;
List<AbilityEffect> result = effectsGui.getResult();
if (result != null) {
hazard.setEffects(result);
}
}
}
@Override
protected void handleTypeTextField(int id, GuiNpcTextField field) {
switch (id) {
case 99:
hazard.setDurationTicks(field.getInteger());
break;
case 102:
hazard.setRadius(parseFloat(field, hazard.getRadius()));
break;
case 103:
hazard.setInnerRadius(parseFloat(field, hazard.getInnerRadius()));
break;
case 104:
hazard.setDamagePerSecond(parseFloat(field, hazard.getDamagePerSecond()));
break;
case 105:
hazard.setDamageInterval(field.getInteger());
break;
case 106:
hazard.setSlownessLevel(field.getInteger());
break;
case 107:
hazard.setDebuffDuration(field.getInteger());
break;
case 108:
hazard.setPoisonLevel(field.getInteger());
break;
}
}
}
@@ -1,106 +0,0 @@
package noppes.npcs.client.gui.advanced.ability;
import kamkeel.npcs.controllers.data.ability.type.AbilityHeal;
import noppes.npcs.client.gui.advanced.SubGuiAbilityConfig;
import noppes.npcs.client.gui.util.GuiNpcButton;
import noppes.npcs.client.gui.util.GuiNpcLabel;
import noppes.npcs.client.gui.util.GuiNpcTextField;
import noppes.npcs.client.gui.util.IAbilityConfigCallback;
/**
* GUI for configuring Heal ability type-specific settings.
*/
public class SubGuiAbilityHeal extends SubGuiAbilityConfig {
private final AbilityHeal heal;
public SubGuiAbilityHeal(AbilityHeal ability, IAbilityConfigCallback callback) {
super(ability, callback);
this.heal = ability;
}
@Override
protected void initTypeTab(int startY) {
int y = startY;
int labelX = guiLeft + 8;
int fieldX = guiLeft + 85;
int col2LabelX = guiLeft + 145;
int col2FieldX = guiLeft + 205;
// Row 1: Instant Heal + Duration (only shown if not instant)
addLabel(new GuiNpcLabel(103, "dialog.instant", labelX, y + 5));
GuiNpcButton instantBtn = new GuiNpcButton(103, fieldX, y, 50, 20, new String[]{"gui.no", "gui.yes"}, heal.isInstantHeal() ? 1 : 0);
instantBtn.setHoverText("ability.hover.instant");
addButton(instantBtn);
if (!heal.isInstantHeal()) {
addLabel(new GuiNpcLabel(99, "ability.duration", col2LabelX, y + 5));
GuiNpcTextField durationField = createIntField(99, col2FieldX, y, 50, heal.getDurationTicks());
durationField.setMinMaxDefault(1, 1000, 60);
addTextField(durationField);
}
y += 24;
// Row 2: Heal Amount + Heal Percent
addLabel(new GuiNpcLabel(100, "ability.healAmount", labelX, y + 5));
addTextField(createFloatField(100, fieldX, y, 50, heal.getHealAmount()));
addLabel(new GuiNpcLabel(101, "ability.healPercent", col2LabelX, y + 5));
addTextField(createFloatField(101, col2FieldX, y, 50, heal.getHealPercent()));
y += 24;
// Row 3: Heal Radius
addLabel(new GuiNpcLabel(102, "ability.healRadius", labelX, y + 5));
addTextField(createFloatField(102, fieldX, y, 50, heal.getHealRadius()));
y += 24;
// Row 4: Heal Self + Heal Allies
addLabel(new GuiNpcLabel(104, "ability.healSelf", labelX, y + 5));
GuiNpcButton healSelfBtn = new GuiNpcButton(104, fieldX, y, 50, 20, new String[]{"gui.no", "gui.yes"}, heal.isHealSelf() ? 1 : 0);
healSelfBtn.setHoverText("ability.hover.healSelf");
addButton(healSelfBtn);
addLabel(new GuiNpcLabel(105, "ability.healAllies", col2LabelX, y + 5));
GuiNpcButton healAlliesBtn = new GuiNpcButton(105, col2FieldX, y, 50, 20, new String[]{"gui.no", "gui.yes"}, heal.isHealAllies() ? 1 : 0);
healAlliesBtn.setHoverText("ability.hover.healAllies");
addButton(healAlliesBtn);
}
@Override
protected void handleTypeButton(int id, GuiNpcButton button) {
int value = button.getValue();
switch (id) {
case 103:
heal.setInstantHeal(value == 1);
initGui(); // Refresh to show/hide duration field
break;
case 104:
heal.setHealSelf(value == 1);
break;
case 105:
heal.setHealAllies(value == 1);
break;
}
}
@Override
protected void handleTypeTextField(int id, GuiNpcTextField field) {
switch (id) {
case 99:
heal.setDurationTicks(field.getInteger());
break;
case 100:
heal.setHealAmount(parseFloat(field, heal.getHealAmount()));
break;
case 101:
heal.setHealPercent(parseFloat(field, heal.getHealPercent()));
break;
case 102:
heal.setHealRadius(parseFloat(field, heal.getHealRadius()));
break;
}
}
}
@@ -1,76 +0,0 @@
package noppes.npcs.client.gui.advanced.ability;
import kamkeel.npcs.controllers.data.ability.AbilityEffect;
import kamkeel.npcs.controllers.data.ability.type.AbilityHeavyHit;
import noppes.npcs.client.gui.advanced.SubGuiAbilityConfig;
import noppes.npcs.client.gui.util.GuiNpcButton;
import noppes.npcs.client.gui.util.GuiNpcLabel;
import noppes.npcs.client.gui.util.GuiNpcTextField;
import noppes.npcs.client.gui.util.IAbilityConfigCallback;
import noppes.npcs.client.gui.util.SubGuiInterface;
import java.util.List;
/**
* GUI for configuring Heavy Hit ability type-specific settings.
*/
public class SubGuiAbilityHeavyHit extends SubGuiAbilityConfig {
private final AbilityHeavyHit heavyHit;
public SubGuiAbilityHeavyHit(AbilityHeavyHit ability, IAbilityConfigCallback callback) {
super(ability, callback);
this.heavyHit = ability;
}
@Override
protected void initTypeTab(int startY) {
int y = startY;
int labelX = guiLeft + 8;
int fieldX = guiLeft + 85;
int col2LabelX = guiLeft + 145;
// Row 1: Damage + Knockback
addLabel(new GuiNpcLabel(100, "enchantment.damage", labelX, y + 5));
addTextField(createFloatField(100, fieldX, y, 50, heavyHit.getDamage()));
addLabel(new GuiNpcLabel(102, "ability.knockback", col2LabelX, y + 5));
addTextField(createFloatField(102, guiLeft + 205, y, 50, heavyHit.getKnockback()));
y += 24;
// Row 2: Effects button
addButton(new GuiNpcButton(150, labelX, y, 80, 20, "ability.effects"));
}
@Override
protected void handleTypeButton(int id, GuiNpcButton button) {
if (id == 150) {
setSubGui(new SubGuiAbilityEffects(heavyHit.getEffects()));
}
}
@Override
public void subGuiClosed(SubGuiInterface subgui) {
super.subGuiClosed(subgui);
if (subgui instanceof SubGuiAbilityEffects) {
SubGuiAbilityEffects effectsGui = (SubGuiAbilityEffects) subgui;
List<AbilityEffect> result = effectsGui.getResult();
if (result != null) {
heavyHit.setEffects(result);
}
}
}
@Override
protected void handleTypeTextField(int id, GuiNpcTextField field) {
switch (id) {
case 100:
heavyHit.setDamage(parseFloat(field, heavyHit.getDamage()));
break;
case 102:
heavyHit.setKnockback(parseFloat(field, heavyHit.getKnockback()));
break;
}
}
}
@@ -1,268 +0,0 @@
package noppes.npcs.client.gui.advanced.ability;
import kamkeel.npcs.controllers.data.ability.AbilityEffect;
import kamkeel.npcs.controllers.data.ability.type.AbilityLaserShot;
import noppes.npcs.client.gui.SubGuiColorSelector;
import noppes.npcs.client.gui.advanced.SubGuiAbilityConfig;
import noppes.npcs.client.gui.util.GuiNpcButton;
import noppes.npcs.client.gui.util.GuiNpcLabel;
import noppes.npcs.client.gui.util.GuiNpcTextField;
import noppes.npcs.client.gui.util.IAbilityConfigCallback;
import noppes.npcs.client.gui.util.SubGuiInterface;
import java.util.List;
/**
* GUI for configuring Laser Shot ability type-specific settings.
*/
public class SubGuiAbilityLaserShot extends SubGuiAbilityConfig {
private final AbilityLaserShot laser;
private int editingVisualColorId = 0;
public SubGuiAbilityLaserShot(AbilityLaserShot ability, IAbilityConfigCallback callback) {
super(ability, callback);
this.laser = ability;
}
@Override
protected boolean hasVisualSettings() {
return true;
}
@Override
protected void initTypeTab(int startY) {
int y = startY;
int labelX = guiLeft + 8;
int fieldX = guiLeft + 85;
int col2LabelX = guiLeft + 145;
int col2FieldX = guiLeft + 205;
// Row 1: Damage + Laser Width
addLabel(new GuiNpcLabel(100, "enchantment.damage", labelX, y + 5));
addTextField(createFloatField(100, fieldX, y, 50, laser.getDamage()));
addLabel(new GuiNpcLabel(101, "ability.laserWidth", col2LabelX, y + 5));
addTextField(createFloatField(101, col2FieldX, y, 50, laser.getLaserWidth()));
y += 24;
// Row 2: Expansion Speed + Linger Ticks
addLabel(new GuiNpcLabel(102, "ability.expansionSpeed", labelX, y + 5));
addTextField(createFloatField(102, fieldX, y, 50, laser.getExpansionSpeed()));
addLabel(new GuiNpcLabel(103, "ability.lingerTicks", col2LabelX, y + 5));
addTextField(createIntField(103, col2FieldX, y, 50, laser.getLingerTicks()));
y += 24;
// Row 3: Max Distance + Max Lifetime
addLabel(new GuiNpcLabel(104, "ability.maxDist", labelX, y + 5));
addTextField(createFloatField(104, fieldX, y, 50, laser.getMaxDistance()));
addLabel(new GuiNpcLabel(105, "ability.lifetime", col2LabelX, y + 5));
addTextField(createIntField(105, col2FieldX, y, 50, laser.getMaxLifetime()));
y += 24;
// Row 4: Explosive + Explosion Radius (only show radius if explosive)
addLabel(new GuiNpcLabel(106, "ability.explosive", labelX, y + 5));
GuiNpcButton explosiveBtn = new GuiNpcButton(106, fieldX, y, 50, 20, new String[]{"gui.no", "gui.yes"}, laser.isExplosive() ? 1 : 0);
explosiveBtn.setHoverText("ability.hover.explosive");
addButton(explosiveBtn);
if (laser.isExplosive()) {
addLabel(new GuiNpcLabel(107, "ability.explosionRad", col2LabelX, y + 5));
addTextField(createFloatField(107, col2FieldX, y, 50, laser.getExplosionRadius()));
}
y += 24;
// Row 5: Knockback + Knockback Up
addLabel(new GuiNpcLabel(108, "ability.knockback", labelX, y + 5));
addTextField(createFloatField(108, fieldX, y, 50, laser.getKnockback()));
addLabel(new GuiNpcLabel(109, "ability.knockbackUp", col2LabelX, y + 5));
addTextField(createFloatField(109, col2FieldX, y, 50, laser.getKnockbackUp()));
y += 24;
// Row 6: Effects button
addButton(new GuiNpcButton(150, labelX, y, 80, 20, "ability.effects"));
}
@Override
protected void initVisualTab(int startY) {
int y = startY;
int labelX = guiLeft + 8;
int fieldX = guiLeft + 85;
int col2LabelX = guiLeft + 180;
int col2FieldX = guiLeft + 260;
// Row 1: Inner Color + Outer Color
addLabel(new GuiNpcLabel(200, "ability.innerColor", labelX, y + 5));
String innerHex = String.format("%06X", laser.getInnerColor() & 0xFFFFFF);
GuiNpcButton innerColorBtn = new GuiNpcButton(200, fieldX, y, 55, 20, innerHex);
innerColorBtn.setTextColor(laser.getInnerColor() & 0xFFFFFF);
addButton(innerColorBtn);
addLabel(new GuiNpcLabel(201, "ability.outerColor", col2LabelX, y + 5));
String outerHex = String.format("%06X", laser.getOuterColor() & 0xFFFFFF);
GuiNpcButton outerColorBtn = new GuiNpcButton(201, col2FieldX, y, 55, 20, outerHex);
outerColorBtn.setTextColor(laser.getOuterColor() & 0xFFFFFF);
outerColorBtn.setEnabled(laser.isOuterColorEnabled());
addButton(outerColorBtn);
y += 24;
// Row 2: Outer Color Enabled + Outer Color Width
addLabel(new GuiNpcLabel(202, "ability.outerEnabled", labelX, y + 5));
addButton(new GuiNpcButton(202, fieldX, y, 50, 20, new String[]{"gui.no", "gui.yes"}, laser.isOuterColorEnabled() ? 1 : 0));
addLabel(new GuiNpcLabel(203, "ability.outerWidth", col2LabelX, y + 5));
GuiNpcTextField widthField = createFloatField(203, col2FieldX, y, 55, laser.getOuterColorWidth());
widthField.setEnabled(laser.isOuterColorEnabled());
addTextField(widthField);
y += 24;
// Row 3: Lightning Effect Enabled
addLabel(new GuiNpcLabel(204, "ability.outerAlpha", labelX, y + 5));
GuiNpcTextField alphaField = createFloatField(204, fieldX, y, 55, laser.getOuterColorAlpha());
alphaField.setEnabled(laser.isOuterColorEnabled());
alphaField.setMinMaxDefaultFloat(0, 1, 0.5f);
addTextField(alphaField);
addLabel(new GuiNpcLabel(205, "ability.lightning", col2LabelX, y + 5));
GuiNpcButton lightningBtn = new GuiNpcButton(205, col2FieldX, y, 50, 20, new String[]{"gui.no", "gui.yes"}, laser.hasLightningEffect() ? 1 : 0);
lightningBtn.setHoverText("ability.hover.lightning");
addButton(lightningBtn);
// Only show Lightning settings if Lightning is enabled
if (laser.hasLightningEffect()) {
y += 24;
// Row 4: Density + Radius
addLabel(new GuiNpcLabel(206, "ability.lightningDensity", labelX, y + 5));
GuiNpcTextField densityField = new GuiNpcTextField(206, this, fontRendererObj, fieldX, y, 55, 18, String.valueOf(laser.getLightningDensity()));
densityField.setMinMaxDefaultFloat(0.01f, 5.0f, 0.15f);
addTextField(densityField);
addLabel(new GuiNpcLabel(207, "ability.lightningRadius", col2LabelX, y + 5));
GuiNpcTextField radiusField = new GuiNpcTextField(207, this, fontRendererObj, col2FieldX, y, 55, 18, String.valueOf(laser.getLightningRadius()));
radiusField.setMinMaxDefaultFloat(0.1f, 10.0f, 0.5f);
addTextField(radiusField);
}
}
@Override
protected void handleTypeButton(int id, GuiNpcButton button) {
int value = button.getValue();
switch (id) {
case 106:
laser.setExplosive(value == 1);
initGui();
break;
case 150:
setSubGui(new SubGuiAbilityEffects(laser.getEffects()));
break;
}
}
@Override
protected void handleVisualButton(int id, GuiNpcButton button) {
int value = button.getValue();
switch (id) {
case 200:
editingVisualColorId = 200;
setSubGui(new SubGuiColorSelector(laser.getInnerColor()));
break;
case 201:
editingVisualColorId = 201;
setSubGui(new SubGuiColorSelector(laser.getOuterColor()));
break;
case 202:
laser.setOuterColorEnabled(value == 1);
initGui();
break;
case 205:
laser.setLightningEffect(value == 1);
initGui();
break;
}
}
@Override
public void subGuiClosed(SubGuiInterface subgui) {
if (subgui instanceof SubGuiColorSelector && editingVisualColorId != 0) {
SubGuiColorSelector colorSelector = (SubGuiColorSelector) subgui;
int rgb = colorSelector.color & 0x00FFFFFF;
if (editingVisualColorId == 200) {
laser.setInnerColor(rgb);
} else if (editingVisualColorId == 201) {
laser.setOuterColor(rgb);
}
editingVisualColorId = 0;
initGui();
} else if (subgui instanceof SubGuiAbilityEffects) {
SubGuiAbilityEffects effectsGui = (SubGuiAbilityEffects) subgui;
List<AbilityEffect> result = effectsGui.getResult();
if (result != null) {
laser.setEffects(result);
}
} else {
super.subGuiClosed(subgui);
}
}
@Override
protected void handleVisualTextField(int id, GuiNpcTextField field) {
switch (id) {
case 203:
laser.setOuterColorWidth(parseFloat(field, laser.getOuterColorWidth()));
break;
case 204:
laser.setOuterColorAlpha(parseFloat(field, laser.getOuterColorAlpha()));
break;
case 206:
laser.setLightningDensity(parseFloat(field, laser.getLightningDensity()));
break;
case 207:
laser.setLightningRadius(parseFloat(field, laser.getLightningRadius()));
break;
}
}
@Override
protected void handleTypeTextField(int id, GuiNpcTextField field) {
switch (id) {
case 100:
laser.setDamage(parseFloat(field, laser.getDamage()));
break;
case 101:
laser.setLaserWidth(parseFloat(field, laser.getLaserWidth()));
break;
case 102:
laser.setExpansionSpeed(parseFloat(field, laser.getExpansionSpeed()));
break;
case 103:
laser.setLingerTicks(field.getInteger());
break;
case 104:
laser.setMaxDistance(parseFloat(field, laser.getMaxDistance()));
break;
case 105:
laser.setMaxLifetime(field.getInteger());
break;
case 107:
laser.setExplosionRadius(parseFloat(field, laser.getExplosionRadius()));
break;
case 108:
laser.setKnockback(parseFloat(field, laser.getKnockback()));
break;
case 109:
laser.setKnockbackUp(parseFloat(field, laser.getKnockbackUp()));
break;
}
}
}
@@ -1,294 +0,0 @@
package noppes.npcs.client.gui.advanced.ability;
import kamkeel.npcs.controllers.data.ability.AbilityEffect;
import kamkeel.npcs.controllers.data.ability.AnchorPoint;
import kamkeel.npcs.controllers.data.ability.type.AbilityOrb;
import noppes.npcs.client.gui.SubGuiColorSelector;
import noppes.npcs.client.gui.advanced.SubGuiAbilityConfig;
import noppes.npcs.client.gui.util.GuiNpcButton;
import noppes.npcs.client.gui.util.GuiNpcLabel;
import noppes.npcs.client.gui.util.GuiNpcTextField;
import noppes.npcs.client.gui.util.IAbilityConfigCallback;
import noppes.npcs.client.gui.util.SubGuiInterface;
import java.util.List;
/**
* GUI for configuring Orb ability type-specific settings.
*/
public class SubGuiAbilityOrb extends SubGuiAbilityConfig {
private final AbilityOrb orb;
private int editingVisualColorId = 0;
public SubGuiAbilityOrb(AbilityOrb ability, IAbilityConfigCallback callback) {
super(ability, callback);
this.orb = ability;
}
@Override
protected boolean hasVisualSettings() {
return true;
}
@Override
protected void initTypeTab(int startY) {
int y = startY;
int labelX = guiLeft + 8;
int fieldX = guiLeft + 85;
int col2LabelX = guiLeft + 145;
int col2FieldX = guiLeft + 205;
// Row 1: Damage + Speed
addLabel(new GuiNpcLabel(100, "enchantment.damage", labelX, y + 5));
addTextField(createFloatField(100, fieldX, y, 50, orb.getDamage()));
addLabel(new GuiNpcLabel(101, "stats.speed", col2LabelX, y + 5));
addTextField(createFloatField(101, col2FieldX, y, 50, orb.getOrbSpeed()));
y += 24;
// Row 2: Orb Size + Max Distance
addLabel(new GuiNpcLabel(102, "stats.size", labelX, y + 5));
addTextField(createFloatField(102, fieldX, y, 50, orb.getOrbSize()));
addLabel(new GuiNpcLabel(103, "ability.maxDist", col2LabelX, y + 5));
addTextField(createFloatField(103, col2FieldX, y, 50, orb.getMaxDistance()));
y += 24;
// Row 3: Homing + Homing Strength (only show strength if homing)
addLabel(new GuiNpcLabel(104, "ability.homing", labelX, y + 5));
GuiNpcButton homingBtn = new GuiNpcButton(104, fieldX, y, 50, 20, new String[]{"gui.no", "gui.yes"}, orb.isHoming() ? 1 : 0);
homingBtn.setHoverText("ability.hover.homing");
addButton(homingBtn);
if (orb.isHoming()) {
addLabel(new GuiNpcLabel(105, "ability.homingStr", col2LabelX, y + 5));
addTextField(createFloatField(105, col2FieldX, y, 50, orb.getHomingStrength()));
}
y += 24;
// Row 4: Explosive + Explosion Radius (only show radius if explosive)
addLabel(new GuiNpcLabel(106, "ability.explosive", labelX, y + 5));
GuiNpcButton explosiveBtn = new GuiNpcButton(106, fieldX, y, 50, 20, new String[]{"gui.no", "gui.yes"}, orb.isExplosive() ? 1 : 0);
explosiveBtn.setHoverText("ability.hover.explosive");
addButton(explosiveBtn);
if (orb.isExplosive()) {
addLabel(new GuiNpcLabel(107, "ability.explosionRad", col2LabelX, y + 5));
addTextField(createFloatField(107, col2FieldX, y, 50, orb.getExplosionRadius()));
}
y += 24;
// Row 5: Knockback + Max Lifetime
addLabel(new GuiNpcLabel(108, "ability.knockback", labelX, y + 5));
addTextField(createFloatField(108, fieldX, y, 50, orb.getKnockback()));
addLabel(new GuiNpcLabel(109, "ability.lifetime", col2LabelX, y + 5));
addTextField(createIntField(109, col2FieldX, y, 50, orb.getMaxLifetime()));
y += 24;
// Row 6: Effects button
addButton(new GuiNpcButton(150, labelX, y, 80, 20, "ability.effects"));
}
@Override
protected void initVisualTab(int startY) {
int y = startY;
int labelX = guiLeft + 8;
int fieldX = guiLeft + 85;
int col2LabelX = guiLeft + 180;
int col2FieldX = guiLeft + 260;
// Row 1: Anchor Point
addLabel(new GuiNpcLabel(210, "ability.anchorPoint", labelX, y + 5));
GuiNpcButton anchorBtn = new GuiNpcButton(210, fieldX, y, 80, 20, AnchorPoint.getDisplayNames(), orb.getAnchorPointEnum().getId());
anchorBtn.setHoverText("ability.hover.anchorPoint");
addButton(anchorBtn);
y += 24;
// Row 2: Inner Color + Rotation Speed
addLabel(new GuiNpcLabel(200, "ability.innerColor", labelX, y + 5));
String innerHex = String.format("%06X", orb.getInnerColor() & 0xFFFFFF);
GuiNpcButton innerColorBtn = new GuiNpcButton(200, fieldX, y, 55, 20, innerHex);
innerColorBtn.setTextColor(orb.getInnerColor() & 0xFFFFFF);
addButton(innerColorBtn);
addLabel(new GuiNpcLabel(205, "ability.rotationSpeed", col2LabelX, y + 5));
addTextField(createFloatField(205, col2FieldX, y, 55, orb.getRotationSpeed()));
y += 24;
// Row 3: Outer Glow Enabled
addLabel(new GuiNpcLabel(202, "ability.outerEnabled", labelX, y + 5));
addButton(new GuiNpcButton(202, fieldX, y, 50, 20, new String[]{"gui.no", "gui.yes"}, orb.isOuterColorEnabled() ? 1 : 0));
// Only show Outer Color and Width if Outer Glow is enabled
if (orb.isOuterColorEnabled()) {
addLabel(new GuiNpcLabel(204, "ability.outerAlpha", col2LabelX, y + 5));
GuiNpcTextField alphaField = createFloatField(204, col2FieldX, y, 55, orb.getOuterColorAlpha());
alphaField.setEnabled(orb.isOuterColorEnabled());
alphaField.setMinMaxDefaultFloat(0, 1, 0.5f);
addTextField(alphaField);
y += 24;
// Row 4: Outer Color + Outer Width
addLabel(new GuiNpcLabel(201, "ability.outerColor", labelX, y + 5));
String outerHex = String.format("%06X", orb.getOuterColor() & 0xFFFFFF);
GuiNpcButton outerColorBtn = new GuiNpcButton(201, fieldX, y, 55, 20, outerHex);
outerColorBtn.setTextColor(orb.getOuterColor() & 0xFFFFFF);
addButton(outerColorBtn);
addLabel(new GuiNpcLabel(203, "ability.outerWidth", col2LabelX, y + 5));
addTextField(createFloatField(203, col2FieldX, y, 55, orb.getOuterColorWidth()));
}
y += 24;
// Row 5: Lightning Effect Enabled
addLabel(new GuiNpcLabel(206, "ability.lightning", labelX, y + 5));
GuiNpcButton lightningBtn = new GuiNpcButton(206, fieldX, y, 50, 20, new String[]{"gui.no", "gui.yes"}, orb.hasLightningEffect() ? 1 : 0);
lightningBtn.setHoverText("ability.hover.lightning");
addButton(lightningBtn);
// Only show Lightning settings if Lightning is enabled
if (orb.hasLightningEffect()) {
y += 24;
// Row 61: Density + Radius
addLabel(new GuiNpcLabel(207, "ability.lightningDensity", labelX, y + 5));
GuiNpcTextField densityField = new GuiNpcTextField(207, this, fontRendererObj, fieldX, y, 55, 18, String.valueOf(orb.getLightningDensity()));
densityField.setMinMaxDefaultFloat(0.01f, 5.0f, 0.15f);
addTextField(densityField);
addLabel(new GuiNpcLabel(208, "ability.lightningRadius", col2LabelX, y + 5));
GuiNpcTextField radiusField = new GuiNpcTextField(208, this, fontRendererObj, col2FieldX, y, 55, 18, String.valueOf(orb.getLightningRadius()));
radiusField.setMinMaxDefaultFloat(0.1f, 10.0f, 0.5f);
addTextField(radiusField);
}
}
@Override
protected void handleTypeButton(int id, GuiNpcButton button) {
int value = button.getValue();
switch (id) {
case 104:
orb.setHoming(value == 1);
initGui();
break;
case 106:
orb.setExplosive(value == 1);
initGui();
break;
case 150:
setSubGui(new SubGuiAbilityEffects(orb.getEffects()));
break;
}
}
@Override
protected void handleVisualButton(int id, GuiNpcButton button) {
int value = button.getValue();
switch (id) {
case 200:
editingVisualColorId = 200;
setSubGui(new SubGuiColorSelector(orb.getInnerColor()));
break;
case 201:
editingVisualColorId = 201;
setSubGui(new SubGuiColorSelector(orb.getOuterColor()));
break;
case 202:
orb.setOuterColorEnabled(value == 1);
initGui();
break;
case 206:
orb.setLightningEffect(value == 1);
initGui();
break;
case 210:
orb.setAnchorPointEnum(AnchorPoint.fromId(value));
break;
}
}
@Override
public void subGuiClosed(SubGuiInterface subgui) {
if (subgui instanceof SubGuiColorSelector && editingVisualColorId != 0) {
SubGuiColorSelector colorSelector = (SubGuiColorSelector) subgui;
int rgb = colorSelector.color & 0x00FFFFFF;
if (editingVisualColorId == 200) {
orb.setInnerColor(rgb);
} else if (editingVisualColorId == 201) {
orb.setOuterColor(rgb);
}
editingVisualColorId = 0;
initGui();
} else if (subgui instanceof SubGuiAbilityEffects) {
SubGuiAbilityEffects effectsGui = (SubGuiAbilityEffects) subgui;
List<AbilityEffect> result = effectsGui.getResult();
if (result != null) {
orb.setEffects(result);
}
} else {
super.subGuiClosed(subgui);
}
}
@Override
protected void handleTypeTextField(int id, GuiNpcTextField field) {
switch (id) {
case 100:
orb.setDamage(parseFloat(field, orb.getDamage()));
break;
case 101:
orb.setOrbSpeed(parseFloat(field, orb.getOrbSpeed()));
break;
case 102:
orb.setOrbSize(parseFloat(field, orb.getOrbSize()));
break;
case 103:
orb.setMaxDistance(parseFloat(field, orb.getMaxDistance()));
break;
case 105:
orb.setHomingStrength(parseFloat(field, orb.getHomingStrength()));
break;
case 107:
orb.setExplosionRadius(parseFloat(field, orb.getExplosionRadius()));
break;
case 108:
orb.setKnockback(parseFloat(field, orb.getKnockback()));
break;
case 109:
orb.setMaxLifetime(field.getInteger());
break;
}
}
@Override
protected void handleVisualTextField(int id, GuiNpcTextField field) {
switch (id) {
case 203:
orb.setOuterColorWidth(parseFloat(field, orb.getOuterColorWidth()));
break;
case 204:
orb.setOuterColorAlpha(parseFloat(field, orb.getOuterColorAlpha()));
break;
case 205:
orb.setRotationSpeed(parseFloat(field, orb.getRotationSpeed()));
break;
case 207:
orb.setLightningDensity(parseFloat(field, orb.getLightningDensity()));
break;
case 208:
orb.setLightningRadius(parseFloat(field, orb.getLightningRadius()));
break;
}
}
}
@@ -1,145 +0,0 @@
package noppes.npcs.client.gui.advanced.ability;
import kamkeel.npcs.controllers.data.ability.AbilityEffect;
import kamkeel.npcs.controllers.data.ability.type.AbilityProjectile;
import noppes.npcs.client.gui.advanced.SubGuiAbilityConfig;
import noppes.npcs.client.gui.util.GuiNpcButton;
import noppes.npcs.client.gui.util.GuiNpcLabel;
import noppes.npcs.client.gui.util.GuiNpcTextField;
import noppes.npcs.client.gui.util.IAbilityConfigCallback;
import noppes.npcs.client.gui.util.SubGuiInterface;
import java.util.List;
/**
* GUI for configuring Projectile ability type-specific settings.
*/
public class SubGuiAbilityProjectile extends SubGuiAbilityConfig {
private final AbilityProjectile projectile;
public SubGuiAbilityProjectile(AbilityProjectile ability, IAbilityConfigCallback callback) {
super(ability, callback);
this.projectile = ability;
}
@Override
protected void initTypeTab(int startY) {
int y = startY;
int labelX = guiLeft + 8;
int fieldX = guiLeft + 85;
int col2LabelX = guiLeft + 145;
int col2FieldX = guiLeft + 205;
// Row 1: Damage + Speed
addLabel(new GuiNpcLabel(100, "enchantment.damage", labelX, y + 5));
addTextField(createFloatField(100, fieldX, y, 50, projectile.getDamage()));
addLabel(new GuiNpcLabel(101, "stats.speed", col2LabelX, y + 5));
addTextField(createFloatField(101, col2FieldX, y, 50, projectile.getSpeed()));
y += 24;
// Row 2: Knockback + Projectile Type
addLabel(new GuiNpcLabel(102, "ability.knockback", labelX, y + 5));
addTextField(createFloatField(102, fieldX, y, 50, projectile.getKnockback()));
addLabel(new GuiNpcLabel(103, "ability.projType", col2LabelX, y + 5));
String[] projTypes = {"fireball", "arrow", "magic"};
int typeIdx = 0;
String currType = projectile.getProjectileType();
for (int i = 0; i < projTypes.length; i++) {
if (projTypes[i].equals(currType)) {
typeIdx = i;
break;
}
}
addButton(new GuiNpcButton(103, col2FieldX, y, 60, 20, projTypes, typeIdx));
y += 24;
// Row 3: Explosive + Explosion Radius (only show radius if explosive)
addLabel(new GuiNpcLabel(104, "ability.explosive", labelX, y + 5));
GuiNpcButton explosiveBtn = new GuiNpcButton(104, fieldX, y, 50, 20, new String[]{"gui.no", "gui.yes"}, projectile.isExplosive() ? 1 : 0);
explosiveBtn.setHoverText("ability.hover.explosive");
addButton(explosiveBtn);
if (projectile.isExplosive()) {
addLabel(new GuiNpcLabel(105, "ability.explosionRad", col2LabelX, y + 5));
addTextField(createFloatField(105, col2FieldX, y, 50, projectile.getExplosionRadius()));
}
y += 24;
// Row 4: Homing + Homing Strength (only show strength if homing)
addLabel(new GuiNpcLabel(106, "ability.homing", labelX, y + 5));
GuiNpcButton homingBtn = new GuiNpcButton(106, fieldX, y, 50, 20, new String[]{"gui.no", "gui.yes"}, projectile.isHoming() ? 1 : 0);
homingBtn.setHoverText("ability.hover.homing");
addButton(homingBtn);
if (projectile.isHoming()) {
addLabel(new GuiNpcLabel(107, "ability.homingStr", col2LabelX, y + 5));
addTextField(createFloatField(107, col2FieldX, y, 50, projectile.getHomingStrength()));
}
y += 24;
// Row 5: Effects button
addButton(new GuiNpcButton(150, labelX, y, 80, 20, "ability.effects"));
}
@Override
protected void handleTypeButton(int id, GuiNpcButton button) {
int value = button.getValue();
switch (id) {
case 103:
String[] projTypes = {"fireball", "arrow", "magic"};
projectile.setProjectileType(projTypes[value]);
break;
case 104:
projectile.setExplosive(value == 1);
initGui();
break;
case 106:
projectile.setHoming(value == 1);
initGui();
break;
case 150:
setSubGui(new SubGuiAbilityEffects(projectile.getEffects()));
break;
}
}
@Override
public void subGuiClosed(SubGuiInterface subgui) {
super.subGuiClosed(subgui);
if (subgui instanceof SubGuiAbilityEffects) {
SubGuiAbilityEffects effectsGui = (SubGuiAbilityEffects) subgui;
List<AbilityEffect> result = effectsGui.getResult();
if (result != null) {
projectile.setEffects(result);
}
}
}
@Override
protected void handleTypeTextField(int id, GuiNpcTextField field) {
switch (id) {
case 100:
projectile.setDamage(parseFloat(field, projectile.getDamage()));
break;
case 101:
projectile.setSpeed(parseFloat(field, projectile.getSpeed()));
break;
case 102:
projectile.setKnockback(parseFloat(field, projectile.getKnockback()));
break;
case 105:
projectile.setExplosionRadius(parseFloat(field, projectile.getExplosionRadius()));
break;
case 107:
projectile.setHomingStrength(parseFloat(field, projectile.getHomingStrength()));
break;
}
}
}
@@ -1,95 +0,0 @@
package noppes.npcs.client.gui.advanced.ability;
import kamkeel.npcs.controllers.data.ability.AbilityEffect;
import kamkeel.npcs.controllers.data.ability.type.AbilityShockwave;
import noppes.npcs.client.gui.advanced.SubGuiAbilityConfig;
import noppes.npcs.client.gui.util.GuiNpcButton;
import noppes.npcs.client.gui.util.GuiNpcLabel;
import noppes.npcs.client.gui.util.GuiNpcTextField;
import noppes.npcs.client.gui.util.IAbilityConfigCallback;
import noppes.npcs.client.gui.util.SubGuiInterface;
import java.util.List;
/**
* GUI for configuring Shockwave ability type-specific settings.
*/
public class SubGuiAbilityShockwave extends SubGuiAbilityConfig {
private final AbilityShockwave shockwave;
public SubGuiAbilityShockwave(AbilityShockwave ability, IAbilityConfigCallback callback) {
super(ability, callback);
this.shockwave = ability;
}
@Override
protected void initTypeTab(int startY) {
int y = startY;
int labelX = guiLeft + 8;
int fieldX = guiLeft + 85;
int col2LabelX = guiLeft + 145;
int col2FieldX = guiLeft + 205;
// Row 1: Damage + Push Radius
addLabel(new GuiNpcLabel(100, "enchantment.damage", labelX, y + 5));
addTextField(createFloatField(100, fieldX, y, 50, shockwave.getDamage()));
addLabel(new GuiNpcLabel(101, "ability.pushRadius", col2LabelX, y + 5));
addTextField(createFloatField(101, col2FieldX, y, 50, shockwave.getPushRadius()));
y += 24;
// Row 2: Push Strength
addLabel(new GuiNpcLabel(102, "ability.pushStrength", labelX, y + 5));
addTextField(createFloatField(102, fieldX, y, 50, shockwave.getPushStrength()));
y += 24;
// Row 3: Max Targets + Effects button
addLabel(new GuiNpcLabel(104, "ability.maxTargets", labelX, y + 5));
addTextField(createIntField(104, fieldX, y, 50, shockwave.getMaxTargets()));
addButton(new GuiNpcButton(150, col2LabelX, y, 80, 20, "ability.effects"));
y += 24;
addLabel(new GuiNpcLabel(105, "ability.shockwaveFalloff", labelX, y + 5));
}
@Override
protected void handleTypeButton(int id, GuiNpcButton button) {
if (id == 150) {
setSubGui(new SubGuiAbilityEffects(shockwave.getEffects()));
}
}
@Override
public void subGuiClosed(SubGuiInterface subgui) {
super.subGuiClosed(subgui);
if (subgui instanceof SubGuiAbilityEffects) {
SubGuiAbilityEffects effectsGui = (SubGuiAbilityEffects) subgui;
List<AbilityEffect> result = effectsGui.getResult();
if (result != null) {
shockwave.setEffects(result);
}
}
}
@Override
protected void handleTypeTextField(int id, GuiNpcTextField field) {
switch (id) {
case 100:
shockwave.setDamage(parseFloat(field, shockwave.getDamage()));
break;
case 101:
shockwave.setPushRadius(parseFloat(field, shockwave.getPushRadius()));
break;
case 102:
shockwave.setPushStrength(parseFloat(field, shockwave.getPushStrength()));
break;
case 104:
shockwave.setMaxTargets(field.getInteger());
break;
}
}
}
@@ -1,98 +0,0 @@
package noppes.npcs.client.gui.advanced.ability;
import kamkeel.npcs.controllers.data.ability.AbilityEffect;
import kamkeel.npcs.controllers.data.ability.type.AbilitySlam;
import noppes.npcs.client.gui.advanced.SubGuiAbilityConfig;
import noppes.npcs.client.gui.util.GuiNpcButton;
import noppes.npcs.client.gui.util.GuiNpcLabel;
import noppes.npcs.client.gui.util.GuiNpcTextField;
import noppes.npcs.client.gui.util.IAbilityConfigCallback;
import noppes.npcs.client.gui.util.SubGuiInterface;
import java.util.List;
/**
* GUI for configuring Slam ability type-specific settings.
*/
public class SubGuiAbilitySlam extends SubGuiAbilityConfig {
private final AbilitySlam slam;
public SubGuiAbilitySlam(AbilitySlam ability, IAbilityConfigCallback callback) {
super(ability, callback);
this.slam = ability;
}
@Override
protected void initTypeTab(int startY) {
int y = startY;
int labelX = guiLeft + 8;
int fieldX = guiLeft + 85;
int col2LabelX = guiLeft + 145;
int col2FieldX = guiLeft + 205;
// Row 1: Damage + Radius
addLabel(new GuiNpcLabel(100, "enchantment.damage", labelX, y + 5));
addTextField(createFloatField(100, fieldX, y, 50, slam.getDamage()));
addLabel(new GuiNpcLabel(101, "ability.radius", col2LabelX, y + 5));
addTextField(createFloatField(101, col2FieldX, y, 50, slam.getRadius()));
y += 24;
// Row 2: Knockback + Leap Speed
addLabel(new GuiNpcLabel(102, "ability.knockback", labelX, y + 5));
addTextField(createFloatField(102, fieldX, y, 50, slam.getKnockbackStrength()));
addLabel(new GuiNpcLabel(103, "ability.leapSpeed", col2LabelX, y + 5));
addTextField(createFloatField(103, col2FieldX, y, 50, slam.getLeapSpeed()));
y += 24;
// Row 3: Leap Height + Effects
addLabel(new GuiNpcLabel(104, "ability.leapHeight", labelX, y + 5));
addTextField(createFloatField(104, fieldX, y, 50, slam.getLeapHeight()));
addButton(new GuiNpcButton(150, col2LabelX, y, 80, 20, "ability.effects"));
}
@Override
protected void handleTypeButton(int id, GuiNpcButton button) {
if (id == 150) {
setSubGui(new SubGuiAbilityEffects(slam.getEffects()));
}
}
@Override
public void subGuiClosed(SubGuiInterface subgui) {
super.subGuiClosed(subgui);
if (subgui instanceof SubGuiAbilityEffects) {
SubGuiAbilityEffects effectsGui = (SubGuiAbilityEffects) subgui;
List<AbilityEffect> result = effectsGui.getResult();
if (result != null) {
slam.setEffects(result);
}
}
}
@Override
protected void handleTypeTextField(int id, GuiNpcTextField field) {
switch (id) {
case 100:
slam.setDamage(parseFloat(field, slam.getDamage()));
break;
case 101:
slam.setRadius(parseFloat(field, slam.getRadius()));
break;
case 102:
slam.setKnockbackStrength(parseFloat(field, slam.getKnockbackStrength()));
break;
case 103:
slam.setLeapSpeed(parseFloat(field, slam.getLeapSpeed()));
break;
case 104:
slam.setLeapHeight(parseFloat(field, slam.getLeapHeight()));
break;
}
}
}
@@ -1,219 +0,0 @@
package noppes.npcs.client.gui.advanced.ability;
import kamkeel.npcs.controllers.data.ability.AbilityEffect;
import kamkeel.npcs.controllers.data.ability.type.AbilitySweeper;
import noppes.npcs.client.gui.SubGuiColorSelector;
import noppes.npcs.client.gui.advanced.SubGuiAbilityConfig;
import noppes.npcs.client.gui.util.GuiNpcButton;
import noppes.npcs.client.gui.util.GuiNpcLabel;
import noppes.npcs.client.gui.util.GuiNpcTextField;
import noppes.npcs.client.gui.util.IAbilityConfigCallback;
import noppes.npcs.client.gui.util.SubGuiInterface;
import java.util.List;
/**
* GUI for configuring Sweeper ability type-specific settings.
* Sweeper is a low rotating beam that players can jump over.
*/
public class SubGuiAbilitySweeper extends SubGuiAbilityConfig {
private final AbilitySweeper sweeper;
private int editingVisualColorId = 0;
public SubGuiAbilitySweeper(AbilitySweeper ability, IAbilityConfigCallback callback) {
super(ability, callback);
this.sweeper = ability;
}
@Override
protected boolean hasVisualSettings() {
return true;
}
@Override
protected void initTypeTab(int startY) {
int y = startY;
int labelX = guiLeft + 8;
int fieldX = guiLeft + 85;
int col2LabelX = guiLeft + 145;
int col2FieldX = guiLeft + 205;
// Row 1: Damage + Damage Interval
addLabel(new GuiNpcLabel(100, "enchantment.damage", labelX, y + 5));
addTextField(createFloatField(100, fieldX, y, 50, sweeper.getDamage()));
addLabel(new GuiNpcLabel(101, "ability.dmgInterval", col2LabelX, y + 5));
addTextField(createIntField(101, col2FieldX, y, 50, sweeper.getDamageInterval()));
y += 24;
// Row 2: Beam Length + Beam Width
addLabel(new GuiNpcLabel(102, "ability.beamLength", labelX, y + 5));
addTextField(createFloatField(102, fieldX, y, 50, sweeper.getBeamLength()));
addLabel(new GuiNpcLabel(103, "ability.beamWidth", col2LabelX, y + 5));
addTextField(createFloatField(103, col2FieldX, y, 50, sweeper.getBeamWidth()));
y += 24;
// Row 3: Beam Height + Sweep Speed
addLabel(new GuiNpcLabel(104, "ability.beamHeight", labelX, y + 5));
addTextField(createFloatField(104, fieldX, y, 50, sweeper.getBeamHeight()));
addLabel(new GuiNpcLabel(105, "ability.sweepSpeed", col2LabelX, y + 5));
addTextField(createFloatField(105, col2FieldX, y, 50, sweeper.getSweepSpeed()));
y += 24;
// Row 4: Number of Rotations + Piercing
addLabel(new GuiNpcLabel(106, "ability.rotations", labelX, y + 5));
addTextField(createIntField(106, fieldX, y, 50, sweeper.getNumberOfRotations()));
addLabel(new GuiNpcLabel(107, "ability.piercing", col2LabelX, y + 5));
GuiNpcButton piercingBtn = new GuiNpcButton(107, col2FieldX, y, 50, 20, new String[]{"gui.no", "gui.yes"}, sweeper.isPiercing() ? 1 : 0);
piercingBtn.setHoverText("ability.hover.piercing");
addButton(piercingBtn);
y += 24;
// Row 5: Lock On Target
addLabel(new GuiNpcLabel(108, "ability.lockTarget", labelX, y + 5));
GuiNpcButton lockTargetBtn = new GuiNpcButton(108, fieldX, y, 50, 20, new String[]{"gui.no", "gui.yes"}, sweeper.isLockOnTarget() ? 1 : 0);
lockTargetBtn.setHoverText("ability.hover.lockTarget");
addButton(lockTargetBtn);
y += 24;
// Row 6: Effects button
addButton(new GuiNpcButton(150, labelX, y, 80, 20, "ability.effects"));
}
@Override
protected void initVisualTab(int startY) {
int y = startY;
int labelX = guiLeft + 8;
int fieldX = guiLeft + 85;
int col2LabelX = guiLeft + 180;
int col2FieldX = guiLeft + 260;
// Row 1: Inner Color + Outer Color
addLabel(new GuiNpcLabel(200, "ability.innerColor", labelX, y + 5));
String innerHex = String.format("%06X", sweeper.getInnerColor() & 0xFFFFFF);
GuiNpcButton innerColorBtn = new GuiNpcButton(200, fieldX, y, 55, 20, innerHex);
innerColorBtn.setTextColor(sweeper.getInnerColor() & 0xFFFFFF);
addButton(innerColorBtn);
addLabel(new GuiNpcLabel(201, "ability.outerColor", col2LabelX, y + 5));
String outerHex = String.format("%06X", sweeper.getOuterColor() & 0xFFFFFF);
GuiNpcButton outerColorBtn = new GuiNpcButton(201, col2FieldX, y, 55, 20, outerHex);
outerColorBtn.setTextColor(sweeper.getOuterColor() & 0xFFFFFF);
outerColorBtn.setEnabled(sweeper.isOuterColorEnabled());
addButton(outerColorBtn);
y += 24;
// Row 2: Outer Color Enabled + Outer Color Width
addLabel(new GuiNpcLabel(202, "ability.outerEnabled", labelX, y + 5));
addButton(new GuiNpcButton(202, fieldX, y, 50, 20, new String[]{"gui.no", "gui.yes"}, sweeper.isOuterColorEnabled() ? 1 : 0));
addLabel(new GuiNpcLabel(203, "ability.outerWidth", col2LabelX, y + 5));
GuiNpcTextField widthField = createFloatField(203, col2FieldX, y, 55, sweeper.getOuterColorWidth());
widthField.setEnabled(sweeper.isOuterColorEnabled());
addTextField(widthField);
}
@Override
protected void handleTypeButton(int id, GuiNpcButton button) {
int value = button.getValue();
switch (id) {
case 107:
sweeper.setPiercing(value == 1);
break;
case 108:
sweeper.setLockOnTarget(value == 1);
break;
case 150:
setSubGui(new SubGuiAbilityEffects(sweeper.getEffects()));
break;
}
}
@Override
protected void handleVisualButton(int id, GuiNpcButton button) {
int value = button.getValue();
switch (id) {
case 200:
editingVisualColorId = 200;
setSubGui(new SubGuiColorSelector(sweeper.getInnerColor()));
break;
case 201:
editingVisualColorId = 201;
setSubGui(new SubGuiColorSelector(sweeper.getOuterColor()));
break;
case 202:
sweeper.setOuterColorEnabled(value == 1);
initGui();
break;
}
}
@Override
public void subGuiClosed(SubGuiInterface subgui) {
if (subgui instanceof SubGuiColorSelector && editingVisualColorId != 0) {
SubGuiColorSelector colorSelector = (SubGuiColorSelector) subgui;
int rgb = colorSelector.color & 0x00FFFFFF;
if (editingVisualColorId == 200) {
sweeper.setInnerColor(rgb);
} else if (editingVisualColorId == 201) {
sweeper.setOuterColor(rgb);
}
editingVisualColorId = 0;
initGui();
} else if (subgui instanceof SubGuiAbilityEffects) {
SubGuiAbilityEffects effectsGui = (SubGuiAbilityEffects) subgui;
List<AbilityEffect> result = effectsGui.getResult();
if (result != null) {
sweeper.setEffects(result);
}
} else {
super.subGuiClosed(subgui);
}
}
@Override
protected void handleTypeTextField(int id, GuiNpcTextField field) {
switch (id) {
case 100:
sweeper.setDamage(parseFloat(field, sweeper.getDamage()));
break;
case 101:
sweeper.setDamageInterval(field.getInteger());
break;
case 102:
sweeper.setBeamLength(parseFloat(field, sweeper.getBeamLength()));
break;
case 103:
sweeper.setBeamWidth(parseFloat(field, sweeper.getBeamWidth()));
break;
case 104:
sweeper.setBeamHeight(parseFloat(field, sweeper.getBeamHeight()));
break;
case 105:
sweeper.setSweepSpeed(parseFloat(field, sweeper.getSweepSpeed()));
break;
case 106:
sweeper.setNumberOfRotations(field.getInteger());
break;
}
}
@Override
protected void handleVisualTextField(int id, GuiNpcTextField field) {
switch (id) {
case 203:
sweeper.setOuterColorWidth(parseFloat(field, sweeper.getOuterColorWidth()));
break;
}
}
}
@@ -1,165 +0,0 @@
package noppes.npcs.client.gui.advanced.ability;
import kamkeel.npcs.controllers.data.ability.AbilityEffect;
import kamkeel.npcs.controllers.data.ability.type.AbilityTeleport;
import noppes.npcs.client.gui.advanced.SubGuiAbilityConfig;
import noppes.npcs.client.gui.util.GuiNpcButton;
import noppes.npcs.client.gui.util.GuiNpcLabel;
import noppes.npcs.client.gui.util.GuiNpcTextField;
import noppes.npcs.client.gui.util.IAbilityConfigCallback;
import noppes.npcs.client.gui.util.SubGuiInterface;
import java.util.List;
/**
* GUI for configuring Teleport ability type-specific settings.
*/
public class SubGuiAbilityTeleport extends SubGuiAbilityConfig {
private final AbilityTeleport teleport;
public SubGuiAbilityTeleport(AbilityTeleport ability, IAbilityConfigCallback callback) {
super(ability, callback);
this.teleport = ability;
}
@Override
protected void initTypeTab(int startY) {
int y = startY;
int labelX = guiLeft + 8;
int fieldX = guiLeft + 85;
int col2LabelX = guiLeft + 145;
int col2FieldX = guiLeft + 205;
// Row 1: Mode
addLabel(new GuiNpcLabel(100, "ability.mode", labelX, y + 5));
String[] modes = {"Blink", "Behind", "Single"};
addButton(new GuiNpcButton(100, fieldX, y, 80, 20, modes, teleport.getModeEnum().ordinal()));
y += 24;
switch (teleport.getModeEnum()) {
case BLINK:
// Row 2: Blink Radius + Blink Count
addLabel(new GuiNpcLabel(101, "ability.blinkRadius", labelX, y + 5));
addTextField(createFloatField(101, fieldX, y, 50, teleport.getBlinkRadius()));
addLabel(new GuiNpcLabel(102, "ability.blinkCount", col2LabelX, y + 5));
addTextField(createIntField(102, col2FieldX, y, 50, teleport.getBlinkCount()));
y += 24;
// Row 3: Blink Delay + Line of Sight
addLabel(new GuiNpcLabel(103, "ability.blinkDelay", labelX, y + 5));
addTextField(createIntField(103, fieldX, y, 50, teleport.getBlinkDelayTicks()));
addLabel(new GuiNpcLabel(105, "ability.lineOfSight", col2LabelX, y + 5));
GuiNpcButton losBtn1 = new GuiNpcButton(105, col2FieldX, y, 50, 20, new String[]{"gui.no", "gui.yes"}, teleport.isRequireLineOfSight() ? 1 : 0);
losBtn1.setHoverText("ability.hover.lineOfSight");
addButton(losBtn1);
y += 24;
break;
case SINGLE:
// Row 2: Blink Radius + Line of Sight
addLabel(new GuiNpcLabel(101, "ability.blinkRadius", labelX, y + 5));
addTextField(createFloatField(101, fieldX, y, 50, teleport.getBlinkRadius()));
addLabel(new GuiNpcLabel(105, "ability.lineOfSight", col2LabelX, y + 5));
GuiNpcButton losBtn2 = new GuiNpcButton(105, col2FieldX, y, 50, 20, new String[]{"gui.no", "gui.yes"}, teleport.isRequireLineOfSight() ? 1 : 0);
losBtn2.setHoverText("ability.hover.lineOfSight");
addButton(losBtn2);
y += 24;
break;
case BEHIND:
// Row 2: Behind Distance
addLabel(new GuiNpcLabel(104, "ability.behindDistance", labelX, y + 5));
addTextField(createFloatField(104, fieldX, y, 50, teleport.getBehindDistance()));
y += 24;
break;
}
// Damage + Damage Radius
addLabel(new GuiNpcLabel(106, "enchantment.damage", labelX, y + 5));
addTextField(createFloatField(106, fieldX, y, 50, teleport.getDamage()));
addLabel(new GuiNpcLabel(107, "ability.dmgRadius", col2LabelX, y + 5));
addTextField(createFloatField(107, col2FieldX, y, 50, teleport.getDamageRadius()));
y += 24;
// Damage at Start/End
addLabel(new GuiNpcLabel(108, "ability.dmgAtStart", labelX, y + 5));
GuiNpcButton dmgStartBtn = new GuiNpcButton(108, fieldX, y, 50, 20, new String[]{"gui.no", "gui.yes"}, teleport.isDamageAtStart() ? 1 : 0);
dmgStartBtn.setHoverText("ability.hover.dmgAtStart");
addButton(dmgStartBtn);
addLabel(new GuiNpcLabel(109, "ability.dmgAtEnd", col2LabelX, y + 5));
GuiNpcButton dmgEndBtn = new GuiNpcButton(109, col2FieldX, y, 50, 20, new String[]{"gui.no", "gui.yes"}, teleport.isDamageAtEnd() ? 1 : 0);
dmgEndBtn.setHoverText("ability.hover.dmgAtEnd");
addButton(dmgEndBtn);
y += 24;
// Effects button
addButton(new GuiNpcButton(150, labelX, y, 80, 20, "ability.effects"));
}
@Override
protected void handleTypeButton(int id, GuiNpcButton button) {
int value = button.getValue();
switch (id) {
case 100:
teleport.setModeEnum(AbilityTeleport.TeleportMode.values()[value]);
initGui();
break;
case 105:
teleport.setRequireLineOfSight(value == 1);
break;
case 108:
teleport.setDamageAtStart(value == 1);
break;
case 109:
teleport.setDamageAtEnd(value == 1);
break;
case 150:
setSubGui(new SubGuiAbilityEffects(teleport.getEffects()));
break;
}
}
@Override
public void subGuiClosed(SubGuiInterface subgui) {
super.subGuiClosed(subgui);
if (subgui instanceof SubGuiAbilityEffects) {
SubGuiAbilityEffects effectsGui = (SubGuiAbilityEffects) subgui;
List<AbilityEffect> result = effectsGui.getResult();
if (result != null) {
teleport.setEffects(result);
}
}
}
@Override
protected void handleTypeTextField(int id, GuiNpcTextField field) {
switch (id) {
case 101:
teleport.setBlinkRadius(parseFloat(field, teleport.getBlinkRadius()));
break;
case 102:
teleport.setBlinkCount(field.getInteger());
break;
case 103:
teleport.setBlinkDelayTicks(field.getInteger());
break;
case 104:
teleport.setBehindDistance(parseFloat(field, teleport.getBehindDistance()));
break;
case 106:
teleport.setDamage(parseFloat(field, teleport.getDamage()));
break;
case 107:
teleport.setDamageRadius(parseFloat(field, teleport.getDamageRadius()));
break;
}
}
}
@@ -1,126 +0,0 @@
package noppes.npcs.client.gui.advanced.ability;
import kamkeel.npcs.controllers.data.ability.AbilityEffect;
import kamkeel.npcs.controllers.data.ability.type.AbilityTrap;
import noppes.npcs.client.gui.advanced.SubGuiAbilityConfig;
import noppes.npcs.client.gui.util.GuiNpcButton;
import noppes.npcs.client.gui.util.GuiNpcLabel;
import noppes.npcs.client.gui.util.GuiNpcTextField;
import noppes.npcs.client.gui.util.IAbilityConfigCallback;
import noppes.npcs.client.gui.util.SubGuiInterface;
import java.util.List;
/**
* GUI for configuring Trap ability type-specific settings.
*/
public class SubGuiAbilityTrap extends SubGuiAbilityConfig {
private final AbilityTrap trap;
public SubGuiAbilityTrap(AbilityTrap ability, IAbilityConfigCallback callback) {
super(ability, callback);
this.trap = ability;
}
@Override
protected void initTypeTab(int startY) {
int y = startY;
int labelX = guiLeft + 8;
int fieldX = guiLeft + 85;
int col2LabelX = guiLeft + 145;
int col2FieldX = guiLeft + 205;
// Row 1: Duration + Placement
addLabel(new GuiNpcLabel(99, "ability.duration", labelX, y + 5));
GuiNpcTextField durationField = createIntField(99, fieldX, y, 50, trap.getDurationTicks());
durationField.setMinMaxDefault(1, 2000, 200);
addTextField(durationField);
addLabel(new GuiNpcLabel(100, "ability.placement", col2LabelX, y + 5));
String[] placements = {"Caster", "Target", "Ahead"};
GuiNpcButton placementBtn = new GuiNpcButton(100, col2FieldX, y, 55, 20, placements, trap.getPlacementEnum().ordinal());
placementBtn.setHoverText("ability.hover.placement");
addButton(placementBtn);
y += 24;
// Row 2: Trigger Radius
addLabel(new GuiNpcLabel(101, "ability.triggerRad", labelX, y + 5));
addTextField(createFloatField(101, fieldX, y, 50, trap.getTriggerRadius()));
y += 24;
// Row 2: Damage + Damage Radius
addLabel(new GuiNpcLabel(102, "enchantment.damage", labelX, y + 5));
addTextField(createFloatField(102, fieldX, y, 50, trap.getDamage()));
addLabel(new GuiNpcLabel(103, "ability.dmgRadius", col2LabelX, y + 5));
addTextField(createFloatField(103, col2FieldX, y, 50, trap.getDamageRadius()));
y += 24;
// Row 3: Arm Time + Max Triggers
addLabel(new GuiNpcLabel(104, "ability.armTime", labelX, y + 5));
addTextField(createIntField(104, fieldX, y, 50, trap.getArmTime()));
addLabel(new GuiNpcLabel(105, "ability.maxTriggers", col2LabelX, y + 5));
addTextField(createIntField(105, col2FieldX, y, 50, trap.getMaxTriggers()));
y += 24;
// Row 4: Knockback + Effects button
addLabel(new GuiNpcLabel(108, "ability.knockback", labelX, y + 5));
addTextField(createFloatField(108, fieldX, y, 50, trap.getKnockback()));
addButton(new GuiNpcButton(150, col2LabelX, y, 80, 20, "ability.effects"));
}
@Override
protected void handleTypeButton(int id, GuiNpcButton button) {
if (id == 100) {
trap.setPlacementEnum(AbilityTrap.TrapPlacement.values()[button.getValue()]);
} else if (id == 150) {
setSubGui(new SubGuiAbilityEffects(trap.getEffects()));
}
}
@Override
public void subGuiClosed(SubGuiInterface subgui) {
super.subGuiClosed(subgui);
if (subgui instanceof SubGuiAbilityEffects) {
SubGuiAbilityEffects effectsGui = (SubGuiAbilityEffects) subgui;
List<AbilityEffect> result = effectsGui.getResult();
if (result != null) {
trap.setEffects(result);
}
}
}
@Override
protected void handleTypeTextField(int id, GuiNpcTextField field) {
switch (id) {
case 99:
trap.setDurationTicks(field.getInteger());
break;
case 101:
trap.setTriggerRadius(parseFloat(field, trap.getTriggerRadius()));
break;
case 102:
trap.setDamage(parseFloat(field, trap.getDamage()));
break;
case 103:
trap.setDamageRadius(parseFloat(field, trap.getDamageRadius()));
break;
case 104:
trap.setArmTime(field.getInteger());
break;
case 105:
trap.setMaxTriggers(field.getInteger());
break;
case 108:
trap.setKnockback(parseFloat(field, trap.getKnockback()));
break;
}
}
}
@@ -1,129 +0,0 @@
package noppes.npcs.client.gui.advanced.ability;
import kamkeel.npcs.controllers.data.ability.AbilityEffect;
import kamkeel.npcs.controllers.data.ability.type.AbilityVortex;
import noppes.npcs.client.gui.advanced.SubGuiAbilityConfig;
import noppes.npcs.client.gui.util.GuiNpcButton;
import noppes.npcs.client.gui.util.GuiNpcLabel;
import noppes.npcs.client.gui.util.GuiNpcTextField;
import noppes.npcs.client.gui.util.IAbilityConfigCallback;
import noppes.npcs.client.gui.util.SubGuiInterface;
import java.util.List;
/**
* GUI for configuring Vortex ability type-specific settings.
*/
public class SubGuiAbilityVortex extends SubGuiAbilityConfig {
private final AbilityVortex vortex;
public SubGuiAbilityVortex(AbilityVortex ability, IAbilityConfigCallback callback) {
super(ability, callback);
this.vortex = ability;
}
@Override
protected void initTypeTab(int startY) {
int y = startY;
int labelX = guiLeft + 8;
int fieldX = guiLeft + 85;
int col2LabelX = guiLeft + 145;
int col2FieldX = guiLeft + 205;
// Row 1: Pull Radius + Pull Strength
addLabel(new GuiNpcLabel(100, "ability.pullRadius", labelX, y + 5));
addTextField(createFloatField(100, fieldX, y, 50, vortex.getPullRadius()));
addLabel(new GuiNpcLabel(101, "ability.pullStrength", col2LabelX, y + 5));
addTextField(createFloatField(101, col2FieldX, y, 50, vortex.getPullStrength()));
y += 24;
// Row 2: Damage + Knockback
addLabel(new GuiNpcLabel(102, "enchantment.damage", labelX, y + 5));
addTextField(createFloatField(102, fieldX, y, 50, vortex.getDamage()));
addLabel(new GuiNpcLabel(103, "ability.knockback", col2LabelX, y + 5));
addTextField(createFloatField(103, col2FieldX, y, 50, vortex.getKnockback()));
y += 24;
// Row 3: AOE + Max Targets
addLabel(new GuiNpcLabel(104, "ability.aoe", labelX, y + 5));
GuiNpcButton aoeBtn = new GuiNpcButton(104, fieldX, y, 50, 20, new String[]{"gui.no", "gui.yes"}, vortex.isAoe() ? 1 : 0);
aoeBtn.setHoverText("ability.hover.aoe");
addButton(aoeBtn);
addLabel(new GuiNpcLabel(105, "ability.maxTargets", col2LabelX, y + 5));
addTextField(createIntField(105, col2FieldX, y, 50, vortex.getMaxTargets()));
y += 24;
// Row 4: Effects button
addButton(new GuiNpcButton(150, labelX, y, 80, 20, "ability.effects"));
y += 24;
// Row 5: Damage on Pull + Pull Damage
addLabel(new GuiNpcLabel(108, "ability.dmgOnPull", labelX, y + 5));
GuiNpcButton dmgOnPullBtn = new GuiNpcButton(108, fieldX, y, 50, 20, new String[]{"gui.no", "gui.yes"}, vortex.isDamageOnPull() ? 1 : 0);
dmgOnPullBtn.setHoverText("ability.hover.dmgOnPull");
addButton(dmgOnPullBtn);
addLabel(new GuiNpcLabel(109, "ability.pullDamage", col2LabelX, y + 5));
addTextField(createFloatField(109, col2FieldX, y, 50, vortex.getPullDamage()));
}
@Override
protected void handleTypeButton(int id, GuiNpcButton button) {
int value = button.getValue();
switch (id) {
case 104:
vortex.setAoe(value == 1);
break;
case 108:
vortex.setDamageOnPull(value == 1);
break;
case 150:
setSubGui(new SubGuiAbilityEffects(vortex.getEffects()));
break;
}
}
@Override
public void subGuiClosed(SubGuiInterface subgui) {
super.subGuiClosed(subgui);
if (subgui instanceof SubGuiAbilityEffects) {
SubGuiAbilityEffects effectsGui = (SubGuiAbilityEffects) subgui;
List<AbilityEffect> result = effectsGui.getResult();
if (result != null) {
vortex.setEffects(result);
}
}
}
@Override
protected void handleTypeTextField(int id, GuiNpcTextField field) {
switch (id) {
case 100:
vortex.setPullRadius(parseFloat(field, vortex.getPullRadius()));
break;
case 101:
vortex.setPullStrength(parseFloat(field, vortex.getPullStrength()));
break;
case 102:
vortex.setDamage(parseFloat(field, vortex.getDamage()));
break;
case 103:
vortex.setKnockback(parseFloat(field, vortex.getKnockback()));
break;
case 105:
vortex.setMaxTargets(field.getInteger());
break;
case 109:
vortex.setPullDamage(parseFloat(field, vortex.getPullDamage()));
break;
}
}
}