mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-19 18:49:39 +00:00
Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
dbafb2cace
80 files changed
+3260
-5506
No files matched your search
@@ -38,6 +38,9 @@ dependencies {
|
||||
runtimeOnlyNonPublishable("com.github.GTNewHorizons:NotEnoughItems:2.5.4-GTNH:dev")
|
||||
runtimeOnlyNonPublishable("curse.maven:Nashorn-374413:2924946")
|
||||
|
||||
// compileOnly(files("./tools/bukkit-api/spigot-api-ONLY.jar"))
|
||||
// compileOnly(files("./tools/bukkit-api/Vault-1.4.1.jar"))
|
||||
|
||||
shadowImplementation(project.files("tools/standalone-JaninoLoader-1.0.1-ALPHA.jar"))
|
||||
annotationProcessor(project.files("tools/standalone-JaninoLoader-1.0.1-ALPHA.jar"))
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@ public abstract class RenderAbilityProjectile extends Render {
|
||||
*/
|
||||
protected void setupRenderState() {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
|
||||
GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
GL11.glEnable(GL11.GL_ALPHA_TEST);
|
||||
@@ -48,9 +49,7 @@ public abstract class RenderAbilityProjectile extends Render {
|
||||
* Restore GL state after rendering.
|
||||
*/
|
||||
protected void restoreRenderState() {
|
||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
GL11.glPopAttrib();
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
|
||||
@@ -29,10 +29,14 @@ import noppes.npcs.scripted.NpcAPI;
|
||||
import noppes.npcs.scripted.event.AbilityEvent;
|
||||
import noppes.npcs.scripted.event.player.PlayerAbilityEvent;
|
||||
|
||||
import noppes.npcs.client.gui.builder.FieldDef;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import somehussar.gui.annotationHandling.GuiEditable;
|
||||
|
||||
public abstract class Ability implements IAbility {
|
||||
|
||||
@@ -57,8 +61,8 @@ public abstract class Ability implements IAbility {
|
||||
// Timing (ticks)
|
||||
protected int cooldownTicks = 0; // Added to global cooldown after ability completes
|
||||
protected int windUpTicks = 20;
|
||||
protected int dazedTicks = 80; // Only used when interrupted during WINDUP (if interruptible)
|
||||
protected boolean syncWindupWithAnimation = true;
|
||||
protected int dazedTicks = 80; // Only used when interrupted during WINDUP (if interruptible)
|
||||
|
||||
// Interruption
|
||||
protected boolean interruptible = true;
|
||||
@@ -337,19 +341,123 @@ public abstract class Ability implements IAbility {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if this ability type has custom settings that need a Type-specific tab.
|
||||
* Override to return true if the ability has settings beyond the base Ability fields.
|
||||
* Returns the declarative field definitions for this ability's GUI.
|
||||
* Override in subclasses to declare type-specific and visual fields.
|
||||
* The GUI rendering engine in SubGuiAbilityConfig uses this list to
|
||||
* automatically build the Type and Visual tabs.
|
||||
*/
|
||||
public boolean hasTypeSettings() {
|
||||
return false;
|
||||
@SideOnly(Side.CLIENT)
|
||||
public List<FieldDef> getFieldDefinitions() {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the number of rows needed for type-specific settings in the GUI.
|
||||
* Each row is approximately 24 pixels. Used for GUI layout.
|
||||
* Returns field definitions for all base Ability fields (General, Target, Effects tabs).
|
||||
*/
|
||||
public int getTypeSettingsRowCount() {
|
||||
return 0;
|
||||
@SideOnly(Side.CLIENT)
|
||||
public List<FieldDef> getBaseFieldDefinitions() {
|
||||
List<FieldDef> defs = new ArrayList<>();
|
||||
|
||||
// General tab
|
||||
defs.add(FieldDef.stringField("gui.name", this::getName, this::setName)
|
||||
.tab("General"));
|
||||
defs.add(FieldDef.row(
|
||||
FieldDef.intField("ability.weight", this::getWeight, this::setWeight).range(1, 1000),
|
||||
FieldDef.boolField("gui.enabled", this::isEnabled, this::setEnabled)
|
||||
).tab("General"));
|
||||
defs.add(FieldDef.section("ability.section.timing").tab("General"));
|
||||
// WindUp: 3 mutually exclusive entries based on animation/sync state
|
||||
defs.add(FieldDef.intField("ability.windUpTicks", this::getRawWindUpTicks, this::setWindUpTicks)
|
||||
.tab("General").range(0, 1000)
|
||||
.visibleWhen(() -> !hasWindUpAnimation()));
|
||||
defs.add(FieldDef.row(
|
||||
FieldDef.intField("ability.windUpTicks", this::getRawWindUpTicks, this::setWindUpTicks).range(0, 1000),
|
||||
FieldDef.boolField("ability.syncWindup", this::isSyncWindupWithAnimation, this::setSyncWindupWithAnimation)
|
||||
.hover("ability.hover.sync")
|
||||
).tab("General").visibleWhen(() -> hasWindUpAnimation() && !isSyncWindupWithAnimation()));
|
||||
defs.add(FieldDef.row(
|
||||
FieldDef.labelField("ability.windUpTicks", () -> getWindUpTicks() + "t"),
|
||||
FieldDef.boolField("ability.syncWindup", this::isSyncWindupWithAnimation, this::setSyncWindupWithAnimation)
|
||||
.hover("ability.hover.sync")
|
||||
).tab("General").visibleWhen(() -> hasWindUpAnimation() && isSyncWindupWithAnimation()));
|
||||
defs.add(FieldDef.intField("ability.cooldownTicks", this::getCooldownTicks, this::setCooldownTicks)
|
||||
.tab("General").range(0, 10000));
|
||||
defs.add(FieldDef.section("ability.section.movement").tab("General"));
|
||||
defs.add(FieldDef.stringEnumField("ability.lockMovement", LockMovementType.getDisplayKeys(),
|
||||
() -> this.getLockMovement().getDisplayKey(),
|
||||
v -> {
|
||||
String[] keys = LockMovementType.getDisplayKeys();
|
||||
for (int i = 0; i < keys.length; i++) {
|
||||
if (keys[i].equals(v)) { this.setLockMovement(LockMovementType.fromOrdinal(i)); break; }
|
||||
}
|
||||
})
|
||||
.tab("General").hover("ability.hover.lockMove"));
|
||||
defs.add(FieldDef.row(
|
||||
FieldDef.boolField("ability.interruptible", this::isInterruptible, this::setInterruptible)
|
||||
.hover("ability.hover.interruptible"),
|
||||
FieldDef.intField("ability.dazedTicks", this::getDazedTicks, this::setDazedTicks)
|
||||
.range(0, 1000).visibleWhen(this::isInterruptible)
|
||||
).tab("General"));
|
||||
|
||||
// Target tab
|
||||
defs.add(FieldDef.row(
|
||||
FieldDef.intField("ability.minRange", () -> (int) getMinRange(), v -> setMinRange(v)).range(0, 100),
|
||||
FieldDef.intField("ability.maxRange", () -> (int) getMaxRange(), v -> setMaxRange(v)).range(1, 100)
|
||||
).tab("Target"));
|
||||
if (!isTargetingModeLocked()) {
|
||||
defs.add(FieldDef.enumField("ability.targetingMode", TargetingMode.class,
|
||||
this::getTargetingMode, this::setTargetingMode)
|
||||
.tab("Target").hover("ability.hover.targeting"));
|
||||
}
|
||||
|
||||
// Effects tab - Sounds
|
||||
defs.add(FieldDef.section("ability.section.sounds").tab("Effects"));
|
||||
defs.add(FieldDef.soundSubGui("ability.windUpSound", this::getWindUpSound, this::setWindUpSound)
|
||||
.tab("Effects"));
|
||||
defs.add(FieldDef.soundSubGui("ability.activeSound", this::getActiveSound, this::setActiveSound)
|
||||
.tab("Effects"));
|
||||
// Effects tab - Animations
|
||||
defs.add(FieldDef.section("ability.section.animations").tab("Effects"));
|
||||
defs.add(FieldDef.animSubGui("ability.windUpAnimation",
|
||||
this::getWindUpAnimationId, this::setWindUpAnimationId,
|
||||
this::getWindUpAnimationName, this::setWindUpAnimationName)
|
||||
.tab("Effects"));
|
||||
defs.add(FieldDef.animSubGui("ability.activeAnimation",
|
||||
this::getActiveAnimationId, this::setActiveAnimationId,
|
||||
this::getActiveAnimationName, this::setActiveAnimationName)
|
||||
.tab("Effects"));
|
||||
|
||||
// Effects tab - Telegraph
|
||||
TelegraphType tType = getTelegraphType();
|
||||
if (tType != null && tType != TelegraphType.NONE) {
|
||||
defs.add(FieldDef.section("ability.section.telegraph").tab("Effects")
|
||||
.hover("telegraph." + tType.name().toLowerCase()));
|
||||
defs.add(FieldDef.boolField("ability.showTelegraph", this::isShowTelegraph, this::setShowTelegraph)
|
||||
.tab("Effects").hover("ability.hover.showTelegraph"));
|
||||
defs.add(FieldDef.colorSubGui("ability.windUpColor", this::getWindUpColor, this::setWindUpColor)
|
||||
.tab("Effects").visibleWhen(this::isShowTelegraph));
|
||||
defs.add(FieldDef.colorSubGui("ability.activeColor", this::getActiveColor, this::setActiveColor)
|
||||
.tab("Effects").visibleWhen(this::isShowTelegraph));
|
||||
}
|
||||
|
||||
return defs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns ALL field definitions: base (General/Target/Effects) + type-specific (Type/Visual).
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public final List<FieldDef> getAllFieldDefinitions() {
|
||||
List<FieldDef> all = new ArrayList<>(getBaseFieldDefinitions());
|
||||
List<FieldDef> typeDefs = getFieldDefinitions();
|
||||
// Default tab for type-specific fields that don't explicitly set one
|
||||
for (FieldDef def : typeDefs) {
|
||||
if (def.getTab() == null) {
|
||||
def.tab("Type");
|
||||
}
|
||||
}
|
||||
all.addAll(typeDefs);
|
||||
return all;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -805,6 +913,7 @@ public abstract class Ability implements IAbility {
|
||||
nbt.setFloat("maxRange", maxRange);
|
||||
nbt.setInteger("cooldown", cooldownTicks);
|
||||
nbt.setInteger("windUp", windUpTicks);
|
||||
nbt.setBoolean("syncWindup", syncWindupWithAnimation);
|
||||
nbt.setInteger("recovery", dazedTicks);
|
||||
nbt.setBoolean("interruptible", interruptible);
|
||||
nbt.setInteger("lockMovement", lockMovement.ordinal());
|
||||
@@ -854,6 +963,7 @@ public abstract class Ability implements IAbility {
|
||||
maxRange = nbt.getFloat("maxRange");
|
||||
cooldownTicks = nbt.getInteger("cooldown");
|
||||
windUpTicks = nbt.getInteger("windUp");
|
||||
syncWindupWithAnimation = !nbt.hasKey("syncWindup") || nbt.getBoolean("syncWindup");
|
||||
dazedTicks = nbt.getInteger("recovery");
|
||||
interruptible = nbt.getBoolean("interruptible");
|
||||
lockMovement = LockMovementType.fromOrdinal(nbt.getInteger("lockMovement"));
|
||||
@@ -974,13 +1084,29 @@ public abstract class Ability implements IAbility {
|
||||
}
|
||||
|
||||
public int getWindUpTicks() {
|
||||
return this.calculateWindupFromAnimation();
|
||||
return calculateWindupFromAnimation();
|
||||
}
|
||||
|
||||
public int getRawWindUpTicks() {
|
||||
return windUpTicks;
|
||||
}
|
||||
|
||||
public void setWindUpTicks(int windUpTicks) {
|
||||
this.windUpTicks = Math.max(0, windUpTicks);
|
||||
}
|
||||
|
||||
public boolean isSyncWindupWithAnimation() {
|
||||
return syncWindupWithAnimation;
|
||||
}
|
||||
|
||||
public boolean hasWindUpAnimation() {
|
||||
return (windUpAnimationName != null && !windUpAnimationName.isEmpty()) || windUpAnimationId >= 0;
|
||||
}
|
||||
|
||||
public void setSyncWindupWithAnimation(boolean syncWindupWithAnimation) {
|
||||
this.syncWindupWithAnimation = syncWindupWithAnimation;
|
||||
}
|
||||
|
||||
public int getDazedTicks() {
|
||||
return dazedTicks;
|
||||
}
|
||||
@@ -989,14 +1115,6 @@ public abstract class Ability implements IAbility {
|
||||
this.dazedTicks = Math.max(0, dazedTicks);
|
||||
}
|
||||
|
||||
public boolean isSyncWindupWithAnimation() {
|
||||
return syncWindupWithAnimation;
|
||||
}
|
||||
|
||||
public void setSyncWindupWithAnimation(boolean syncWindupWithAnimation) {
|
||||
this.syncWindupWithAnimation = syncWindupWithAnimation;
|
||||
}
|
||||
|
||||
public boolean isInterruptible() {
|
||||
return interruptible;
|
||||
}
|
||||
|
||||
@@ -38,6 +38,13 @@ public class AbilityEffect {
|
||||
return potionId;
|
||||
}
|
||||
|
||||
public static String[] getLangKeys() {
|
||||
EffectType[] types = values();
|
||||
String[] keys = new String[types.length];
|
||||
for (int i = 0; i < types.length; i++) keys[i] = types[i].langKey;
|
||||
return keys;
|
||||
}
|
||||
|
||||
public static EffectType fromOrdinal(int ordinal) {
|
||||
EffectType[] values = values();
|
||||
if (ordinal >= 0 && ordinal < values.length) {
|
||||
|
||||
@@ -45,4 +45,17 @@ public enum AnchorPoint {
|
||||
}
|
||||
return names;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
switch (this) {
|
||||
case FRONT: return "ability.anchor.front";
|
||||
case CENTER: return "ability.anchor.center";
|
||||
case RIGHT_HAND: return "ability.anchor.rightHand";
|
||||
case LEFT_HAND: return "ability.anchor.leftHand";
|
||||
case ABOVE_HEAD: return "ability.anchor.aboveHead";
|
||||
case CHEST: return "ability.anchor.chest";
|
||||
default: return name();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -22,5 +22,16 @@ public enum TargetingMode {
|
||||
/**
|
||||
* AOE centered on target
|
||||
*/
|
||||
AOE_TARGET
|
||||
AOE_TARGET;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
switch (this) {
|
||||
case AGGRO_TARGET: return "ability.target.aggro_target";
|
||||
case SELF: return "ability.target.self";
|
||||
case AOE_SELF: return "ability.target.aoe_self";
|
||||
case AOE_TARGET: return "ability.target.aoe_target";
|
||||
default: return name();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,180 @@
|
||||
package kamkeel.npcs.controllers.data.ability.gui;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import kamkeel.npcs.controllers.data.ability.AbilityEffect;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import noppes.npcs.client.gui.builder.FieldDef;
|
||||
import noppes.npcs.client.gui.builder.FieldType;
|
||||
import noppes.npcs.client.gui.builder.GuiFieldBuilder;
|
||||
import noppes.npcs.client.gui.util.GuiNPCInterface;
|
||||
import noppes.npcs.client.gui.util.GuiNpcButton;
|
||||
import noppes.npcs.client.gui.util.GuiNpcLabel;
|
||||
import noppes.npcs.client.gui.util.GuiNpcTextField;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Ability-specific extension of {@link GuiFieldBuilder} that handles
|
||||
* the EFFECTS_LIST field type.
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class AbilityFieldBuilder extends GuiFieldBuilder {
|
||||
|
||||
// Effects list metadata: widgetId -> [effectIndex, action]
|
||||
// action: 0=type, 1=duration(text), 2=amp, 3=delete, 4=add
|
||||
private final Map<Integer, int[]> effectWidgetMeta = new HashMap<>();
|
||||
|
||||
public AbilityFieldBuilder(GuiNPCInterface parent, FontRenderer fontRenderer) {
|
||||
super(parent, fontRenderer);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int build(List<FieldDef> fields) {
|
||||
effectWidgetMeta.clear();
|
||||
return super.build(fields);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int buildField(FieldDef def, int y, List<FieldDef> fields, int index) {
|
||||
if (def.getType() == FieldType.EFFECTS_LIST) {
|
||||
return renderEffectsList(def, y);
|
||||
}
|
||||
return -1; // not handled
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private int renderEffectsList(FieldDef def, int y) {
|
||||
// Section header
|
||||
y += 3;
|
||||
sw.addLabel(new GuiNpcLabel(labelId++, def.getLabel(), colLLabel, y + 2, 0xFFFF55));
|
||||
y += 15;
|
||||
|
||||
List<AbilityEffect> effects = (List<AbilityEffect>) def.getValue();
|
||||
if (effects == null) effects = new ArrayList<>();
|
||||
|
||||
String[] typeNames = AbilityEffect.EffectType.getLangKeys();
|
||||
String[] ampValues = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10"};
|
||||
|
||||
for (int e = 0; e < effects.size() && e < 5; e++) {
|
||||
AbilityEffect effect = effects.get(e);
|
||||
|
||||
// Type selector button
|
||||
int typeIdx = effect.getType().ordinal();
|
||||
GuiNpcButton typeBtn = new GuiNpcButton(widgetId, colLLabel, y, 100, 20, typeNames, typeIdx);
|
||||
sw.addButton(typeBtn);
|
||||
buttonFieldMap.put(widgetId, def);
|
||||
effectWidgetMeta.put(widgetId, new int[]{e, 0});
|
||||
widgetId++;
|
||||
|
||||
// Duration text field
|
||||
GuiNpcTextField durField = new GuiNpcTextField(widgetId, parent, fontRenderer,
|
||||
colLLabel + 104, y, 50, 20, String.valueOf(effect.getDurationTicks()));
|
||||
durField.setIntegersOnly();
|
||||
durField.setMinMaxDefault(1, 12000, 60);
|
||||
sw.addTextField(durField);
|
||||
textFieldMap.put(widgetId, def);
|
||||
effectWidgetMeta.put(widgetId, new int[]{e, 1});
|
||||
widgetId++;
|
||||
|
||||
// Amplifier selector (0-10)
|
||||
GuiNpcButton ampBtn = new GuiNpcButton(widgetId, colLLabel + 158, y, 40, 20, ampValues, effect.getAmplifier());
|
||||
sw.addButton(ampBtn);
|
||||
buttonFieldMap.put(widgetId, def);
|
||||
effectWidgetMeta.put(widgetId, new int[]{e, 2});
|
||||
widgetId++;
|
||||
|
||||
// Delete button
|
||||
GuiNpcButton delBtn = new GuiNpcButton(clearId, colLLabel + 202, y, 20, 20, "X");
|
||||
sw.addButton(delBtn);
|
||||
clearFieldMap.put(clearId, def);
|
||||
effectWidgetMeta.put(clearId, new int[]{e, 3});
|
||||
clearId++;
|
||||
|
||||
y += rowHeight;
|
||||
}
|
||||
|
||||
// Add button (if < 5 effects)
|
||||
if (effects.size() < 5) {
|
||||
GuiNpcButton addBtn = new GuiNpcButton(widgetId, colLLabel, y, 50, 20, "gui.add");
|
||||
sw.addButton(addBtn);
|
||||
buttonFieldMap.put(widgetId, def);
|
||||
effectWidgetMeta.put(widgetId, new int[]{effects.size(), 4});
|
||||
widgetId++;
|
||||
clearId++;
|
||||
y += rowHeight;
|
||||
}
|
||||
|
||||
return y;
|
||||
}
|
||||
|
||||
// ═══════════════════════════════════════════════════════════════════
|
||||
// EVENT HANDLING OVERRIDES
|
||||
// ═══════════════════════════════════════════════════════════════════
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public boolean handleButtonEvent(int buttonId, GuiButton button) {
|
||||
// Check effects list buttons via metadata
|
||||
int[] meta = effectWidgetMeta.get(buttonId);
|
||||
if (meta != null) {
|
||||
FieldDef def = buttonFieldMap.get(buttonId);
|
||||
if (def == null) def = clearFieldMap.get(buttonId);
|
||||
if (def != null && def.getType() == FieldType.EFFECTS_LIST) {
|
||||
List<AbilityEffect> effects = (List<AbilityEffect>) def.getValue();
|
||||
if (effects == null) return false;
|
||||
int effectIdx = meta[0];
|
||||
int action = meta[1];
|
||||
|
||||
switch (action) {
|
||||
case 0: // Type changed
|
||||
if (effectIdx < effects.size()) {
|
||||
effects.get(effectIdx).setType(AbilityEffect.EffectType.fromOrdinal(((GuiNpcButton) button).getValue()));
|
||||
}
|
||||
return true;
|
||||
case 2: // Amp changed
|
||||
if (effectIdx < effects.size()) {
|
||||
effects.get(effectIdx).setAmplifier(((GuiNpcButton) button).getValue());
|
||||
}
|
||||
return true;
|
||||
case 3: // Delete
|
||||
if (effectIdx < effects.size()) {
|
||||
effects.remove(effectIdx);
|
||||
}
|
||||
return true;
|
||||
case 4: // Add
|
||||
if (effects.size() < 5) {
|
||||
effects.add(new AbilityEffect(AbilityEffect.EffectType.SLOWNESS, 60, 0));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return super.handleButtonEvent(buttonId, button);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public boolean handleTextFieldEvent(int textFieldId, GuiNpcTextField field) {
|
||||
int[] meta = effectWidgetMeta.get(textFieldId);
|
||||
if (meta != null && meta[1] == 1) { // duration field
|
||||
FieldDef def = textFieldMap.get(textFieldId);
|
||||
if (def != null && def.getType() == FieldType.EFFECTS_LIST) {
|
||||
List<AbilityEffect> effects = (List<AbilityEffect>) def.getValue();
|
||||
if (effects != null && meta[0] < effects.size()) {
|
||||
effects.get(meta[0]).setDurationTicks(field.getInteger());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return super.handleTextFieldEvent(textFieldId, field);
|
||||
}
|
||||
|
||||
public Map<Integer, int[]> getEffectWidgetMeta() { return effectWidgetMeta; }
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package kamkeel.npcs.controllers.data.ability.gui;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import kamkeel.npcs.controllers.data.ability.AbilityEffect;
|
||||
import noppes.npcs.client.gui.builder.FieldDef;
|
||||
import noppes.npcs.client.gui.builder.FieldType;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
/**
|
||||
* Ability-specific FieldDef factories. These create FieldDef instances
|
||||
* with types that require ability-specific rendering (e.g. EFFECTS_LIST).
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class AbilityFieldDefs {
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static FieldDef effectsListField(String label, Supplier<List<AbilityEffect>> getter, Consumer<List<AbilityEffect>> setter) {
|
||||
return FieldDef.custom(label, FieldType.EFFECTS_LIST,
|
||||
() -> getter.get(),
|
||||
v -> setter.accept((List<AbilityEffect>) v));
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,8 @@ import kamkeel.npcs.controllers.data.ability.AnchorPoint;
|
||||
import kamkeel.npcs.controllers.data.ability.LockMovementType;
|
||||
import kamkeel.npcs.controllers.data.ability.TargetingMode;
|
||||
import kamkeel.npcs.controllers.data.ability.data.*;
|
||||
import noppes.npcs.client.gui.builder.FieldDef;
|
||||
import kamkeel.npcs.controllers.data.ability.gui.AbilityFieldDefs;
|
||||
import kamkeel.npcs.controllers.data.telegraph.Telegraph;
|
||||
import kamkeel.npcs.controllers.data.telegraph.TelegraphInstance;
|
||||
import kamkeel.npcs.controllers.data.telegraph.TelegraphType;
|
||||
@@ -17,12 +19,12 @@ import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
import noppes.npcs.client.gui.advanced.SubGuiAbilityConfig;
|
||||
import noppes.npcs.client.gui.advanced.ability.SubGuiAbilityBeamDual;
|
||||
import noppes.npcs.client.gui.util.IAbilityConfigCallback;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
import noppes.npcs.util.ValueUtil;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class AbilityBeamDual extends Ability {
|
||||
private float beamWidth = 0.4f;
|
||||
private float headSize = 0.6f;
|
||||
@@ -64,17 +66,6 @@ public class AbilityBeamDual extends Ability {
|
||||
this.activeAnimationName = "Ability_BeamDual_Active";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTypeSettings() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public SubGuiAbilityConfig createConfigGui(IAbilityConfigCallback callback) {
|
||||
return new SubGuiAbilityBeamDual(this, callback);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTargetingModeLocked() {
|
||||
return true;
|
||||
@@ -384,6 +375,119 @@ public class AbilityBeamDual extends Ability {
|
||||
public void setAnchorPoint(int beam, int point) { getAnchorData(beam).anchorPoint = AnchorPoint.fromOrdinal(point); }
|
||||
public void setAnchorPoint(int point) { getAnchorData(0).anchorPoint = AnchorPoint.fromOrdinal(point); }
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public List<FieldDef> getFieldDefinitions() {
|
||||
return Arrays.asList(
|
||||
// Type tab
|
||||
FieldDef.row(
|
||||
FieldDef.floatField("enchantment.damage", this::getDamage, this::setDamage),
|
||||
FieldDef.floatField("stats.speed", this::getSpeed, this::setSpeed)
|
||||
),
|
||||
FieldDef.floatField("ability.knockback", this::getKnockback, this::setKnockback),
|
||||
FieldDef.section("ability.section.beam"),
|
||||
FieldDef.row(
|
||||
FieldDef.floatField("ability.beamWidth", this::getBeamWidth, this::setBeamWidth),
|
||||
FieldDef.floatField("ability.headSize", this::getHeadSize, this::setHeadSize)
|
||||
),
|
||||
FieldDef.row(
|
||||
FieldDef.floatField("ability.maxDistance", this::getMaxDistance, this::setMaxDistance),
|
||||
FieldDef.intField("ability.lifetime", this::getMaxLifetime, this::setMaxLifetime)
|
||||
),
|
||||
FieldDef.section("ability.section.dual"),
|
||||
FieldDef.boolField("ability.dualFire", this::isDualFire, this::setDualFire),
|
||||
FieldDef.intField("ability.dualFireDelay", this::getDualFireDelay, this::setDualFireDelay)
|
||||
.visibleWhen(this::isDualFire),
|
||||
FieldDef.section("ability.section.homing"),
|
||||
FieldDef.boolField("gui.enabled", this::isHoming, this::setHoming)
|
||||
.hover("ability.hover.homing"),
|
||||
FieldDef.row(
|
||||
FieldDef.floatField("gui.strength", this::getHomingStrength, this::setHomingStrength)
|
||||
.visibleWhen(this::isHoming),
|
||||
FieldDef.floatField("gui.range", this::getHomingRange, this::setHomingRange)
|
||||
.visibleWhen(this::isHoming)
|
||||
),
|
||||
FieldDef.section("ability.section.explosive"),
|
||||
FieldDef.boolField("gui.enabled", this::isExplosive, this::setExplosive)
|
||||
.hover("ability.hover.explosive"),
|
||||
FieldDef.floatField("gui.radius", this::getExplosionRadius, this::setExplosionRadius)
|
||||
.visibleWhen(this::isExplosive),
|
||||
AbilityFieldDefs.effectsListField("ability.effects", this::getEffects, this::setEffects),
|
||||
// Visual tab - Beam 1
|
||||
FieldDef.enumField("ability.anchorPoint", AnchorPoint.class,
|
||||
() -> getAnchorPointEnum(0), v -> setAnchorPointEnum(0, v))
|
||||
.tab("ability.tab.visual"),
|
||||
FieldDef.section("ability.section.beam1").tab("ability.tab.visual"),
|
||||
FieldDef.colorSubGui("ability.innerColor",
|
||||
() -> getInnerColor(0), v -> setInnerColor(0, v))
|
||||
.tab("ability.tab.visual"),
|
||||
FieldDef.boolField("ability.outerEnabled",
|
||||
() -> isOuterColorEnabled(0), v -> setOuterColorEnabled(0, v))
|
||||
.tab("ability.tab.visual"),
|
||||
FieldDef.colorSubGui("ability.outerColor",
|
||||
() -> getOuterColor(0), v -> setOuterColor(0, v))
|
||||
.tab("ability.tab.visual").visibleWhen(() -> isOuterColorEnabled(0)),
|
||||
FieldDef.row(
|
||||
FieldDef.floatField("ability.outerWidth",
|
||||
() -> getOuterColorWidth(0), v -> setOuterColorWidth(0, v))
|
||||
.visibleWhen(() -> isOuterColorEnabled(0)),
|
||||
FieldDef.floatField("ability.outerAlpha",
|
||||
() -> getOuterColorAlpha(0), v -> setOuterColorAlpha(0, v))
|
||||
.range(0, 1).visibleWhen(() -> isOuterColorEnabled(0))
|
||||
).tab("ability.tab.visual"),
|
||||
FieldDef.floatField("ability.rotationSpeed",
|
||||
() -> getRotationSpeed(0), v -> setRotationSpeed(0, v))
|
||||
.tab("ability.tab.visual"),
|
||||
FieldDef.boolField("ability.lightning",
|
||||
() -> hasLightningEffect(0), v -> setLightningEffect(0, v))
|
||||
.tab("ability.tab.visual"),
|
||||
FieldDef.row(
|
||||
FieldDef.floatField("gui.density",
|
||||
() -> getLightningDensity(0), v -> setLightningDensity(0, v))
|
||||
.range(0.01f, 5.0f).visibleWhen(() -> hasLightningEffect(0)),
|
||||
FieldDef.floatField("gui.radius",
|
||||
() -> getLightningRadius(0), v -> setLightningRadius(0, v))
|
||||
.range(0.1f, 10.0f).visibleWhen(() -> hasLightningEffect(0))
|
||||
).tab("ability.tab.visual"),
|
||||
// Visual tab - Beam 2
|
||||
FieldDef.enumField("ability.anchorPoint", AnchorPoint.class,
|
||||
() -> getAnchorPointEnum(1), v -> setAnchorPointEnum(1, v))
|
||||
.tab("ability.tab.visual"),
|
||||
FieldDef.section("ability.section.beam2").tab("ability.tab.visual"),
|
||||
FieldDef.colorSubGui("ability.innerColor",
|
||||
() -> getInnerColor(1), v -> setInnerColor(1, v))
|
||||
.tab("ability.tab.visual"),
|
||||
FieldDef.boolField("ability.outerEnabled",
|
||||
() -> isOuterColorEnabled(1), v -> setOuterColorEnabled(1, v))
|
||||
.tab("ability.tab.visual"),
|
||||
FieldDef.colorSubGui("ability.outerColor",
|
||||
() -> getOuterColor(1), v -> setOuterColor(1, v))
|
||||
.tab("ability.tab.visual").visibleWhen(() -> isOuterColorEnabled(1)),
|
||||
FieldDef.row(
|
||||
FieldDef.floatField("ability.outerWidth",
|
||||
() -> getOuterColorWidth(1), v -> setOuterColorWidth(1, v))
|
||||
.visibleWhen(() -> isOuterColorEnabled(1)),
|
||||
FieldDef.floatField("ability.outerAlpha",
|
||||
() -> getOuterColorAlpha(1), v -> setOuterColorAlpha(1, v))
|
||||
.range(0, 1).visibleWhen(() -> isOuterColorEnabled(1))
|
||||
).tab("ability.tab.visual"),
|
||||
FieldDef.floatField("ability.rotationSpeed",
|
||||
() -> getRotationSpeed(1), v -> setRotationSpeed(1, v))
|
||||
.tab("ability.tab.visual"),
|
||||
FieldDef.boolField("ability.lightning",
|
||||
() -> hasLightningEffect(1), v -> setLightningEffect(1, v))
|
||||
.tab("ability.tab.visual"),
|
||||
FieldDef.row(
|
||||
FieldDef.floatField("gui.density",
|
||||
() -> getLightningDensity(1), v -> setLightningDensity(1, v))
|
||||
.range(0.01f, 5.0f).visibleWhen(() -> hasLightningEffect(1)),
|
||||
FieldDef.floatField("gui.radius",
|
||||
() -> getLightningRadius(1), v -> setLightningRadius(1, v))
|
||||
.range(0.1f, 10.0f).visibleWhen(() -> hasLightningEffect(1))
|
||||
).tab("ability.tab.visual")
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Entity createPreviewEntity(EntityNPCInterface npc) {
|
||||
|
||||
@@ -14,13 +14,13 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
import noppes.npcs.client.gui.advanced.SubGuiAbilityConfig;
|
||||
import noppes.npcs.client.gui.advanced.ability.SubGuiAbilityCharge;
|
||||
import noppes.npcs.client.gui.util.IAbilityConfigCallback;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
import noppes.npcs.client.gui.builder.FieldDef;
|
||||
import kamkeel.npcs.controllers.data.ability.gui.AbilityFieldDefs;
|
||||
import noppes.npcs.api.ability.type.IAbilityCharge;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
@@ -58,17 +58,6 @@ public class AbilityCharge extends Ability implements IAbilityCharge {
|
||||
this.activeSound = "mob.zombie.attack";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTypeSettings() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public SubGuiAbilityConfig createConfigGui(IAbilityConfigCallback callback) {
|
||||
return new SubGuiAbilityCharge(this, callback);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTargetingModeLocked() {
|
||||
return true;
|
||||
@@ -405,4 +394,20 @@ public class AbilityCharge extends Ability implements IAbilityCharge {
|
||||
public void setHitWidth(float hitWidth) {
|
||||
this.hitWidth = hitWidth;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public List<FieldDef> getFieldDefinitions() {
|
||||
return Arrays.asList(
|
||||
FieldDef.row(
|
||||
FieldDef.floatField("enchantment.damage", this::getDamage, this::setDamage),
|
||||
FieldDef.floatField("ability.chargeSpeed", this::getChargeSpeed, this::setChargeSpeed)
|
||||
),
|
||||
FieldDef.row(
|
||||
FieldDef.floatField("ability.knockback", this::getKnockback, this::setKnockback),
|
||||
FieldDef.floatField("ability.hitWidth", this::getHitWidth, this::setHitWidth)
|
||||
),
|
||||
AbilityFieldDefs.effectsListField("ability.effects", this::getEffects, this::setEffects)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,5 @@
|
||||
package kamkeel.npcs.controllers.data.ability.type;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import kamkeel.npcs.controllers.data.ability.Ability;
|
||||
import kamkeel.npcs.controllers.data.ability.LockMovementType;
|
||||
import kamkeel.npcs.controllers.data.ability.TargetingMode;
|
||||
@@ -11,13 +9,17 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.world.World;
|
||||
import noppes.npcs.client.gui.advanced.SubGuiAbilityConfig;
|
||||
import noppes.npcs.client.gui.advanced.ability.SubGuiAbilityCutter;
|
||||
import noppes.npcs.client.gui.util.IAbilityConfigCallback;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
import noppes.npcs.api.ability.type.IAbilityCutter;
|
||||
|
||||
import noppes.npcs.client.gui.builder.FieldDef;
|
||||
import kamkeel.npcs.controllers.data.ability.gui.AbilityFieldDefs;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
@@ -31,7 +33,16 @@ public class AbilityCutter extends Ability implements IAbilityCutter {
|
||||
|
||||
public enum SweepMode {
|
||||
SWIPE,
|
||||
SPIN
|
||||
SPIN;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
switch (this) {
|
||||
case SWIPE: return "ability.sweep.swipe";
|
||||
case SPIN: return "ability.sweep.spin";
|
||||
default: return name();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private float arcAngle = 90.0f;
|
||||
@@ -65,17 +76,6 @@ public class AbilityCutter extends Ability implements IAbilityCutter {
|
||||
this.activeAnimationName = "Ability_Cutter_Active";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTypeSettings() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public SubGuiAbilityConfig createConfigGui(IAbilityConfigCallback callback) {
|
||||
return new SubGuiAbilityCutter(this, callback);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTargetingModeLocked() {
|
||||
return true;
|
||||
@@ -313,4 +313,30 @@ public class AbilityCutter extends Ability implements IAbilityCutter {
|
||||
public float getCurrentRotation() {
|
||||
return currentRotation;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public List<FieldDef> getFieldDefinitions() {
|
||||
return Arrays.asList(
|
||||
FieldDef.row(
|
||||
FieldDef.floatField("enchantment.damage", this::getDamage, this::setDamage),
|
||||
FieldDef.floatField("gui.range", this::getRange, this::setRange)
|
||||
),
|
||||
FieldDef.floatField("ability.knockback", this::getKnockback, this::setKnockback),
|
||||
FieldDef.section("ability.section.sweep"),
|
||||
FieldDef.enumField("ability.sweepMode", SweepMode.class, this::getSweepModeEnum, this::setSweepModeEnum)
|
||||
.hover("ability.hover.sweepMode"),
|
||||
FieldDef.row(
|
||||
FieldDef.floatField("ability.arcAngle", this::getArcAngle, this::setArcAngle),
|
||||
FieldDef.floatField("ability.innerRadius", this::getInnerRadius, this::setInnerRadius)
|
||||
),
|
||||
FieldDef.floatField("ability.sweepSpeed", this::getSweepSpeed, this::setSweepSpeed),
|
||||
FieldDef.intField("ability.spinDuration", this::getSpinDurationTicks, this::setSpinDurationTicks)
|
||||
.range(1, 1000)
|
||||
.visibleWhen(() -> this.getSweepModeEnum() == SweepMode.SPIN),
|
||||
FieldDef.boolField("ability.piercing", this::isPiercing, this::setPiercing)
|
||||
.hover("ability.hover.piercing"),
|
||||
AbilityFieldDefs.effectsListField("ability.effects", this::getEffects, this::setEffects)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -12,13 +12,13 @@ import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
import noppes.npcs.client.gui.advanced.SubGuiAbilityConfig;
|
||||
import noppes.npcs.client.gui.advanced.ability.SubGuiAbilityDash;
|
||||
import noppes.npcs.client.gui.util.IAbilityConfigCallback;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
import noppes.npcs.client.gui.builder.FieldDef;
|
||||
import noppes.npcs.api.ability.type.IAbilityDash;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
@@ -32,7 +32,16 @@ public class AbilityDash extends Ability implements IAbilityDash {
|
||||
*/
|
||||
public enum DashMode {
|
||||
AGGRESSIVE,
|
||||
DEFENSIVE
|
||||
DEFENSIVE;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
switch (this) {
|
||||
case AGGRESSIVE: return "ability.dash.aggressive";
|
||||
case DEFENSIVE: return "ability.dash.defensive";
|
||||
default: return name();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -101,18 +110,6 @@ public class AbilityDash extends Ability implements IAbilityDash {
|
||||
this.activeSound = "mob.endermen.portal";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTypeSettings() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public SubGuiAbilityConfig createConfigGui(
|
||||
IAbilityConfigCallback callback) {
|
||||
return new SubGuiAbilityDash(this, callback);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTargetingModeLocked() {
|
||||
return true;
|
||||
@@ -351,4 +348,17 @@ public class AbilityDash extends Ability implements IAbilityDash {
|
||||
public DashDirection getChosenDirection() {
|
||||
return chosenDirection;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public List<FieldDef> getFieldDefinitions() {
|
||||
return Arrays.asList(
|
||||
FieldDef.enumField("ability.dashMode", DashMode.class, this::getDashModeEnum, this::setDashModeEnum)
|
||||
.hover("ability.hover.dashMode"),
|
||||
FieldDef.row(
|
||||
FieldDef.floatField("ability.dashDistance", this::getDashDistance, this::setDashDistance),
|
||||
FieldDef.floatField("ability.dashSpeed", this::getDashSpeed, this::setDashSpeed)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -17,10 +17,12 @@ import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
import noppes.npcs.client.gui.advanced.SubGuiAbilityConfig;
|
||||
import noppes.npcs.client.gui.advanced.ability.SubGuiAbilityDisc;
|
||||
import noppes.npcs.client.gui.util.IAbilityConfigCallback;
|
||||
import noppes.npcs.client.gui.builder.FieldDef;
|
||||
import kamkeel.npcs.controllers.data.ability.gui.AbilityFieldDefs;
|
||||
import noppes.npcs.api.ability.type.IAbilityDisc;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
/**
|
||||
@@ -64,17 +66,6 @@ public class AbilityDisc extends Ability implements IAbilityDisc {
|
||||
this.activeAnimationName = "Ability_Disc_Active";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTypeSettings() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public SubGuiAbilityConfig createConfigGui(IAbilityConfigCallback callback) {
|
||||
return new SubGuiAbilityDisc(this, callback);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTargetingModeLocked() {
|
||||
return true;
|
||||
@@ -279,4 +270,69 @@ public class AbilityDisc extends Ability implements IAbilityDisc {
|
||||
public int getPreviewActiveDuration() {
|
||||
return lifespanData.maxLifetime > 0 ? Math.min(lifespanData.maxLifetime, 100) : 100;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public List<FieldDef> getFieldDefinitions() {
|
||||
return Arrays.asList(
|
||||
// Type tab
|
||||
FieldDef.row(
|
||||
FieldDef.floatField("enchantment.damage", this::getDamage, this::setDamage),
|
||||
FieldDef.floatField("stats.speed", this::getSpeed, this::setSpeed)
|
||||
),
|
||||
FieldDef.floatField("ability.knockback", this::getKnockback, this::setKnockback),
|
||||
FieldDef.section("ability.section.disc"),
|
||||
FieldDef.row(
|
||||
FieldDef.floatField("gui.radius", this::getDiscRadius, this::setDiscRadius),
|
||||
FieldDef.floatField("gui.thickness", this::getDiscThickness, this::setDiscThickness)
|
||||
),
|
||||
FieldDef.row(
|
||||
FieldDef.floatField("ability.maxDistance", this::getMaxDistance, this::setMaxDistance),
|
||||
FieldDef.intField("ability.lifetime", this::getMaxLifetime, this::setMaxLifetime)
|
||||
),
|
||||
FieldDef.section("ability.section.homing"),
|
||||
FieldDef.boolField("gui.enabled", this::isHoming, this::setHoming)
|
||||
.hover("ability.hover.homing"),
|
||||
FieldDef.floatField("gui.strength", this::getHomingStrength, this::setHomingStrength)
|
||||
.visibleWhen(this::isHoming),
|
||||
FieldDef.section("ability.section.boomerang"),
|
||||
FieldDef.boolField("gui.enabled", this::isBoomerang, this::setBoomerang)
|
||||
.hover("ability.hover.boomerang"),
|
||||
FieldDef.intField("gui.delay", this::getBoomerangDelay, this::setBoomerangDelay)
|
||||
.visibleWhen(this::isBoomerang),
|
||||
FieldDef.section("ability.section.explosive"),
|
||||
FieldDef.boolField("gui.enabled", this::isExplosive, this::setExplosive)
|
||||
.hover("ability.hover.explosive"),
|
||||
FieldDef.floatField("gui.radius", this::getExplosionRadius, this::setExplosionRadius)
|
||||
.visibleWhen(this::isExplosive),
|
||||
AbilityFieldDefs.effectsListField("ability.effects", this::getEffects, this::setEffects),
|
||||
// Visual tab
|
||||
FieldDef.enumField("ability.anchorPoint", AnchorPoint.class, this::getAnchorPointEnum, this::setAnchorPointEnum)
|
||||
.tab("ability.tab.visual"),
|
||||
FieldDef.section("ability.section.colors").tab("ability.tab.visual"),
|
||||
FieldDef.colorSubGui("ability.innerColor", this::getInnerColor, this::setInnerColor)
|
||||
.tab("ability.tab.visual"),
|
||||
FieldDef.boolField("ability.outerEnabled", this::isOuterColorEnabled, this::setOuterColorEnabled)
|
||||
.tab("ability.tab.visual"),
|
||||
FieldDef.colorSubGui("ability.outerColor", this::getOuterColor, this::setOuterColor)
|
||||
.tab("ability.tab.visual").visibleWhen(this::isOuterColorEnabled),
|
||||
FieldDef.row(
|
||||
FieldDef.floatField("ability.outerWidth", this::getOuterColorWidth, this::setOuterColorWidth)
|
||||
.visibleWhen(this::isOuterColorEnabled),
|
||||
FieldDef.floatField("ability.outerAlpha", this::getOuterColorAlpha, this::setOuterColorAlpha)
|
||||
.range(0, 1).visibleWhen(this::isOuterColorEnabled)
|
||||
).tab("ability.tab.visual"),
|
||||
FieldDef.section("ability.section.effects").tab("ability.tab.visual"),
|
||||
FieldDef.floatField("ability.rotationSpeed", this::getRotationSpeed, this::setRotationSpeed)
|
||||
.tab("ability.tab.visual"),
|
||||
FieldDef.boolField("ability.lightning", this::hasLightningEffect, this::setLightningEffect)
|
||||
.tab("ability.tab.visual"),
|
||||
FieldDef.row(
|
||||
FieldDef.floatField("gui.density", this::getLightningDensity, this::setLightningDensity)
|
||||
.range(0.01f, 5.0f).visibleWhen(this::hasLightningEffect),
|
||||
FieldDef.floatField("gui.radius", this::getLightningRadius, this::setLightningRadius)
|
||||
.range(0.1f, 10.0f).visibleWhen(this::hasLightningEffect)
|
||||
).tab("ability.tab.visual")
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,8 @@ import kamkeel.npcs.controllers.data.ability.AnchorPoint;
|
||||
import kamkeel.npcs.controllers.data.ability.LockMovementType;
|
||||
import kamkeel.npcs.controllers.data.ability.TargetingMode;
|
||||
import kamkeel.npcs.controllers.data.ability.data.*;
|
||||
import noppes.npcs.client.gui.builder.FieldDef;
|
||||
import kamkeel.npcs.controllers.data.ability.gui.AbilityFieldDefs;
|
||||
import kamkeel.npcs.controllers.data.telegraph.Telegraph;
|
||||
import kamkeel.npcs.controllers.data.telegraph.TelegraphInstance;
|
||||
import kamkeel.npcs.controllers.data.telegraph.TelegraphType;
|
||||
@@ -17,12 +19,12 @@ import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
import noppes.npcs.client.gui.advanced.SubGuiAbilityConfig;
|
||||
import noppes.npcs.client.gui.advanced.ability.SubGuiAbilityDiscDual;
|
||||
import noppes.npcs.client.gui.util.IAbilityConfigCallback;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
import noppes.npcs.util.ValueUtil;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class AbilityDiscDual extends Ability {
|
||||
|
||||
// Disc geometry
|
||||
@@ -34,7 +36,7 @@ public class AbilityDiscDual extends Ability {
|
||||
private int boomerangDelay = 40;
|
||||
|
||||
// Dual properties
|
||||
private boolean dualFire= true;
|
||||
private boolean dualFire = true;
|
||||
private int dualFireDelay = 10;
|
||||
|
||||
// Energy data classes
|
||||
@@ -72,17 +74,6 @@ public class AbilityDiscDual extends Ability {
|
||||
this.activeAnimationName = "Ability_DiscDual_Active";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTypeSettings() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public SubGuiAbilityConfig createConfigGui(IAbilityConfigCallback callback) {
|
||||
return new SubGuiAbilityDiscDual(this, callback);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTargetingModeLocked() {
|
||||
return true;
|
||||
@@ -393,6 +384,120 @@ public class AbilityDiscDual extends Ability {
|
||||
public void setAnchorPoint(int orb, int point) { getAnchorData(orb).anchorPoint = AnchorPoint.fromOrdinal(point); }
|
||||
public void setAnchorPoint(int point) { getAnchorData(0).anchorPoint = AnchorPoint.fromOrdinal(point); }
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public List<FieldDef> getFieldDefinitions() {
|
||||
return Arrays.asList(
|
||||
// Type tab
|
||||
FieldDef.row(
|
||||
FieldDef.floatField("enchantment.damage", this::getDamage, this::setDamage),
|
||||
FieldDef.floatField("stats.speed", this::getSpeed, this::setSpeed)
|
||||
),
|
||||
FieldDef.floatField("ability.knockback", this::getKnockback, this::setKnockback),
|
||||
FieldDef.section("ability.section.disc"),
|
||||
FieldDef.row(
|
||||
FieldDef.floatField("gui.radius", this::getDiscRadius, this::setDiscRadius),
|
||||
FieldDef.floatField("gui.thickness", this::getDiscThickness, this::setDiscThickness)
|
||||
),
|
||||
FieldDef.row(
|
||||
FieldDef.floatField("ability.maxDistance", this::getMaxDistance, this::setMaxDistance),
|
||||
FieldDef.intField("ability.lifetime", this::getMaxLifetime, this::setMaxLifetime)
|
||||
),
|
||||
FieldDef.section("ability.section.dual"),
|
||||
FieldDef.boolField("ability.dualFire", this::isDualFire, this::setDualFire),
|
||||
FieldDef.intField("ability.dualFireDelay", this::getDualFireDelay, this::setDualFireDelay)
|
||||
.visibleWhen(this::isDualFire),
|
||||
FieldDef.section("ability.section.homing"),
|
||||
FieldDef.boolField("gui.enabled", this::isHoming, this::setHoming)
|
||||
.hover("ability.hover.homing"),
|
||||
FieldDef.floatField("gui.strength", this::getHomingStrength, this::setHomingStrength)
|
||||
.visibleWhen(this::isHoming),
|
||||
FieldDef.section("ability.section.boomerang"),
|
||||
FieldDef.boolField("gui.enabled", this::isBoomerang, this::setBoomerang)
|
||||
.hover("ability.hover.boomerang"),
|
||||
FieldDef.intField("gui.delay", this::getBoomerangDelay, this::setBoomerangDelay)
|
||||
.visibleWhen(this::isBoomerang),
|
||||
FieldDef.section("ability.section.explosive"),
|
||||
FieldDef.boolField("gui.enabled", this::isExplosive, this::setExplosive)
|
||||
.hover("ability.hover.explosive"),
|
||||
FieldDef.floatField("gui.radius", this::getExplosionRadius, this::setExplosionRadius)
|
||||
.visibleWhen(this::isExplosive),
|
||||
AbilityFieldDefs.effectsListField("ability.effects", this::getEffects, this::setEffects),
|
||||
// Visual tab - Disc 1
|
||||
FieldDef.enumField("ability.anchorPoint", AnchorPoint.class,
|
||||
() -> getAnchorPointEnum(0), v -> setAnchorPointEnum(0, v))
|
||||
.tab("ability.tab.visual"),
|
||||
FieldDef.section("ability.section.disc1").tab("ability.tab.visual"),
|
||||
FieldDef.colorSubGui("ability.innerColor",
|
||||
() -> getInnerColor(0), v -> setInnerColor(0, v))
|
||||
.tab("ability.tab.visual"),
|
||||
FieldDef.boolField("ability.outerEnabled",
|
||||
() -> isOuterColorEnabled(0), v -> setOuterColorEnabled(0, v))
|
||||
.tab("ability.tab.visual"),
|
||||
FieldDef.colorSubGui("ability.outerColor",
|
||||
() -> getOuterColor(0), v -> setOuterColor(0, v))
|
||||
.tab("ability.tab.visual").visibleWhen(() -> isOuterColorEnabled(0)),
|
||||
FieldDef.row(
|
||||
FieldDef.floatField("ability.outerWidth",
|
||||
() -> getOuterColorWidth(0), v -> setOuterColorWidth(0, v))
|
||||
.visibleWhen(() -> isOuterColorEnabled(0)),
|
||||
FieldDef.floatField("ability.outerAlpha",
|
||||
() -> getOuterColorAlpha(0), v -> setOuterColorAlpha(0, v))
|
||||
.range(0, 1).visibleWhen(() -> isOuterColorEnabled(0))
|
||||
).tab("ability.tab.visual"),
|
||||
FieldDef.floatField("ability.rotationSpeed",
|
||||
() -> getRotationSpeed(0), v -> setRotationSpeed(0, v))
|
||||
.tab("ability.tab.visual"),
|
||||
FieldDef.boolField("ability.lightning",
|
||||
() -> hasLightningEffect(0), v -> setLightningEffect(0, v))
|
||||
.tab("ability.tab.visual"),
|
||||
FieldDef.row(
|
||||
FieldDef.floatField("gui.density",
|
||||
() -> getLightningDensity(0), v -> setLightningDensity(0, v))
|
||||
.range(0.01f, 5.0f).visibleWhen(() -> hasLightningEffect(0)),
|
||||
FieldDef.floatField("gui.radius",
|
||||
() -> getLightningRadius(0), v -> setLightningRadius(0, v))
|
||||
.range(0.1f, 10.0f).visibleWhen(() -> hasLightningEffect(0))
|
||||
).tab("ability.tab.visual"),
|
||||
// Visual tab - Disc 2
|
||||
FieldDef.enumField("ability.anchorPoint", AnchorPoint.class,
|
||||
() -> getAnchorPointEnum(1), v -> setAnchorPointEnum(1, v))
|
||||
.tab("ability.tab.visual"),
|
||||
FieldDef.section("ability.section.disc2").tab("ability.tab.visual"),
|
||||
FieldDef.colorSubGui("ability.innerColor",
|
||||
() -> getInnerColor(1), v -> setInnerColor(1, v))
|
||||
.tab("ability.tab.visual"),
|
||||
FieldDef.boolField("ability.outerEnabled",
|
||||
() -> isOuterColorEnabled(1), v -> setOuterColorEnabled(1, v))
|
||||
.tab("ability.tab.visual"),
|
||||
FieldDef.colorSubGui("ability.outerColor",
|
||||
() -> getOuterColor(1), v -> setOuterColor(1, v))
|
||||
.tab("ability.tab.visual").visibleWhen(() -> isOuterColorEnabled(1)),
|
||||
FieldDef.row(
|
||||
FieldDef.floatField("ability.outerWidth",
|
||||
() -> getOuterColorWidth(1), v -> setOuterColorWidth(1, v))
|
||||
.visibleWhen(() -> isOuterColorEnabled(1)),
|
||||
FieldDef.floatField("ability.outerAlpha",
|
||||
() -> getOuterColorAlpha(1), v -> setOuterColorAlpha(1, v))
|
||||
.range(0, 1).visibleWhen(() -> isOuterColorEnabled(1))
|
||||
).tab("ability.tab.visual"),
|
||||
FieldDef.floatField("ability.rotationSpeed",
|
||||
() -> getRotationSpeed(1), v -> setRotationSpeed(1, v))
|
||||
.tab("ability.tab.visual"),
|
||||
FieldDef.boolField("ability.lightning",
|
||||
() -> hasLightningEffect(1), v -> setLightningEffect(1, v))
|
||||
.tab("ability.tab.visual"),
|
||||
FieldDef.row(
|
||||
FieldDef.floatField("gui.density",
|
||||
() -> getLightningDensity(1), v -> setLightningDensity(1, v))
|
||||
.range(0.01f, 5.0f).visibleWhen(() -> hasLightningEffect(1)),
|
||||
FieldDef.floatField("gui.radius",
|
||||
() -> getLightningRadius(1), v -> setLightningRadius(1, v))
|
||||
.range(0.1f, 10.0f).visibleWhen(() -> hasLightningEffect(1))
|
||||
).tab("ability.tab.visual")
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Entity createPreviewEntity(EntityNPCInterface npc) {
|
||||
|
||||
@@ -17,10 +17,12 @@ import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
import noppes.npcs.client.gui.advanced.SubGuiAbilityConfig;
|
||||
import noppes.npcs.client.gui.advanced.ability.SubGuiAbilityEnergyBeam;
|
||||
import noppes.npcs.client.gui.util.IAbilityConfigCallback;
|
||||
import noppes.npcs.client.gui.builder.FieldDef;
|
||||
import kamkeel.npcs.controllers.data.ability.gui.AbilityFieldDefs;
|
||||
import noppes.npcs.api.ability.type.IAbilityEnergyBeam;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
/**
|
||||
@@ -61,17 +63,6 @@ public class AbilityEnergyBeam extends Ability implements IAbilityEnergyBeam {
|
||||
this.activeAnimationName = "Ability_Beam_Active";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTypeSettings() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public SubGuiAbilityConfig createConfigGui(IAbilityConfigCallback callback) {
|
||||
return new SubGuiAbilityEnergyBeam(this, callback);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTargetingModeLocked() {
|
||||
return true;
|
||||
@@ -282,4 +273,68 @@ public class AbilityEnergyBeam extends Ability implements IAbilityEnergyBeam {
|
||||
public int getPreviewActiveDuration() {
|
||||
return lifespanData.maxLifetime > 0 ? Math.min(lifespanData.maxLifetime, 100) : 100;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public List<FieldDef> getFieldDefinitions() {
|
||||
return Arrays.asList(
|
||||
// Type tab
|
||||
FieldDef.row(
|
||||
FieldDef.floatField("enchantment.damage", this::getDamage, this::setDamage),
|
||||
FieldDef.floatField("stats.speed", this::getSpeed, this::setSpeed)
|
||||
),
|
||||
FieldDef.floatField("ability.knockback", this::getKnockback, this::setKnockback),
|
||||
FieldDef.section("ability.section.beam"),
|
||||
FieldDef.row(
|
||||
FieldDef.floatField("ability.beamWidth", this::getBeamWidth, this::setBeamWidth),
|
||||
FieldDef.floatField("ability.headSize", this::getHeadSize, this::setHeadSize)
|
||||
),
|
||||
FieldDef.row(
|
||||
FieldDef.floatField("ability.maxDistance", this::getMaxDistance, this::setMaxDistance),
|
||||
FieldDef.intField("ability.lifetime", this::getMaxLifetime, this::setMaxLifetime)
|
||||
),
|
||||
FieldDef.section("ability.section.homing"),
|
||||
FieldDef.boolField("gui.enabled", this::isHoming, this::setHoming)
|
||||
.hover("ability.hover.homing"),
|
||||
FieldDef.row(
|
||||
FieldDef.floatField("gui.strength", this::getHomingStrength, this::setHomingStrength)
|
||||
.visibleWhen(this::isHoming),
|
||||
FieldDef.floatField("gui.range", this::getHomingRange, this::setHomingRange)
|
||||
.visibleWhen(this::isHoming)
|
||||
),
|
||||
FieldDef.section("ability.section.explosive"),
|
||||
FieldDef.boolField("gui.enabled", this::isExplosive, this::setExplosive)
|
||||
.hover("ability.hover.explosive"),
|
||||
FieldDef.floatField("gui.radius", this::getExplosionRadius, this::setExplosionRadius)
|
||||
.visibleWhen(this::isExplosive),
|
||||
AbilityFieldDefs.effectsListField("ability.effects", this::getEffects, this::setEffects),
|
||||
// Visual tab
|
||||
FieldDef.enumField("ability.anchorPoint", AnchorPoint.class, this::getAnchorPointEnum, this::setAnchorPointEnum)
|
||||
.tab("ability.tab.visual"),
|
||||
FieldDef.section("ability.section.colors").tab("ability.tab.visual"),
|
||||
FieldDef.colorSubGui("ability.innerColor", this::getInnerColor, this::setInnerColor)
|
||||
.tab("ability.tab.visual"),
|
||||
FieldDef.boolField("ability.outerEnabled", this::isOuterColorEnabled, this::setOuterColorEnabled)
|
||||
.tab("ability.tab.visual"),
|
||||
FieldDef.colorSubGui("ability.outerColor", this::getOuterColor, this::setOuterColor)
|
||||
.tab("ability.tab.visual").visibleWhen(this::isOuterColorEnabled),
|
||||
FieldDef.row(
|
||||
FieldDef.floatField("ability.outerWidth", this::getOuterColorWidth, this::setOuterColorWidth)
|
||||
.visibleWhen(this::isOuterColorEnabled),
|
||||
FieldDef.floatField("ability.outerAlpha", this::getOuterColorAlpha, this::setOuterColorAlpha)
|
||||
.range(0, 1).visibleWhen(this::isOuterColorEnabled)
|
||||
).tab("ability.tab.visual"),
|
||||
FieldDef.section("ability.section.effects").tab("ability.tab.visual"),
|
||||
FieldDef.floatField("ability.rotationSpeed", this::getRotationSpeed, this::setRotationSpeed)
|
||||
.tab("ability.tab.visual"),
|
||||
FieldDef.boolField("ability.lightning", this::hasLightningEffect, this::setLightningEffect)
|
||||
.tab("ability.tab.visual"),
|
||||
FieldDef.row(
|
||||
FieldDef.floatField("gui.density", this::getLightningDensity, this::setLightningDensity)
|
||||
.range(0.01f, 5.0f).visibleWhen(this::hasLightningEffect),
|
||||
FieldDef.floatField("gui.radius", this::getLightningRadius, this::setLightningRadius)
|
||||
.range(0.1f, 10.0f).visibleWhen(this::hasLightningEffect)
|
||||
).tab("ability.tab.visual")
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,5 @@
|
||||
package kamkeel.npcs.controllers.data.ability.type;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import kamkeel.npcs.controllers.data.ability.Ability;
|
||||
import kamkeel.npcs.controllers.data.ability.LockMovementType;
|
||||
import kamkeel.npcs.controllers.data.ability.TargetingMode;
|
||||
@@ -11,13 +9,18 @@ import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.world.World;
|
||||
import noppes.npcs.client.gui.advanced.SubGuiAbilityConfig;
|
||||
import noppes.npcs.client.gui.advanced.ability.SubGuiAbilityGuard;
|
||||
import noppes.npcs.client.gui.util.IAbilityConfigCallback;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
import noppes.npcs.api.ability.type.IAbilityGuard;
|
||||
|
||||
import noppes.npcs.client.gui.builder.FieldDef;
|
||||
import kamkeel.npcs.controllers.data.ability.gui.AbilityFieldDefs;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
@@ -45,7 +48,16 @@ public class AbilityGuard extends Ability implements IAbilityGuard {
|
||||
|
||||
public enum CounterType {
|
||||
FLAT,
|
||||
PERCENT
|
||||
PERCENT;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
switch (this) {
|
||||
case FLAT: return "ability.counter.flat";
|
||||
case PERCENT: return "ability.counter.percent";
|
||||
default: return name();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public AbilityGuard() {
|
||||
@@ -64,18 +76,6 @@ public class AbilityGuard extends Ability implements IAbilityGuard {
|
||||
this.allowedBy = UserType.NPC_ONLY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTypeSettings() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public SubGuiAbilityConfig createConfigGui(
|
||||
IAbilityConfigCallback callback) {
|
||||
return new SubGuiAbilityGuard(this, callback);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTargetingModeLocked() {
|
||||
return true;
|
||||
@@ -294,4 +294,28 @@ public class AbilityGuard extends Ability implements IAbilityGuard {
|
||||
public void setCounterAnimationId(int counterAnimationId) {
|
||||
this.counterAnimationId = counterAnimationId;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public List<FieldDef> getFieldDefinitions() {
|
||||
return Arrays.asList(
|
||||
FieldDef.intField("ability.duration", this::getDurationTicks, this::setDurationTicks).range(1, 1000),
|
||||
FieldDef.floatField("ability.damageReduction", this::getDamageReduction, this::setDamageReduction),
|
||||
FieldDef.section("ability.section.counter"),
|
||||
FieldDef.boolField("gui.enabled", this::isCanCounter, this::setCanCounter).hover("ability.hover.canCounter"),
|
||||
FieldDef.enumField("gui.type", CounterType.class, this::getCounterTypeEnum, this::setCounterTypeEnum)
|
||||
.hover("ability.hover.counterType").visibleWhen(this::isCanCounter),
|
||||
FieldDef.row(
|
||||
FieldDef.floatField("gui.value", this::getCounterValue, this::setCounterValue)
|
||||
.visibleWhen(this::isCanCounter),
|
||||
FieldDef.floatField("gui.chance", this::getCounterChance, this::setCounterChance)
|
||||
.visibleWhen(this::isCanCounter)
|
||||
),
|
||||
FieldDef.stringField("gui.sound", this::getCounterSound, this::setCounterSound)
|
||||
.visibleWhen(this::isCanCounter),
|
||||
FieldDef.intField("gui.animation", this::getCounterAnimationId, this::setCounterAnimationId)
|
||||
.visibleWhen(this::isCanCounter),
|
||||
AbilityFieldDefs.effectsListField("ability.effects", this::getEffects, this::setEffects)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,5 @@
|
||||
package kamkeel.npcs.controllers.data.ability.type;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import kamkeel.npcs.controllers.data.ability.Ability;
|
||||
import kamkeel.npcs.controllers.data.ability.LockMovementType;
|
||||
import kamkeel.npcs.controllers.data.ability.TargetingMode;
|
||||
@@ -14,13 +12,17 @@ import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.world.World;
|
||||
import noppes.npcs.client.gui.advanced.SubGuiAbilityConfig;
|
||||
import noppes.npcs.client.gui.advanced.ability.SubGuiAbilityHazard;
|
||||
import noppes.npcs.client.gui.util.IAbilityConfigCallback;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
import noppes.npcs.api.ability.type.IAbilityHazard;
|
||||
|
||||
import noppes.npcs.client.gui.builder.FieldDef;
|
||||
import kamkeel.npcs.controllers.data.ability.gui.AbilityFieldDefs;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
@@ -35,14 +37,35 @@ public class AbilityHazard extends Ability implements IAbilityHazard {
|
||||
public enum HazardShape {
|
||||
CIRCLE,
|
||||
RING,
|
||||
CONE
|
||||
CONE;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
switch (this) {
|
||||
case CIRCLE: return "ability.shape.circle";
|
||||
case RING: return "ability.shape.ring";
|
||||
case CONE: return "ability.shape.cone";
|
||||
default: return name();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public enum PlacementMode {
|
||||
AT_CASTER,
|
||||
AT_TARGET,
|
||||
FOLLOW_CASTER,
|
||||
FOLLOW_TARGET
|
||||
FOLLOW_TARGET;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
switch (this) {
|
||||
case AT_CASTER: return "ability.placement.atCaster";
|
||||
case AT_TARGET: return "ability.placement.atTarget";
|
||||
case FOLLOW_CASTER: return "ability.placement.followCaster";
|
||||
case FOLLOW_TARGET: return "ability.placement.followTarget";
|
||||
default: return name();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private int durationTicks = 100;
|
||||
@@ -90,18 +113,6 @@ public class AbilityHazard extends Ability implements IAbilityHazard {
|
||||
this.telegraphType = TelegraphType.CIRCLE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTypeSettings() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public SubGuiAbilityConfig createConfigGui(
|
||||
IAbilityConfigCallback callback) {
|
||||
return new SubGuiAbilityHazard(this, callback);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTargetingModeLocked() {
|
||||
return true;
|
||||
@@ -616,4 +627,35 @@ public class AbilityHazard extends Ability implements IAbilityHazard {
|
||||
public double getZoneZ() {
|
||||
return zoneZ;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public List<FieldDef> getFieldDefinitions() {
|
||||
return Arrays.asList(
|
||||
FieldDef.intField("ability.duration", this::getDurationTicks, this::setDurationTicks).range(1, 2000),
|
||||
FieldDef.enumField("ability.shape", HazardShape.class, this::getShapeEnum, this::setShapeEnum)
|
||||
.hover("ability.hover.shape"),
|
||||
FieldDef.enumField("ability.placement", PlacementMode.class, this::getPlacementEnum, this::setPlacementEnum)
|
||||
.hover("ability.hover.placement"),
|
||||
FieldDef.section("ability.section.area"),
|
||||
FieldDef.row(
|
||||
FieldDef.floatField("gui.radius", this::getRadius, this::setRadius),
|
||||
FieldDef.floatField("ability.innerRadius", this::getInnerRadius, this::setInnerRadius)
|
||||
),
|
||||
FieldDef.section("ability.section.damage"),
|
||||
FieldDef.row(
|
||||
FieldDef.floatField("ability.damagePerSecond", this::getDamagePerSecond, this::setDamagePerSecond),
|
||||
FieldDef.intField("ability.damageInterval", this::getDamageInterval, this::setDamageInterval)
|
||||
),
|
||||
FieldDef.section("ability.section.debuffs"),
|
||||
FieldDef.row(
|
||||
FieldDef.intField("ability.slownessLevel", this::getSlownessLevel, this::setSlownessLevel),
|
||||
FieldDef.intField("ability.debuffDuration", this::getDebuffDuration, this::setDebuffDuration)
|
||||
),
|
||||
FieldDef.intField("ability.poisonLevel", this::getPoisonLevel, this::setPoisonLevel),
|
||||
FieldDef.boolField("ability.affectsCaster", this::isAffectsCaster, this::setAffectsCaster)
|
||||
.hover("ability.hover.affectsCaster"),
|
||||
AbilityFieldDefs.effectsListField("ability.effects", this::getEffects, this::setEffects)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,5 @@
|
||||
package kamkeel.npcs.controllers.data.ability.type;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import kamkeel.npcs.controllers.data.ability.Ability;
|
||||
import kamkeel.npcs.controllers.data.ability.LockMovementType;
|
||||
import kamkeel.npcs.controllers.data.ability.TargetingMode;
|
||||
@@ -11,14 +9,16 @@ import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.World;
|
||||
import noppes.npcs.client.gui.advanced.SubGuiAbilityConfig;
|
||||
import noppes.npcs.client.gui.advanced.ability.SubGuiAbilityHeal;
|
||||
import noppes.npcs.client.gui.util.IAbilityConfigCallback;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
import noppes.npcs.client.gui.builder.FieldDef;
|
||||
import noppes.npcs.api.ability.type.IAbilityHeal;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -58,17 +58,6 @@ public class AbilityHeal extends Ability implements IAbilityHeal {
|
||||
this.showTelegraph = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTypeSettings() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public SubGuiAbilityConfig createConfigGui(IAbilityConfigCallback callback) {
|
||||
return new SubGuiAbilityHeal(this, callback);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTargetingModeLocked() {
|
||||
return true;
|
||||
@@ -289,4 +278,27 @@ public class AbilityHeal extends Ability implements IAbilityHeal {
|
||||
public void setInstantHeal(boolean instantHeal) {
|
||||
this.instantHeal = instantHeal;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public List<FieldDef> getFieldDefinitions() {
|
||||
return Arrays.asList(
|
||||
FieldDef.boolField("ability.instantHeal", this::isInstantHeal, this::setInstantHeal)
|
||||
.hover("ability.hover.instant"),
|
||||
FieldDef.intField("ability.duration", this::getDurationTicks, this::setDurationTicks)
|
||||
.range(1, 1000).visibleWhen(() -> !this.isInstantHeal()),
|
||||
FieldDef.section("ability.section.healing"),
|
||||
FieldDef.row(
|
||||
FieldDef.floatField("ability.healAmount", this::getHealAmount, this::setHealAmount),
|
||||
FieldDef.floatField("ability.healPercent", this::getHealPercent, this::setHealPercent)
|
||||
),
|
||||
FieldDef.floatField("ability.healRadius", this::getHealRadius, this::setHealRadius),
|
||||
FieldDef.row(
|
||||
FieldDef.boolField("ability.healSelf", this::isHealSelf, this::setHealSelf)
|
||||
.hover("ability.hover.healSelf"),
|
||||
FieldDef.boolField("ability.healAllies", this::isHealAllies, this::setHealAllies)
|
||||
.hover("ability.hover.healAllies")
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -9,12 +9,14 @@ import kamkeel.npcs.controllers.data.telegraph.TelegraphType;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import noppes.npcs.client.gui.advanced.SubGuiAbilityConfig;
|
||||
import noppes.npcs.client.gui.advanced.ability.SubGuiAbilityHeavyHit;
|
||||
import noppes.npcs.client.gui.util.IAbilityConfigCallback;
|
||||
import noppes.npcs.client.gui.builder.FieldDef;
|
||||
import kamkeel.npcs.controllers.data.ability.gui.AbilityFieldDefs;
|
||||
import noppes.npcs.api.ability.type.IAbilityHeavyHit;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Heavy Hit ability: Single-target melee attack with optional stun.
|
||||
* Deals high damage to one target and can stun them.
|
||||
@@ -41,18 +43,6 @@ public class AbilityHeavyHit extends Ability implements IAbilityHeavyHit {
|
||||
this.activeAnimationName = "Ability_HeavyHit_Active";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTypeSettings() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public SubGuiAbilityConfig createConfigGui(
|
||||
IAbilityConfigCallback callback) {
|
||||
return new SubGuiAbilityHeavyHit(this, callback);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTargetingModeLocked() {
|
||||
return true;
|
||||
@@ -114,4 +104,16 @@ public class AbilityHeavyHit extends Ability implements IAbilityHeavyHit {
|
||||
public void setKnockback(float knockback) {
|
||||
this.knockback = knockback;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public List<FieldDef> getFieldDefinitions() {
|
||||
return Arrays.asList(
|
||||
FieldDef.row(
|
||||
FieldDef.floatField("enchantment.damage", this::getDamage, this::setDamage),
|
||||
FieldDef.floatField("ability.knockback", this::getKnockback, this::setKnockback)
|
||||
),
|
||||
AbilityFieldDefs.effectsListField("ability.effects", this::getEffects, this::setEffects)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,8 @@ import kamkeel.npcs.controllers.data.ability.AnchorPoint;
|
||||
import kamkeel.npcs.controllers.data.ability.LockMovementType;
|
||||
import kamkeel.npcs.controllers.data.ability.TargetingMode;
|
||||
import kamkeel.npcs.controllers.data.ability.data.*;
|
||||
import noppes.npcs.client.gui.builder.FieldDef;
|
||||
import kamkeel.npcs.controllers.data.ability.gui.AbilityFieldDefs;
|
||||
import kamkeel.npcs.controllers.data.telegraph.TelegraphType;
|
||||
import kamkeel.npcs.entity.EntityAbilityLaser;
|
||||
import kamkeel.npcs.util.AnchorPointHelper;
|
||||
@@ -16,10 +18,10 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
import noppes.npcs.client.gui.advanced.SubGuiAbilityConfig;
|
||||
import noppes.npcs.client.gui.advanced.ability.SubGuiAbilityLaserShot;
|
||||
import noppes.npcs.client.gui.util.IAbilityConfigCallback;
|
||||
import noppes.npcs.api.ability.type.IAbilityLaserShot;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
/**
|
||||
@@ -59,17 +61,6 @@ public class AbilityLaserShot extends Ability implements IAbilityLaserShot {
|
||||
this.activeAnimationName = "Ability_Laser_Active";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTypeSettings() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public SubGuiAbilityConfig createConfigGui(IAbilityConfigCallback callback) {
|
||||
return new SubGuiAbilityLaserShot(this, callback);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTargetingModeLocked() {
|
||||
return false;
|
||||
@@ -253,4 +244,52 @@ public class AbilityLaserShot extends Ability implements IAbilityLaserShot {
|
||||
public boolean spawnPreviewDuringWindup() {
|
||||
return false; // Laser has no charging, spawns at active phase
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public List<FieldDef> getFieldDefinitions() {
|
||||
return Arrays.asList(
|
||||
// Type tab
|
||||
FieldDef.floatField("enchantment.damage", this::getDamage, this::setDamage),
|
||||
FieldDef.row(
|
||||
FieldDef.floatField("ability.knockback", this::getKnockback, this::setKnockback),
|
||||
FieldDef.floatField("ability.knockbackUp", this::getKnockbackUp, this::setKnockbackUp)
|
||||
),
|
||||
FieldDef.section("ability.section.beam"),
|
||||
FieldDef.row(
|
||||
FieldDef.floatField("ability.laserWidth", this::getLaserWidth, this::setLaserWidth),
|
||||
FieldDef.floatField("ability.expansionSpeed", this::getExpansionSpeed, this::setExpansionSpeed)
|
||||
),
|
||||
FieldDef.row(
|
||||
FieldDef.intField("ability.lingerTicks", this::getLingerTicks, this::setLingerTicks),
|
||||
FieldDef.intField("ability.lifetime", this::getMaxLifetime, this::setMaxLifetime)
|
||||
),
|
||||
FieldDef.floatField("ability.maxDistance", this::getMaxDistance, this::setMaxDistance),
|
||||
FieldDef.section("ability.section.explosive"),
|
||||
FieldDef.boolField("gui.enabled", this::isExplosive, this::setExplosive).hover("ability.hover.explosive"),
|
||||
FieldDef.floatField("gui.radius", this::getExplosionRadius, this::setExplosionRadius).visibleWhen(this::isExplosive),
|
||||
AbilityFieldDefs.effectsListField("ability.effects", this::getEffects, this::setEffects),
|
||||
|
||||
// Visual tab
|
||||
FieldDef.section("ability.section.colors").tab("ability.tab.visual"),
|
||||
FieldDef.colorSubGui("ability.innerColor", this::getInnerColor, this::setInnerColor).tab("ability.tab.visual"),
|
||||
FieldDef.boolField("ability.outerEnabled", this::isOuterColorEnabled, this::setOuterColorEnabled).tab("ability.tab.visual"),
|
||||
FieldDef.colorSubGui("ability.outerColor", this::getOuterColor, this::setOuterColor)
|
||||
.tab("ability.tab.visual").visibleWhen(this::isOuterColorEnabled),
|
||||
FieldDef.row(
|
||||
FieldDef.floatField("ability.outerWidth", this::getOuterColorWidth, this::setOuterColorWidth)
|
||||
.visibleWhen(this::isOuterColorEnabled),
|
||||
FieldDef.floatField("ability.outerAlpha", this::getOuterColorAlpha, this::setOuterColorAlpha)
|
||||
.range(0, 1).visibleWhen(this::isOuterColorEnabled)
|
||||
).tab("ability.tab.visual"),
|
||||
FieldDef.section("ability.section.effects").tab("ability.tab.visual"),
|
||||
FieldDef.boolField("ability.lightning", this::hasLightningEffect, this::setLightningEffect).tab("ability.tab.visual"),
|
||||
FieldDef.row(
|
||||
FieldDef.floatField("gui.density", this::getLightningDensity, this::setLightningDensity)
|
||||
.range(0.01f, 5.0f).visibleWhen(this::hasLightningEffect),
|
||||
FieldDef.floatField("gui.radius", this::getLightningRadius, this::setLightningRadius)
|
||||
.range(0.1f, 10.0f).visibleWhen(this::hasLightningEffect)
|
||||
).tab("ability.tab.visual")
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -17,10 +17,12 @@ import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
import noppes.npcs.client.gui.advanced.SubGuiAbilityConfig;
|
||||
import noppes.npcs.client.gui.advanced.ability.SubGuiAbilityOrb;
|
||||
import noppes.npcs.client.gui.util.IAbilityConfigCallback;
|
||||
import noppes.npcs.client.gui.builder.FieldDef;
|
||||
import kamkeel.npcs.controllers.data.ability.gui.AbilityFieldDefs;
|
||||
import noppes.npcs.api.ability.type.IAbilityOrb;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
/**
|
||||
@@ -60,17 +62,6 @@ public class AbilityOrb extends Ability implements IAbilityOrb {
|
||||
this.activeAnimationName = "Ability_Orb_Active";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTypeSettings() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public SubGuiAbilityConfig createConfigGui(IAbilityConfigCallback callback) {
|
||||
return new SubGuiAbilityOrb(this, callback);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTargetingModeLocked() {
|
||||
return true;
|
||||
@@ -418,4 +409,56 @@ public class AbilityOrb extends Ability implements IAbilityOrb {
|
||||
public int getPreviewActiveDuration() {
|
||||
return lifespanData.maxLifetime > 0 ? Math.min(lifespanData.maxLifetime, 100) : 100;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public List<FieldDef> getFieldDefinitions() {
|
||||
return Arrays.asList(
|
||||
// Type tab
|
||||
FieldDef.row(
|
||||
FieldDef.floatField("enchantment.damage", this::getDamage, this::setDamage),
|
||||
FieldDef.floatField("stats.speed", this::getOrbSpeed, this::setOrbSpeed)
|
||||
),
|
||||
FieldDef.row(
|
||||
FieldDef.floatField("stats.size", this::getOrbSize, this::setOrbSize),
|
||||
FieldDef.floatField("ability.knockback", this::getKnockback, this::setKnockback)
|
||||
),
|
||||
FieldDef.row(
|
||||
FieldDef.floatField("ability.maxDistance", this::getMaxDistance, this::setMaxDistance),
|
||||
FieldDef.intField("ability.lifetime", this::getMaxLifetime, this::setMaxLifetime)
|
||||
),
|
||||
FieldDef.section("ability.section.homing"),
|
||||
FieldDef.boolField("gui.enabled", this::isHoming, this::setHoming).hover("ability.hover.homing"),
|
||||
FieldDef.floatField("gui.strength", this::getHomingStrength, this::setHomingStrength).visibleWhen(this::isHoming),
|
||||
FieldDef.section("ability.section.explosive"),
|
||||
FieldDef.boolField("gui.enabled", this::isExplosive, this::setExplosive).hover("ability.hover.explosive"),
|
||||
FieldDef.floatField("gui.radius", this::getExplosionRadius, this::setExplosionRadius).visibleWhen(this::isExplosive),
|
||||
AbilityFieldDefs.effectsListField("ability.effects", this::getEffects, this::setEffects),
|
||||
|
||||
|
||||
// Visual tab
|
||||
FieldDef.enumField("ability.anchorPoint", AnchorPoint.class, this::getAnchorPointEnum, this::setAnchorPointEnum)
|
||||
.tab("ability.tab.visual"),
|
||||
FieldDef.section("ability.section.colors").tab("ability.tab.visual"),
|
||||
FieldDef.colorSubGui("ability.innerColor", this::getInnerColor, this::setInnerColor).tab("ability.tab.visual"),
|
||||
FieldDef.boolField("ability.outerEnabled", this::isOuterColorEnabled, this::setOuterColorEnabled).tab("ability.tab.visual"),
|
||||
FieldDef.colorSubGui("ability.outerColor", this::getOuterColor, this::setOuterColor)
|
||||
.tab("ability.tab.visual").visibleWhen(this::isOuterColorEnabled),
|
||||
FieldDef.row(
|
||||
FieldDef.floatField("ability.outerWidth", this::getOuterColorWidth, this::setOuterColorWidth)
|
||||
.visibleWhen(this::isOuterColorEnabled),
|
||||
FieldDef.floatField("ability.outerAlpha", this::getOuterColorAlpha, this::setOuterColorAlpha)
|
||||
.range(0, 1).visibleWhen(this::isOuterColorEnabled)
|
||||
).tab("ability.tab.visual"),
|
||||
FieldDef.section("ability.section.effects").tab("ability.tab.visual"),
|
||||
FieldDef.floatField("ability.rotationSpeed", this::getRotationSpeed, this::setRotationSpeed).tab("ability.tab.visual"),
|
||||
FieldDef.boolField("ability.lightning", this::hasLightningEffect, this::setLightningEffect).tab("ability.tab.visual"),
|
||||
FieldDef.row(
|
||||
FieldDef.floatField("gui.density", this::getLightningDensity, this::setLightningDensity)
|
||||
.range(0.01f, 5.0f).visibleWhen(this::hasLightningEffect),
|
||||
FieldDef.floatField("gui.radius", this::getLightningRadius, this::setLightningRadius)
|
||||
.range(0.1f, 10.0f).visibleWhen(this::hasLightningEffect)
|
||||
).tab("ability.tab.visual")
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,8 @@ import kamkeel.npcs.controllers.data.ability.AnchorPoint;
|
||||
import kamkeel.npcs.controllers.data.ability.LockMovementType;
|
||||
import kamkeel.npcs.controllers.data.ability.TargetingMode;
|
||||
import kamkeel.npcs.controllers.data.ability.data.*;
|
||||
import noppes.npcs.client.gui.builder.FieldDef;
|
||||
import kamkeel.npcs.controllers.data.ability.gui.AbilityFieldDefs;
|
||||
import kamkeel.npcs.controllers.data.telegraph.Telegraph;
|
||||
import kamkeel.npcs.controllers.data.telegraph.TelegraphInstance;
|
||||
import kamkeel.npcs.controllers.data.telegraph.TelegraphType;
|
||||
@@ -17,12 +19,12 @@ import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
import noppes.npcs.client.gui.advanced.SubGuiAbilityConfig;
|
||||
import noppes.npcs.client.gui.advanced.ability.SubGuiAbilityOrbDual;
|
||||
import noppes.npcs.client.gui.util.IAbilityConfigCallback;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
import noppes.npcs.util.ValueUtil;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class AbilityOrbDual extends Ability {
|
||||
// Ability-specific properties
|
||||
private float orbSize = 1.0f;
|
||||
@@ -63,17 +65,6 @@ public class AbilityOrbDual extends Ability {
|
||||
this.activeAnimationName = "Ability_BeamDual_Active";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTypeSettings() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public SubGuiAbilityConfig createConfigGui(IAbilityConfigCallback callback) {
|
||||
return new SubGuiAbilityOrbDual(this, callback);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTargetingModeLocked() {
|
||||
return true;
|
||||
@@ -464,6 +455,109 @@ public class AbilityOrbDual extends Ability {
|
||||
public void setAnchorPoint(int orb, int point) { getAnchorData(orb).anchorPoint = AnchorPoint.fromOrdinal(point); }
|
||||
public void setAnchorPoint(int point) { getAnchorData(0).anchorPoint = AnchorPoint.fromOrdinal(point); }
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public List<FieldDef> getFieldDefinitions() {
|
||||
return Arrays.asList(
|
||||
// Type tab
|
||||
FieldDef.row(
|
||||
FieldDef.floatField("enchantment.damage", this::getDamage, this::setDamage),
|
||||
FieldDef.floatField("stats.speed", this::getOrbSpeed, this::setOrbSpeed)
|
||||
),
|
||||
FieldDef.row(
|
||||
FieldDef.floatField("stats.size", this::getOrbSize, this::setOrbSize),
|
||||
FieldDef.floatField("ability.knockback", this::getKnockback, this::setKnockback)
|
||||
),
|
||||
FieldDef.row(
|
||||
FieldDef.floatField("ability.maxDistance", this::getMaxDistance, this::setMaxDistance),
|
||||
FieldDef.intField("ability.lifetime", this::getMaxLifetime, this::setMaxLifetime)
|
||||
),
|
||||
FieldDef.section("ability.section.dual"),
|
||||
FieldDef.boolField("ability.dualFire", this::isDualFire, this::setDualFire),
|
||||
FieldDef.intField("ability.dualFireDelay", this::getDualFireDelay, this::setDualFireDelay)
|
||||
.visibleWhen(this::isDualFire),
|
||||
FieldDef.section("ability.section.homing"),
|
||||
FieldDef.boolField("gui.enabled", this::isHoming, this::setHoming).hover("ability.hover.homing"),
|
||||
FieldDef.floatField("gui.strength", this::getHomingStrength, this::setHomingStrength).visibleWhen(this::isHoming),
|
||||
FieldDef.section("ability.section.explosive"),
|
||||
FieldDef.boolField("gui.enabled", this::isExplosive, this::setExplosive).hover("ability.hover.explosive"),
|
||||
FieldDef.floatField("gui.radius", this::getExplosionRadius, this::setExplosionRadius).visibleWhen(this::isExplosive),
|
||||
AbilityFieldDefs.effectsListField("ability.effects", this::getEffects, this::setEffects),
|
||||
// Visual tab - Orb 1
|
||||
FieldDef.enumField("ability.anchorPoint", AnchorPoint.class,
|
||||
() -> getAnchorPointEnum(0), v -> setAnchorPointEnum(0, v))
|
||||
.tab("ability.tab.visual"),
|
||||
FieldDef.section("ability.section.orb1").tab("ability.tab.visual"),
|
||||
FieldDef.colorSubGui("ability.innerColor",
|
||||
() -> getInnerColor(0), v -> setInnerColor(0, v))
|
||||
.tab("ability.tab.visual"),
|
||||
FieldDef.boolField("ability.outerEnabled",
|
||||
() -> isOuterColorEnabled(0), v -> setOuterColorEnabled(0, v))
|
||||
.tab("ability.tab.visual"),
|
||||
FieldDef.colorSubGui("ability.outerColor",
|
||||
() -> getOuterColor(0), v -> setOuterColor(0, v))
|
||||
.tab("ability.tab.visual").visibleWhen(() -> isOuterColorEnabled(0)),
|
||||
FieldDef.row(
|
||||
FieldDef.floatField("ability.outerWidth",
|
||||
() -> getOuterColorWidth(0), v -> setOuterColorWidth(0, v))
|
||||
.visibleWhen(() -> isOuterColorEnabled(0)),
|
||||
FieldDef.floatField("ability.outerAlpha",
|
||||
() -> getOuterColorAlpha(0), v -> setOuterColorAlpha(0, v))
|
||||
.range(0, 1).visibleWhen(() -> isOuterColorEnabled(0))
|
||||
).tab("ability.tab.visual"),
|
||||
FieldDef.floatField("ability.rotationSpeed",
|
||||
() -> getRotationSpeed(0), v -> setRotationSpeed(0, v))
|
||||
.tab("ability.tab.visual"),
|
||||
FieldDef.boolField("ability.lightning",
|
||||
() -> hasLightningEffect(0), v -> setLightningEffect(0, v))
|
||||
.tab("ability.tab.visual"),
|
||||
FieldDef.row(
|
||||
FieldDef.floatField("gui.density",
|
||||
() -> getLightningDensity(0), v -> setLightningDensity(0, v))
|
||||
.range(0.01f, 5.0f).visibleWhen(() -> hasLightningEffect(0)),
|
||||
FieldDef.floatField("gui.radius",
|
||||
() -> getLightningRadius(0), v -> setLightningRadius(0, v))
|
||||
.range(0.1f, 10.0f).visibleWhen(() -> hasLightningEffect(0))
|
||||
).tab("ability.tab.visual"),
|
||||
// Visual tab - Orb 2
|
||||
FieldDef.enumField("ability.anchorPoint", AnchorPoint.class,
|
||||
() -> getAnchorPointEnum(1), v -> setAnchorPointEnum(1, v))
|
||||
.tab("ability.tab.visual"),
|
||||
FieldDef.section("ability.section.orb2").tab("ability.tab.visual"),
|
||||
FieldDef.colorSubGui("ability.innerColor",
|
||||
() -> getInnerColor(1), v -> setInnerColor(1, v))
|
||||
.tab("ability.tab.visual"),
|
||||
FieldDef.boolField("ability.outerEnabled",
|
||||
() -> isOuterColorEnabled(1), v -> setOuterColorEnabled(1, v))
|
||||
.tab("ability.tab.visual"),
|
||||
FieldDef.colorSubGui("ability.outerColor",
|
||||
() -> getOuterColor(1), v -> setOuterColor(1, v))
|
||||
.tab("ability.tab.visual").visibleWhen(() -> isOuterColorEnabled(1)),
|
||||
FieldDef.row(
|
||||
FieldDef.floatField("ability.outerWidth",
|
||||
() -> getOuterColorWidth(1), v -> setOuterColorWidth(1, v))
|
||||
.visibleWhen(() -> isOuterColorEnabled(1)),
|
||||
FieldDef.floatField("ability.outerAlpha",
|
||||
() -> getOuterColorAlpha(1), v -> setOuterColorAlpha(1, v))
|
||||
.range(0, 1).visibleWhen(() -> isOuterColorEnabled(1))
|
||||
).tab("ability.tab.visual"),
|
||||
FieldDef.floatField("ability.rotationSpeed",
|
||||
() -> getRotationSpeed(1), v -> setRotationSpeed(1, v))
|
||||
.tab("ability.tab.visual"),
|
||||
FieldDef.boolField("ability.lightning",
|
||||
() -> hasLightningEffect(1), v -> setLightningEffect(1, v))
|
||||
.tab("ability.tab.visual"),
|
||||
FieldDef.row(
|
||||
FieldDef.floatField("gui.density",
|
||||
() -> getLightningDensity(1), v -> setLightningDensity(1, v))
|
||||
.range(0.01f, 5.0f).visibleWhen(() -> hasLightningEffect(1)),
|
||||
FieldDef.floatField("gui.radius",
|
||||
() -> getLightningRadius(1), v -> setLightningRadius(1, v))
|
||||
.range(0.1f, 10.0f).visibleWhen(() -> hasLightningEffect(1))
|
||||
).tab("ability.tab.visual")
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Entity createPreviewEntity(EntityNPCInterface npc) {
|
||||
|
||||
@@ -10,11 +10,14 @@ import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import noppes.npcs.client.gui.advanced.SubGuiAbilityConfig;
|
||||
import noppes.npcs.client.gui.advanced.ability.SubGuiAbilityProjectile;
|
||||
import noppes.npcs.client.gui.util.IAbilityConfigCallback;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
import noppes.npcs.api.ability.type.IAbilityProjectile;
|
||||
|
||||
import noppes.npcs.client.gui.builder.FieldDef;
|
||||
import kamkeel.npcs.controllers.data.ability.gui.AbilityFieldDefs;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -47,17 +50,6 @@ public class AbilityProjectile extends Ability implements IAbilityProjectile {
|
||||
this.showTelegraph = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTypeSettings() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public SubGuiAbilityConfig createConfigGui(IAbilityConfigCallback callback) {
|
||||
return new SubGuiAbilityProjectile(this, callback);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTargetingModeLocked() {
|
||||
return true;
|
||||
@@ -256,4 +248,24 @@ public class AbilityProjectile extends Ability implements IAbilityProjectile {
|
||||
public void setHomingStrength(float homingStrength) {
|
||||
this.homingStrength = homingStrength;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public List<FieldDef> getFieldDefinitions() {
|
||||
return Arrays.asList(
|
||||
FieldDef.row(
|
||||
FieldDef.floatField("enchantment.damage", this::getDamage, this::setDamage),
|
||||
FieldDef.floatField("stats.speed", this::getSpeed, this::setSpeed)
|
||||
),
|
||||
FieldDef.floatField("ability.knockback", this::getKnockback, this::setKnockback),
|
||||
FieldDef.stringEnumField("ability.projectileType", new String[]{"fireball", "arrow", "magic"}, this::getProjectileType, this::setProjectileType),
|
||||
FieldDef.section("ability.section.homing"),
|
||||
FieldDef.boolField("gui.enabled", this::isHoming, this::setHoming).hover("ability.hover.homing"),
|
||||
FieldDef.floatField("gui.strength", this::getHomingStrength, this::setHomingStrength).visibleWhen(this::isHoming),
|
||||
FieldDef.section("ability.section.explosive"),
|
||||
FieldDef.boolField("gui.enabled", this::isExplosive, this::setExplosive).hover("ability.hover.explosive"),
|
||||
FieldDef.floatField("gui.radius", this::getExplosionRadius, this::setExplosionRadius).visibleWhen(this::isExplosive),
|
||||
AbilityFieldDefs.effectsListField("ability.effects", this::getEffects, this::setEffects)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -11,13 +11,13 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.world.World;
|
||||
import noppes.npcs.client.gui.advanced.SubGuiAbilityConfig;
|
||||
import noppes.npcs.client.gui.advanced.ability.SubGuiAbilityShockwave;
|
||||
import noppes.npcs.client.gui.util.IAbilityConfigCallback;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
import noppes.npcs.client.gui.builder.FieldDef;
|
||||
import kamkeel.npcs.controllers.data.ability.gui.AbilityFieldDefs;
|
||||
import noppes.npcs.api.ability.type.IAbilityShockwave;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -44,17 +44,6 @@ public class AbilityShockwave extends Ability implements IAbilityShockwave {
|
||||
this.activeSound = "random.explode";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTypeSettings() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public SubGuiAbilityConfig createConfigGui(IAbilityConfigCallback callback) {
|
||||
return new SubGuiAbilityShockwave(this, callback);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTargetingModeLocked() {
|
||||
return true;
|
||||
@@ -175,4 +164,18 @@ public class AbilityShockwave extends Ability implements IAbilityShockwave {
|
||||
this.maxTargets = maxTargets;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public List<FieldDef> getFieldDefinitions() {
|
||||
return Arrays.asList(
|
||||
FieldDef.floatField("enchantment.damage", this::getDamage, this::setDamage),
|
||||
FieldDef.section("ability.section.push"),
|
||||
FieldDef.row(
|
||||
FieldDef.floatField("gui.radius", this::getPushRadius, this::setPushRadius),
|
||||
FieldDef.floatField("gui.strength", this::getPushStrength, this::setPushStrength)
|
||||
),
|
||||
FieldDef.intField("ability.maxTargets", this::getMaxTargets, this::setMaxTargets),
|
||||
AbilityFieldDefs.effectsListField("ability.effects", this::getEffects, this::setEffects)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -13,13 +13,14 @@ import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.world.World;
|
||||
import noppes.npcs.client.gui.advanced.SubGuiAbilityConfig;
|
||||
import noppes.npcs.client.gui.advanced.ability.SubGuiAbilitySlam;
|
||||
import noppes.npcs.client.gui.util.IAbilityConfigCallback;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
import noppes.npcs.api.ability.type.IAbilitySlam;
|
||||
import somehussar.gui.annotationHandling.GuiEditable;
|
||||
|
||||
import noppes.npcs.client.gui.builder.FieldDef;
|
||||
import kamkeel.npcs.controllers.data.ability.gui.AbilityFieldDefs;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -64,17 +65,6 @@ public class AbilitySlam extends Ability implements IAbilitySlam {
|
||||
this.activeAnimationName = "Ability_Slam_Active";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTypeSettings() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public SubGuiAbilityConfig createConfigGui(IAbilityConfigCallback callback) {
|
||||
return new SubGuiAbilitySlam(this, callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* Slam can be AOE_SELF (jump in place) or AOE_TARGET (leap to target).
|
||||
*/
|
||||
@@ -581,4 +571,22 @@ public class AbilitySlam extends Ability implements IAbilitySlam {
|
||||
public void setLeapHeight(float leapHeight) {
|
||||
this.leapHeight = leapHeight;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public List<FieldDef> getFieldDefinitions() {
|
||||
return Arrays.asList(
|
||||
FieldDef.floatField("enchantment.damage", this::getDamage, this::setDamage),
|
||||
FieldDef.row(
|
||||
FieldDef.floatField("gui.radius", this::getRadius, this::setRadius),
|
||||
FieldDef.floatField("ability.knockback", this::getKnockbackStrength, this::setKnockbackStrength)
|
||||
),
|
||||
FieldDef.section("ability.section.leap"),
|
||||
FieldDef.row(
|
||||
FieldDef.floatField("gui.speed", this::getLeapSpeed, this::setLeapSpeed),
|
||||
FieldDef.floatField("gui.height", this::getLeapHeight, this::setLeapHeight)
|
||||
),
|
||||
AbilityFieldDefs.effectsListField("ability.effects", this::getEffects, this::setEffects)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,8 @@ import kamkeel.npcs.controllers.data.ability.Ability;
|
||||
import kamkeel.npcs.controllers.data.ability.LockMovementType;
|
||||
import kamkeel.npcs.controllers.data.ability.TargetingMode;
|
||||
import kamkeel.npcs.controllers.data.ability.data.EnergyColorData;
|
||||
import noppes.npcs.client.gui.builder.FieldDef;
|
||||
import kamkeel.npcs.controllers.data.ability.gui.AbilityFieldDefs;
|
||||
import kamkeel.npcs.controllers.data.telegraph.Telegraph;
|
||||
import kamkeel.npcs.controllers.data.telegraph.TelegraphInstance;
|
||||
import kamkeel.npcs.controllers.data.telegraph.TelegraphType;
|
||||
@@ -14,11 +16,12 @@ import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import noppes.npcs.LogWriter;
|
||||
import noppes.npcs.client.gui.advanced.SubGuiAbilityConfig;
|
||||
import noppes.npcs.client.gui.advanced.ability.SubGuiAbilitySweeper;
|
||||
import noppes.npcs.client.gui.util.IAbilityConfigCallback;
|
||||
import noppes.npcs.api.ability.type.IAbilitySweeper;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
/**
|
||||
* Sweeper ability: A low sweeping beam that rotates around the NPC.
|
||||
* Players can jump over it. The beam completes a set number of rotations before ending.
|
||||
@@ -60,17 +63,6 @@ public class AbilitySweeper extends Ability implements IAbilitySweeper {
|
||||
this.showTelegraph = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTypeSettings() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public SubGuiAbilityConfig createConfigGui(IAbilityConfigCallback callback) {
|
||||
return new SubGuiAbilitySweeper(this, callback);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTargetingModeLocked() {
|
||||
return true;
|
||||
@@ -204,4 +196,44 @@ public class AbilitySweeper extends Ability implements IAbilitySweeper {
|
||||
public void setOuterColorWidth(float outerColorWidth) { colorData.outerColorWidth = outerColorWidth; }
|
||||
public boolean isOuterColorEnabled() { return colorData.outerColorEnabled; }
|
||||
public void setOuterColorEnabled(boolean outerColorEnabled) { colorData.outerColorEnabled = outerColorEnabled; }
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public List<FieldDef> getFieldDefinitions() {
|
||||
return Arrays.asList(
|
||||
|
||||
FieldDef.row(
|
||||
FieldDef.floatField("enchantment.damage", this::getDamage, this::setDamage),
|
||||
FieldDef.intField("ability.damageInterval", this::getDamageInterval, this::setDamageInterval)
|
||||
),
|
||||
FieldDef.section("ability.section.beam"),
|
||||
FieldDef.row(
|
||||
FieldDef.floatField("gui.length", this::getBeamLength, this::setBeamLength),
|
||||
FieldDef.floatField("gui.width", this::getBeamWidth, this::setBeamWidth)
|
||||
),
|
||||
FieldDef.row(
|
||||
FieldDef.floatField("gui.height", this::getBeamHeight, this::setBeamHeight),
|
||||
FieldDef.floatField("ability.sweepSpeed", this::getSweepSpeed, this::setSweepSpeed)
|
||||
),
|
||||
FieldDef.intField("ability.rotations", this::getNumberOfRotations, this::setNumberOfRotations),
|
||||
FieldDef.row(
|
||||
FieldDef.boolField("ability.piercing", this::isPiercing, this::setPiercing)
|
||||
.hover("ability.hover.piercing"),
|
||||
FieldDef.boolField("ability.lockTarget", this::isLockOnTarget, this::setLockOnTarget)
|
||||
.hover("ability.hover.lockTarget")
|
||||
),
|
||||
AbilityFieldDefs.effectsListField("ability.effects", this::getEffects, this::setEffects),
|
||||
|
||||
// Visual tab
|
||||
FieldDef.section("ability.section.colors").tab("ability.tab.visual"),
|
||||
FieldDef.colorSubGui("ability.innerColor", this::getInnerColor, this::setInnerColor)
|
||||
.tab("ability.tab.visual"),
|
||||
FieldDef.boolField("ability.outerEnabled", this::isOuterColorEnabled, this::setOuterColorEnabled)
|
||||
.tab("ability.tab.visual"),
|
||||
FieldDef.colorSubGui("ability.outerColor", this::getOuterColor, this::setOuterColor)
|
||||
.tab("ability.tab.visual").visibleWhen(this::isOuterColorEnabled),
|
||||
FieldDef.floatField("ability.outerWidth", this::getOuterColorWidth, this::setOuterColorWidth)
|
||||
.tab("ability.tab.visual").visibleWhen(this::isOuterColorEnabled)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,5 @@
|
||||
package kamkeel.npcs.controllers.data.ability.type;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import kamkeel.npcs.controllers.data.ability.Ability;
|
||||
import kamkeel.npcs.controllers.data.ability.LockMovementType;
|
||||
import kamkeel.npcs.controllers.data.ability.TargetingMode;
|
||||
@@ -14,13 +12,17 @@ import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
import noppes.npcs.client.gui.advanced.SubGuiAbilityConfig;
|
||||
import noppes.npcs.client.gui.advanced.ability.SubGuiAbilityTeleport;
|
||||
import noppes.npcs.client.gui.util.IAbilityConfigCallback;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
import noppes.npcs.api.ability.type.IAbilityTeleport;
|
||||
|
||||
import noppes.npcs.client.gui.builder.FieldDef;
|
||||
import kamkeel.npcs.controllers.data.ability.gui.AbilityFieldDefs;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
@@ -35,7 +37,17 @@ public class AbilityTeleport extends Ability implements IAbilityTeleport {
|
||||
public enum TeleportMode {
|
||||
BLINK,
|
||||
BEHIND,
|
||||
SINGLE
|
||||
SINGLE;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
switch (this) {
|
||||
case BLINK: return "ability.teleport.blink";
|
||||
case BEHIND: return "ability.teleport.behind";
|
||||
case SINGLE: return "ability.teleport.single";
|
||||
default: return name();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static final Random RANDOM = new Random();
|
||||
@@ -72,18 +84,6 @@ public class AbilityTeleport extends Ability implements IAbilityTeleport {
|
||||
this.activeSound = "mob.endermen.portal";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTypeSettings() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public SubGuiAbilityConfig createConfigGui(
|
||||
IAbilityConfigCallback callback) {
|
||||
return new SubGuiAbilityTeleport(this, callback);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTargetingModeLocked() {
|
||||
return true;
|
||||
@@ -555,4 +555,37 @@ public class AbilityTeleport extends Ability implements IAbilityTeleport {
|
||||
public void setDamageRadius(float damageRadius) {
|
||||
this.damageRadius = damageRadius;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public List<FieldDef> getFieldDefinitions() {
|
||||
return Arrays.asList(
|
||||
FieldDef.enumField("ability.mode", TeleportMode.class, this::getModeEnum, this::setModeEnum),
|
||||
FieldDef.floatField("ability.blinkRadius", this::getBlinkRadius, this::setBlinkRadius)
|
||||
.visibleWhen(() -> this.getModeEnum() == TeleportMode.BLINK || this.getModeEnum() == TeleportMode.SINGLE),
|
||||
FieldDef.row(
|
||||
FieldDef.intField("ability.blinkCount", this::getBlinkCount, this::setBlinkCount)
|
||||
.visibleWhen(() -> this.getModeEnum() == TeleportMode.BLINK),
|
||||
FieldDef.intField("ability.blinkDelay", this::getBlinkDelayTicks, this::setBlinkDelayTicks)
|
||||
.visibleWhen(() -> this.getModeEnum() == TeleportMode.BLINK)
|
||||
),
|
||||
FieldDef.floatField("ability.behindDistance", this::getBehindDistance, this::setBehindDistance)
|
||||
.visibleWhen(() -> this.getModeEnum() == TeleportMode.BEHIND),
|
||||
FieldDef.boolField("ability.lineOfSight", this::isRequireLineOfSight, this::setRequireLineOfSight)
|
||||
.hover("ability.hover.lineOfSight")
|
||||
.visibleWhen(() -> this.getModeEnum() == TeleportMode.BLINK || this.getModeEnum() == TeleportMode.SINGLE),
|
||||
FieldDef.section("ability.section.damage"),
|
||||
FieldDef.row(
|
||||
FieldDef.floatField("enchantment.damage", this::getDamage, this::setDamage),
|
||||
FieldDef.floatField("gui.radius", this::getDamageRadius, this::setDamageRadius)
|
||||
),
|
||||
FieldDef.row(
|
||||
FieldDef.boolField("ability.damageAtStart", this::isDamageAtStart, this::setDamageAtStart)
|
||||
.hover("ability.hover.dmgAtStart"),
|
||||
FieldDef.boolField("ability.damageAtEnd", this::isDamageAtEnd, this::setDamageAtEnd)
|
||||
.hover("ability.hover.dmgAtEnd")
|
||||
),
|
||||
AbilityFieldDefs.effectsListField("ability.effects", this::getEffects, this::setEffects)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,5 @@
|
||||
package kamkeel.npcs.controllers.data.ability.type;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import kamkeel.npcs.controllers.data.ability.Ability;
|
||||
import kamkeel.npcs.controllers.data.ability.LockMovementType;
|
||||
import kamkeel.npcs.controllers.data.ability.TargetingMode;
|
||||
@@ -12,13 +10,17 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.world.World;
|
||||
import noppes.npcs.client.gui.advanced.SubGuiAbilityConfig;
|
||||
import noppes.npcs.client.gui.advanced.ability.SubGuiAbilityTrap;
|
||||
import noppes.npcs.client.gui.util.IAbilityConfigCallback;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
import noppes.npcs.api.ability.type.IAbilityTrap;
|
||||
|
||||
import noppes.npcs.client.gui.builder.FieldDef;
|
||||
import kamkeel.npcs.controllers.data.ability.gui.AbilityFieldDefs;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
@@ -34,7 +36,17 @@ public class AbilityTrap extends Ability implements IAbilityTrap {
|
||||
public enum TrapPlacement {
|
||||
AT_CASTER,
|
||||
AT_TARGET,
|
||||
AHEAD_OF_CASTER
|
||||
AHEAD_OF_CASTER;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
switch (this) {
|
||||
case AT_CASTER: return "ability.trapPlace.atCaster";
|
||||
case AT_TARGET: return "ability.trapPlace.atTarget";
|
||||
case AHEAD_OF_CASTER: return "ability.trapPlace.aheadOfCaster";
|
||||
default: return name();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private int durationTicks = 200;
|
||||
@@ -73,17 +85,6 @@ public class AbilityTrap extends Ability implements IAbilityTrap {
|
||||
this.telegraphType = TelegraphType.CIRCLE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTypeSettings() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public SubGuiAbilityConfig createConfigGui(IAbilityConfigCallback callback) {
|
||||
return new SubGuiAbilityTrap(this, callback);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTargetingModeLocked() {
|
||||
return true;
|
||||
@@ -464,4 +465,31 @@ public class AbilityTrap extends Ability implements IAbilityTrap {
|
||||
public boolean isArmed() {
|
||||
return armed;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public List<FieldDef> getFieldDefinitions() {
|
||||
return Arrays.asList(
|
||||
FieldDef.intField("ability.duration", this::getDurationTicks, this::setDurationTicks)
|
||||
.range(1, 2000),
|
||||
FieldDef.enumField("ability.placement", TrapPlacement.class, this::getPlacementEnum, this::setPlacementEnum)
|
||||
.hover("ability.hover.placement"),
|
||||
FieldDef.section("ability.section.trigger"),
|
||||
FieldDef.row(
|
||||
FieldDef.floatField("gui.radius", this::getTriggerRadius, this::setTriggerRadius),
|
||||
FieldDef.intField("ability.armTime", this::getArmTime, this::setArmTime)
|
||||
),
|
||||
FieldDef.row(
|
||||
FieldDef.intField("ability.maxTriggers", this::getMaxTriggers, this::setMaxTriggers),
|
||||
FieldDef.intField("ability.triggerCooldown", this::getTriggerCooldown, this::setTriggerCooldown)
|
||||
),
|
||||
FieldDef.section("ability.section.damage"),
|
||||
FieldDef.row(
|
||||
FieldDef.floatField("enchantment.damage", this::getDamage, this::setDamage),
|
||||
FieldDef.floatField("gui.radius", this::getDamageRadius, this::setDamageRadius)
|
||||
),
|
||||
FieldDef.floatField("ability.knockback", this::getKnockback, this::setKnockback),
|
||||
AbilityFieldDefs.effectsListField("ability.effects", this::getEffects, this::setEffects)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,5 @@
|
||||
package kamkeel.npcs.controllers.data.ability.type;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import kamkeel.npcs.controllers.data.ability.Ability;
|
||||
import kamkeel.npcs.controllers.data.ability.LockMovementType;
|
||||
import kamkeel.npcs.controllers.data.ability.TargetingMode;
|
||||
@@ -10,13 +8,16 @@ import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.World;
|
||||
import noppes.npcs.client.gui.advanced.SubGuiAbilityConfig;
|
||||
import noppes.npcs.client.gui.advanced.ability.SubGuiAbilityVortex;
|
||||
import noppes.npcs.client.gui.util.IAbilityConfigCallback;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
import noppes.npcs.client.gui.builder.FieldDef;
|
||||
import kamkeel.npcs.controllers.data.ability.gui.AbilityFieldDefs;
|
||||
import noppes.npcs.api.ability.type.IAbilityVortex;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
@@ -62,18 +63,6 @@ public class AbilityVortex extends Ability implements IAbilityVortex {
|
||||
this.activeSound = "mob.ghast.fireball";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTypeSettings() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public SubGuiAbilityConfig createConfigGui(
|
||||
IAbilityConfigCallback callback) {
|
||||
return new SubGuiAbilityVortex(this, callback);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTargetingModeLocked() {
|
||||
return true;
|
||||
@@ -309,4 +298,31 @@ public class AbilityVortex extends Ability implements IAbilityVortex {
|
||||
public void setPullDamage(float pullDamage) {
|
||||
this.pullDamage = pullDamage;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public List<FieldDef> getFieldDefinitions() {
|
||||
return Arrays.asList(
|
||||
FieldDef.row(
|
||||
FieldDef.floatField("ability.pullRadius", this::getPullRadius, this::setPullRadius),
|
||||
FieldDef.floatField("ability.pullStrength", this::getPullStrength, this::setPullStrength)
|
||||
),
|
||||
FieldDef.section("ability.section.damage"),
|
||||
FieldDef.row(
|
||||
FieldDef.floatField("enchantment.damage", this::getDamage, this::setDamage),
|
||||
FieldDef.floatField("ability.knockback", this::getKnockback, this::setKnockback)
|
||||
),
|
||||
FieldDef.section("ability.section.aoe"),
|
||||
FieldDef.boolField("gui.enabled", this::isAoe, this::setAoe)
|
||||
.hover("ability.hover.aoe"),
|
||||
FieldDef.intField("ability.maxTargets", this::getMaxTargets, this::setMaxTargets)
|
||||
.visibleWhen(this::isAoe),
|
||||
FieldDef.section("ability.section.pullDamage"),
|
||||
FieldDef.boolField("gui.enabled", this::isDamageOnPull, this::setDamageOnPull)
|
||||
.hover("ability.hover.dmgOnPull"),
|
||||
FieldDef.floatField("enchantment.damage", this::getPullDamage, this::setPullDamage)
|
||||
.visibleWhen(this::isDamageOnPull),
|
||||
AbilityFieldDefs.effectsListField("ability.effects", this::getEffects, this::setEffects)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -33,6 +33,8 @@ public class BukkitUtil {
|
||||
private static Method getPluginManager;
|
||||
private static Method isPluginEnabled;
|
||||
|
||||
private static Method getPlugin;
|
||||
|
||||
/**
|
||||
* Initializes Bukkit integration using reflection.
|
||||
* Should be called during FMLServerStartedEvent to ensure Bukkit is fully loaded.
|
||||
@@ -63,6 +65,7 @@ public class BukkitUtil {
|
||||
|
||||
Class<?> pluginManagerClass = Class.forName("org.bukkit.plugin.PluginManager");
|
||||
isPluginEnabled = pluginManagerClass.getMethod("isPluginEnabled", String.class);
|
||||
getPlugin = pluginManagerClass.getMethod("getPlugin", String.class);
|
||||
|
||||
bukkitEnabled = true;
|
||||
logger.info("Bukkit integration enabled");
|
||||
@@ -95,7 +98,6 @@ public class BukkitUtil {
|
||||
|
||||
/**
|
||||
* Checks if a specific Bukkit plugin is enabled.
|
||||
*
|
||||
* @param pluginName the plugin name to check
|
||||
* @return true if the plugin is enabled
|
||||
*/
|
||||
@@ -113,7 +115,6 @@ public class BukkitUtil {
|
||||
|
||||
/**
|
||||
* Gets a Bukkit OfflinePlayer by name.
|
||||
*
|
||||
* @param playerName the player name
|
||||
* @return the OfflinePlayer object, or null if not available
|
||||
*/
|
||||
@@ -130,7 +131,6 @@ public class BukkitUtil {
|
||||
|
||||
/**
|
||||
* Gets a Bukkit Player by name (online players only).
|
||||
*
|
||||
* @param playerName the player name
|
||||
* @return the Player object, or null if not online or not available
|
||||
*/
|
||||
@@ -147,7 +147,6 @@ public class BukkitUtil {
|
||||
|
||||
/**
|
||||
* Gets a service provider from Bukkit's ServicesManager.
|
||||
*
|
||||
* @param serviceClass the service class to get
|
||||
* @return the service provider, or null if not available
|
||||
*/
|
||||
@@ -186,4 +185,13 @@ public class BukkitUtil {
|
||||
public static Class<?> getPlayerClass() {
|
||||
return playerClass;
|
||||
}
|
||||
|
||||
public static Object getPlugin(String plugin) {
|
||||
try {
|
||||
return getPlugin.invoke(getPluginManager.invoke(null), plugin);
|
||||
} catch (Throwable ignored) {
|
||||
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -75,8 +75,12 @@ public class VaultUtil {
|
||||
}
|
||||
|
||||
// Load Vault classes
|
||||
economyClass = Class.forName("net.milkbowl.vault.economy.Economy");
|
||||
economyResponseClass = Class.forName("net.milkbowl.vault.economy.EconomyResponse");
|
||||
Object vault = BukkitUtil.getPlugin("Vault");
|
||||
if (vault == null)
|
||||
return;
|
||||
ClassLoader vaultLoader = vault.getClass().getClassLoader();
|
||||
economyClass = vaultLoader.loadClass("net.milkbowl.vault.economy.Economy");
|
||||
economyResponseClass = vaultLoader.loadClass("net.milkbowl.vault.economy.EconomyResponse");
|
||||
|
||||
// Get Economy methods (using deprecated String methods for broader compatibility)
|
||||
isEnabled = economyClass.getMethod("isEnabled");
|
||||
@@ -174,7 +178,6 @@ public class VaultUtil {
|
||||
|
||||
/**
|
||||
* Checks if a player has an account in the economy system.
|
||||
*
|
||||
* @param player the player to check
|
||||
* @return true if the player has an account
|
||||
*/
|
||||
@@ -184,7 +187,6 @@ public class VaultUtil {
|
||||
|
||||
/**
|
||||
* Checks if a player has an account in the economy system.
|
||||
*
|
||||
* @param playerName the player name to check
|
||||
* @return true if the player has an account
|
||||
*/
|
||||
@@ -205,7 +207,6 @@ public class VaultUtil {
|
||||
|
||||
/**
|
||||
* Gets the balance of a player.
|
||||
*
|
||||
* @param player the player
|
||||
* @return the player's balance, or 0 if not available
|
||||
*/
|
||||
@@ -215,7 +216,6 @@ public class VaultUtil {
|
||||
|
||||
/**
|
||||
* Gets the balance of a player by name.
|
||||
*
|
||||
* @param playerName the player name
|
||||
* @return the player's balance, or 0 if not available
|
||||
*/
|
||||
@@ -236,7 +236,6 @@ public class VaultUtil {
|
||||
|
||||
/**
|
||||
* Checks if a player has at least the specified amount.
|
||||
*
|
||||
* @param player the player
|
||||
* @param amount the amount to check
|
||||
* @return true if the player has at least the specified amount
|
||||
@@ -247,9 +246,8 @@ public class VaultUtil {
|
||||
|
||||
/**
|
||||
* Checks if a player has at least the specified amount.
|
||||
*
|
||||
* @param playerName the player name
|
||||
* @param amount the amount to check
|
||||
* @param amount the amount to check
|
||||
* @return true if the player has at least the specified amount
|
||||
*/
|
||||
public static boolean has(String playerName, double amount) {
|
||||
@@ -269,7 +267,6 @@ public class VaultUtil {
|
||||
|
||||
/**
|
||||
* Withdraws money from a player's account.
|
||||
*
|
||||
* @param player the player
|
||||
* @param amount the amount to withdraw
|
||||
* @return true if the transaction was successful
|
||||
@@ -280,9 +277,8 @@ public class VaultUtil {
|
||||
|
||||
/**
|
||||
* Withdraws money from a player's account.
|
||||
*
|
||||
* @param playerName the player name
|
||||
* @param amount the amount to withdraw
|
||||
* @param amount the amount to withdraw
|
||||
* @return true if the transaction was successful
|
||||
*/
|
||||
public static boolean withdrawMoney(String playerName, double amount) {
|
||||
@@ -305,7 +301,6 @@ public class VaultUtil {
|
||||
|
||||
/**
|
||||
* Adds money to a player's account (deposit).
|
||||
*
|
||||
* @param player the player
|
||||
* @param amount the amount to add
|
||||
* @return true if the transaction was successful
|
||||
@@ -316,9 +311,8 @@ public class VaultUtil {
|
||||
|
||||
/**
|
||||
* Adds money to a player's account (deposit).
|
||||
*
|
||||
* @param playerName the player name
|
||||
* @param amount the amount to add
|
||||
* @param amount the amount to add
|
||||
* @return true if the transaction was successful
|
||||
*/
|
||||
public static boolean addMoney(String playerName, double amount) {
|
||||
@@ -342,7 +336,6 @@ public class VaultUtil {
|
||||
/**
|
||||
* Sets a player's balance to the specified amount.
|
||||
* This withdraws all money first, then deposits the new amount.
|
||||
*
|
||||
* @param player the player
|
||||
* @param amount the new balance
|
||||
* @return true if the transaction was successful
|
||||
@@ -354,9 +347,8 @@ public class VaultUtil {
|
||||
/**
|
||||
* Sets a player's balance to the specified amount.
|
||||
* This withdraws all money first, then deposits the new amount.
|
||||
*
|
||||
* @param playerName the player name
|
||||
* @param amount the new balance
|
||||
* @param amount the new balance
|
||||
* @return true if the transaction was successful
|
||||
*/
|
||||
public static boolean setBalance(String playerName, double amount) {
|
||||
@@ -376,7 +368,6 @@ public class VaultUtil {
|
||||
|
||||
/**
|
||||
* Formats an amount according to the economy plugin's settings.
|
||||
*
|
||||
* @param amount the amount to format
|
||||
* @return the formatted string, or the raw number as string if not available
|
||||
*/
|
||||
@@ -393,7 +384,6 @@ public class VaultUtil {
|
||||
|
||||
/**
|
||||
* Gets the plural currency name (e.g., "Dollars").
|
||||
*
|
||||
* @return the plural currency name, or "coins" if not available
|
||||
*/
|
||||
public static String getCurrencyNamePlural() {
|
||||
@@ -409,7 +399,6 @@ public class VaultUtil {
|
||||
|
||||
/**
|
||||
* Gets the singular currency name (e.g., "Dollar").
|
||||
*
|
||||
* @return the singular currency name, or "coin" if not available
|
||||
*/
|
||||
public static String getCurrencyNameSingular() {
|
||||
@@ -425,7 +414,6 @@ public class VaultUtil {
|
||||
|
||||
/**
|
||||
* Creates an account for the player if one doesn't exist.
|
||||
*
|
||||
* @param player the player
|
||||
* @return true if the account was created or already exists
|
||||
*/
|
||||
@@ -435,7 +423,6 @@ public class VaultUtil {
|
||||
|
||||
/**
|
||||
* Creates an account for the player if one doesn't exist.
|
||||
*
|
||||
* @param playerName the player name
|
||||
* @return true if the account was created or already exists
|
||||
*/
|
||||
@@ -472,7 +459,6 @@ public class VaultUtil {
|
||||
|
||||
/**
|
||||
* Gets a list of all bank names.
|
||||
*
|
||||
* @return list of bank names, or empty list if not available
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
@@ -489,7 +475,6 @@ public class VaultUtil {
|
||||
|
||||
/**
|
||||
* Gets the balance of a bank.
|
||||
*
|
||||
* @param bankName the bank name
|
||||
* @return the bank balance, or 0 if not available
|
||||
*/
|
||||
@@ -507,9 +492,8 @@ public class VaultUtil {
|
||||
|
||||
/**
|
||||
* Checks if a bank has at least the specified amount.
|
||||
*
|
||||
* @param bankName the bank name
|
||||
* @param amount the amount to check
|
||||
* @param amount the amount to check
|
||||
* @return true if the bank has at least the specified amount
|
||||
*/
|
||||
public static boolean bankHas(String bankName, double amount) {
|
||||
@@ -526,9 +510,8 @@ public class VaultUtil {
|
||||
|
||||
/**
|
||||
* Withdraws money from a bank.
|
||||
*
|
||||
* @param bankName the bank name
|
||||
* @param amount the amount to withdraw
|
||||
* @param amount the amount to withdraw
|
||||
* @return true if the transaction was successful
|
||||
*/
|
||||
public static boolean bankWithdraw(String bankName, double amount) {
|
||||
@@ -545,9 +528,8 @@ public class VaultUtil {
|
||||
|
||||
/**
|
||||
* Deposits money into a bank.
|
||||
*
|
||||
* @param bankName the bank name
|
||||
* @param amount the amount to deposit
|
||||
* @param amount the amount to deposit
|
||||
* @return true if the transaction was successful
|
||||
*/
|
||||
public static boolean bankDeposit(String bankName, double amount) {
|
||||
@@ -564,9 +546,8 @@ public class VaultUtil {
|
||||
|
||||
/**
|
||||
* Transfers money from one player to another.
|
||||
*
|
||||
* @param from the player to take money from
|
||||
* @param to the player to give money to
|
||||
* @param from the player to take money from
|
||||
* @param to the player to give money to
|
||||
* @param amount the amount to transfer
|
||||
* @return true if the transfer was successful
|
||||
*/
|
||||
@@ -576,10 +557,9 @@ public class VaultUtil {
|
||||
|
||||
/**
|
||||
* Transfers money from one player to another.
|
||||
*
|
||||
* @param fromPlayerName the player name to take money from
|
||||
* @param toPlayerName the player name to give money to
|
||||
* @param amount the amount to transfer
|
||||
* @param toPlayerName the player name to give money to
|
||||
* @param amount the amount to transfer
|
||||
* @return true if the transfer was successful
|
||||
*/
|
||||
public static boolean transfer(String fromPlayerName, String toPlayerName, double amount) {
|
||||
|
||||
@@ -66,8 +66,8 @@ public class CustomNpcsPermissions {
|
||||
public static final Permission GLOBAL_NATURALSPAWN = new Permission("customnpcs.global.naturalspawn");
|
||||
public static final Permission GLOBAL_TAG = new Permission("customnpcs.global.tag");
|
||||
public static final Permission GLOBAL_ANIMATION = new Permission("customnpcs.global.animation");
|
||||
public static final Permission GLOBAL_ABILITY = new Permission("customnpcs.global.ability");
|
||||
public static final Permission GLOBAL_MAGIC = new Permission("customnpcs.global.magic");
|
||||
public static final Permission GLOBAL_ABILITY = new Permission("customnpcs.global.ability");
|
||||
public static final Permission GLOBAL_EFFECT = new Permission("customnpcs.global.effect");
|
||||
|
||||
public static final Permission SPAWNER_MOB = new Permission("customnpcs.spawner.mob");
|
||||
@@ -111,9 +111,6 @@ public class CustomNpcsPermissions {
|
||||
public static final Permission PROFILE_REGION_BYPASS = new Permission("customnpcs.profile.region-bypass");
|
||||
public static final Permission PROFILE_MAX = new Permission("customnpcs.profile.max.*");
|
||||
|
||||
// Auction
|
||||
public static final Permission AUCTION_TRADES_MAX = new Permission("customnpcs.auction.trades.*");
|
||||
|
||||
public static CustomNpcsPermissions Instance;
|
||||
private Method hasPermission;
|
||||
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,328 +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.AbilityBeamDual;
|
||||
import noppes.npcs.client.gui.SubGuiColorSelector;
|
||||
import noppes.npcs.client.gui.advanced.SubGuiAbilityConfig;
|
||||
import noppes.npcs.client.gui.util.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class SubGuiAbilityBeamDual extends SubGuiAbilityConfig {
|
||||
private final AbilityBeamDual beam;
|
||||
private int editingVisualColorId = 0;
|
||||
private int editingBeam = 0;
|
||||
|
||||
public SubGuiAbilityBeamDual(AbilityBeamDual 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;
|
||||
|
||||
addLabel(new GuiNpcLabel(112, "ability.dualFire", labelX, y + 5));
|
||||
addButton(new GuiNpcButtonYesNo(112, fieldX, y, beam.isDualFire()));
|
||||
|
||||
if (beam.isDualFire()) {
|
||||
addLabel(new GuiNpcLabel(113, "ability.dualFireDelay", col2LabelX, y + 5));
|
||||
addTextField(createIntField(113, col2FieldX, y, 50, beam.getDualFireDelay()));
|
||||
}
|
||||
|
||||
y += 24;
|
||||
|
||||
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(editingBeam).ordinal());
|
||||
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(editingBeam) & 0xFFFFFF);
|
||||
GuiNpcButton innerColorBtn = new GuiNpcButton(200, fieldX, y, 55, 20, innerHex);
|
||||
innerColorBtn.setTextColor(beam.getInnerColor(editingBeam) & 0xFFFFFF);
|
||||
addButton(innerColorBtn);
|
||||
|
||||
addLabel(new GuiNpcLabel(201, "ability.outerColor", col2LabelX, y + 5));
|
||||
String outerHex = String.format("%06X", beam.getOuterColor(editingBeam) & 0xFFFFFF);
|
||||
GuiNpcButton outerColorBtn = new GuiNpcButton(201, col2FieldX, y, 55, 20, outerHex);
|
||||
outerColorBtn.setTextColor(beam.getOuterColor(editingBeam) & 0xFFFFFF);
|
||||
outerColorBtn.setEnabled(beam.isOuterColorEnabled(editingBeam));
|
||||
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(editingBeam) ? 1 : 0));
|
||||
|
||||
addLabel(new GuiNpcLabel(203, "ability.outerWidth", col2LabelX, y + 5));
|
||||
GuiNpcTextField widthField = createFloatField(203, col2FieldX, y, 55, beam.getOuterColorWidth(editingBeam));
|
||||
widthField.setEnabled(beam.isOuterColorEnabled(editingBeam));
|
||||
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(editingBeam));
|
||||
alphaField.setEnabled(beam.isOuterColorEnabled(editingBeam));
|
||||
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(editingBeam)));
|
||||
|
||||
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(editingBeam) ? 1 : 0);
|
||||
lightningBtn.setHoverText("ability.hover.lightning");
|
||||
addButton(lightningBtn);
|
||||
|
||||
// Only show Lightning settings if Lightning is enabled
|
||||
if (beam.hasLightningEffect(editingBeam)) {
|
||||
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, "" + beam.getLightningDensity(editingBeam));
|
||||
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, "" + beam.getLightningRadius(editingBeam));
|
||||
radiusField.setMinMaxDefaultFloat(0.1f, 10.0f, 0.5f);
|
||||
addTextField(radiusField);
|
||||
}
|
||||
|
||||
y += 24;
|
||||
|
||||
addButton(new GuiNpcButton(400, col2FieldX, y, 55, 20, new String[]{"Beam 1", "Beam 2"}, editingBeam));
|
||||
}
|
||||
|
||||
@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 112:
|
||||
beam.setDualFire(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(editingBeam)));
|
||||
break;
|
||||
case 201:
|
||||
editingVisualColorId = 201;
|
||||
setSubGui(new SubGuiColorSelector(beam.getOuterColor(editingBeam)));
|
||||
break;
|
||||
case 202:
|
||||
beam.setOuterColorEnabled(editingBeam, value == 1);
|
||||
initGui();
|
||||
break;
|
||||
case 206:
|
||||
beam.setLightningEffect(editingBeam, value == 1);
|
||||
initGui();
|
||||
break;
|
||||
case 210:
|
||||
beam.setAnchorPointEnum(editingBeam, AnchorPoint.fromOrdinal(value));
|
||||
break;
|
||||
case 400:
|
||||
editingBeam = (editingBeam + 1) % 2;
|
||||
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) {
|
||||
beam.setInnerColor(editingBeam, rgb);
|
||||
} else if (editingVisualColorId == 201) {
|
||||
beam.setOuterColor(editingBeam, 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;
|
||||
case 113:
|
||||
beam.setDualFireDelay(field.getInteger());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void handleVisualTextField(int id, GuiNpcTextField field) {
|
||||
switch (id) {
|
||||
case 203:
|
||||
beam.setOuterColorWidth(editingBeam, parseFloat(field, beam.getOuterColorWidth(editingBeam)));
|
||||
break;
|
||||
case 204:
|
||||
beam.setOuterColorAlpha(editingBeam, parseFloat(field, beam.getOuterColorAlpha(editingBeam)));
|
||||
break;
|
||||
case 205:
|
||||
beam.setRotationSpeed(editingBeam, parseFloat(field, beam.getRotationSpeed(editingBeam)));
|
||||
break;
|
||||
case 207:
|
||||
beam.setLightningDensity(editingBeam, parseFloat(field, beam.getLightningDensity(editingBeam)));
|
||||
break;
|
||||
case 208:
|
||||
beam.setLightningRadius(editingBeam, parseFloat(field, beam.getLightningRadius(editingBeam)));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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().ordinal());
|
||||
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, "" + 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, "" + 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.fromOrdinal(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,341 +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.AbilityDiscDual;
|
||||
import noppes.npcs.client.gui.SubGuiColorSelector;
|
||||
import noppes.npcs.client.gui.advanced.SubGuiAbilityConfig;
|
||||
import noppes.npcs.client.gui.util.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class SubGuiAbilityDiscDual extends SubGuiAbilityConfig {
|
||||
private final AbilityDiscDual disc;
|
||||
private int editingVisualColorId = 0;
|
||||
private int editingDisc = 0;
|
||||
|
||||
public SubGuiAbilityDiscDual(AbilityDiscDual 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()));
|
||||
|
||||
y += 24;
|
||||
|
||||
addLabel(new GuiNpcLabel(113, "ability.dualFire", labelX, y + 5));
|
||||
addButton(new GuiNpcButtonYesNo(113, fieldX, y, disc.isDualFire()));
|
||||
|
||||
if (disc.isDualFire()) {
|
||||
addLabel(new GuiNpcLabel(114, "ability.dualFireDelay", col2LabelX, y + 5));
|
||||
addTextField(createIntField(114, col2FieldX, y, 50, disc.getDualFireDelay()));
|
||||
}
|
||||
|
||||
addButton(new GuiNpcButton(150, col2LabelX + 120, 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(editingDisc).ordinal());
|
||||
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(editingDisc) & 0xFFFFFF);
|
||||
GuiNpcButton innerColorBtn = new GuiNpcButton(200, fieldX, y, 55, 20, innerHex);
|
||||
innerColorBtn.setTextColor(disc.getInnerColor(editingDisc) & 0xFFFFFF);
|
||||
addButton(innerColorBtn);
|
||||
|
||||
addLabel(new GuiNpcLabel(201, "ability.outerColor", col2LabelX, y + 5));
|
||||
String outerHex = String.format("%06X", disc.getOuterColor(editingDisc) & 0xFFFFFF);
|
||||
GuiNpcButton outerColorBtn = new GuiNpcButton(201, col2FieldX, y, 55, 20, outerHex);
|
||||
outerColorBtn.setTextColor(disc.getOuterColor(editingDisc) & 0xFFFFFF);
|
||||
outerColorBtn.setEnabled(disc.isOuterColorEnabled(editingDisc));
|
||||
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(editingDisc) ? 1 : 0));
|
||||
|
||||
addLabel(new GuiNpcLabel(203, "ability.outerWidth", col2LabelX, y + 5));
|
||||
GuiNpcTextField widthField = createFloatField(203, col2FieldX, y, 55, disc.getOuterColorWidth(editingDisc));
|
||||
widthField.setEnabled(disc.isOuterColorEnabled(editingDisc));
|
||||
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(editingDisc));
|
||||
alphaField.setEnabled(disc.isOuterColorEnabled(editingDisc));
|
||||
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(editingDisc)));
|
||||
|
||||
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(editingDisc) ? 1 : 0);
|
||||
lightningBtn.setHoverText("ability.hover.lightning");
|
||||
addButton(lightningBtn);
|
||||
|
||||
// Only show Lightning settings if Lightning is enabled
|
||||
if (disc.hasLightningEffect(editingDisc)) {
|
||||
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, "" + disc.getLightningDensity(editingDisc));
|
||||
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, "" + disc.getLightningRadius(editingDisc));
|
||||
radiusField.setMinMaxDefaultFloat(0.1f, 10.0f, 0.5f);
|
||||
addTextField(radiusField);
|
||||
}
|
||||
|
||||
y += 24;
|
||||
|
||||
addButton(new GuiNpcButton(400, col2FieldX, y, 55, 20, new String[]{"Disc 1", "Disc 2"}, editingDisc));
|
||||
}
|
||||
|
||||
@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 113:
|
||||
disc.setDualFire(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(editingDisc)));
|
||||
break;
|
||||
case 201:
|
||||
editingVisualColorId = 201;
|
||||
setSubGui(new SubGuiColorSelector(disc.getOuterColor(editingDisc)));
|
||||
break;
|
||||
case 202:
|
||||
disc.setOuterColorEnabled(editingDisc, value == 1);
|
||||
initGui();
|
||||
break;
|
||||
case 206:
|
||||
disc.setLightningEffect(editingDisc, value == 1);
|
||||
initGui();
|
||||
break;
|
||||
case 210:
|
||||
disc.setAnchorPointEnum(editingDisc, AnchorPoint.fromOrdinal(value));
|
||||
break;
|
||||
case 400:
|
||||
editingDisc = (editingDisc + 1) % 2;
|
||||
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) {
|
||||
disc.setInnerColor(editingDisc, rgb);
|
||||
} else if (editingVisualColorId == 201) {
|
||||
disc.setOuterColor(editingDisc, 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;
|
||||
case 114:
|
||||
disc.setDualFireDelay(field.getInteger());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void handleVisualTextField(int id, GuiNpcTextField field) {
|
||||
switch (id) {
|
||||
case 203:
|
||||
disc.setOuterColorWidth(editingDisc, parseFloat(field, disc.getOuterColorWidth(editingDisc)));
|
||||
break;
|
||||
case 204:
|
||||
disc.setOuterColorAlpha(editingDisc, parseFloat(field, disc.getOuterColorAlpha(editingDisc)));
|
||||
break;
|
||||
case 205:
|
||||
disc.setRotationSpeed(editingDisc, parseFloat(field, disc.getRotationSpeed(editingDisc)));
|
||||
break;
|
||||
case 207:
|
||||
disc.setLightningDensity(editingDisc, parseFloat(field, disc.getLightningDensity(editingDisc)));
|
||||
break;
|
||||
case 208:
|
||||
disc.setLightningRadius(editingDisc, parseFloat(field, disc.getLightningRadius(editingDisc)));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,202 +0,0 @@
|
||||
package noppes.npcs.client.gui.advanced.ability;
|
||||
|
||||
import kamkeel.npcs.controllers.data.ability.AbilityEffect;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
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.ITextfieldListener;
|
||||
import noppes.npcs.client.gui.util.SubGuiInterface;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* SubGui for editing ability effects (potion effects that apply to targets).
|
||||
* Allows adding/removing effects and configuring type, duration, and amplifier.
|
||||
*/
|
||||
public class SubGuiAbilityEffects extends SubGuiInterface implements ITextfieldListener {
|
||||
|
||||
private static final int MAX_EFFECTS = 5;
|
||||
|
||||
// Effect type names for display
|
||||
private static final String[] EFFECT_TYPE_NAMES = {
|
||||
"gui.none",
|
||||
"potion.moveSlowdown",
|
||||
"potion.weakness",
|
||||
"potion.poison",
|
||||
"potion.wither",
|
||||
"potion.blindness",
|
||||
"potion.confusion",
|
||||
"potion.hunger",
|
||||
"potion.digSlowDown"
|
||||
};
|
||||
|
||||
// Working copy of effects
|
||||
private List<AbilityEffect> effects;
|
||||
private boolean cancelled = false;
|
||||
|
||||
public SubGuiAbilityEffects(List<AbilityEffect> existingEffects) {
|
||||
// Create working copies of effects
|
||||
this.effects = new ArrayList<>();
|
||||
if (existingEffects != null) {
|
||||
for (AbilityEffect effect : existingEffects) {
|
||||
this.effects.add(effect.copy());
|
||||
}
|
||||
}
|
||||
|
||||
setBackground("menubg.png");
|
||||
xSize = 280;
|
||||
ySize = 180;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
|
||||
int y = guiTop + 8;
|
||||
int labelX = guiLeft + 8;
|
||||
|
||||
// Title
|
||||
addLabel(new GuiNpcLabel(0, "ability.effects", labelX, y));
|
||||
y += 16;
|
||||
|
||||
// Column headers
|
||||
addLabel(new GuiNpcLabel(1, "gui.type", guiLeft + 10, y));
|
||||
addLabel(new GuiNpcLabel(2, "gui.duration", guiLeft + 115, y));
|
||||
addLabel(new GuiNpcLabel(3, "gui.amp", guiLeft + 175, y));
|
||||
y += 14;
|
||||
|
||||
// Effect rows
|
||||
for (int i = 0; i < effects.size() && i < MAX_EFFECTS; i++) {
|
||||
AbilityEffect effect = effects.get(i);
|
||||
int baseId = 1 + i * 10;
|
||||
|
||||
// Type selector button
|
||||
int typeIndex = effect.getType().ordinal();
|
||||
GuiNpcButton typeBtn = new GuiNpcButton(baseId, guiLeft + 8, y, 100, 20, EFFECT_TYPE_NAMES, typeIndex);
|
||||
typeBtn.setHoverText("effect.hover.type");
|
||||
addButton(typeBtn);
|
||||
|
||||
// Duration text field
|
||||
GuiNpcTextField durField = new GuiNpcTextField(baseId + 1, this, fontRendererObj,
|
||||
guiLeft + 112, y, 50, 20, "" + effect.getDurationTicks());
|
||||
durField.setIntegersOnly();
|
||||
durField.setMinMaxDefault(1, 12000, 60);
|
||||
durField.setHoverText("effect.hover.duration");
|
||||
addTextField(durField);
|
||||
|
||||
// Amplifier selector (0-10)
|
||||
String[] ampValues = new String[11];
|
||||
for (int a = 0; a <= 10; a++) {
|
||||
ampValues[a] = "" + a;
|
||||
}
|
||||
GuiNpcButton ampBtn = new GuiNpcButton(baseId + 2, guiLeft + 168, y, 40, 20, ampValues, effect.getAmplifier());
|
||||
ampBtn.setHoverText("effect.hover.amplifier");
|
||||
addButton(ampBtn);
|
||||
|
||||
// Delete button
|
||||
addButton(new GuiNpcButton(baseId + 3, guiLeft + 215, y, 20, 20, "X"));
|
||||
|
||||
y += 24;
|
||||
}
|
||||
|
||||
// Add button (if space available)
|
||||
if (effects.size() < MAX_EFFECTS) {
|
||||
addButton(new GuiNpcButton(100, guiLeft + 8, y, 50, 20, "gui.add"));
|
||||
}
|
||||
|
||||
// Bottom buttons
|
||||
addButton(new GuiNpcButton(65, guiLeft + 8, guiTop + ySize - 28, 60, 20, "gui.cancel"));
|
||||
addButton(new GuiNpcButton(66, guiLeft + xSize - 68, guiTop + ySize - 28, 60, 20, "gui.done"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void buttonEvent(GuiButton guibutton) {
|
||||
int id = guibutton.id;
|
||||
|
||||
// Add button
|
||||
if (id == 100) {
|
||||
if (effects.size() < MAX_EFFECTS) {
|
||||
// Add new effect with default values (Slowness, 60 ticks, amp 0)
|
||||
effects.add(new AbilityEffect(AbilityEffect.EffectType.SLOWNESS, 60, 0));
|
||||
initGui();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Cancel button
|
||||
if (id == 65) {
|
||||
cancelled = true;
|
||||
close();
|
||||
return;
|
||||
}
|
||||
|
||||
// Done button
|
||||
if (id == 66) {
|
||||
// Remove any NONE effects before saving
|
||||
effects.removeIf(e -> !e.isValid());
|
||||
cancelled = false;
|
||||
close();
|
||||
return;
|
||||
}
|
||||
|
||||
// Effect row buttons (id >= 1 and < 100)
|
||||
if (id >= 1 && id < 100) {
|
||||
int effectIndex = (id - 1) / 10;
|
||||
int action = (id - 1) % 10;
|
||||
|
||||
if (effectIndex >= 0 && effectIndex < effects.size()) {
|
||||
AbilityEffect effect = effects.get(effectIndex);
|
||||
|
||||
switch (action) {
|
||||
case 0: // Type selector
|
||||
int typeIndex = ((GuiNpcButton) guibutton).getValue();
|
||||
effect.setType(AbilityEffect.EffectType.fromOrdinal(typeIndex));
|
||||
break;
|
||||
case 2: // Amplifier selector
|
||||
int amp = ((GuiNpcButton) guibutton).getValue();
|
||||
effect.setAmplifier(amp);
|
||||
break;
|
||||
case 3: // Delete button
|
||||
effects.remove(effectIndex);
|
||||
initGui();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unFocused(GuiNpcTextField textField) {
|
||||
int id = textField.id;
|
||||
|
||||
// Duration text fields (baseId + 1)
|
||||
if (id >= 2 && id < 100) {
|
||||
int effectIndex = (id - 1) / 10;
|
||||
int action = (id - 1) % 10;
|
||||
|
||||
if (action == 1 && effectIndex >= 0 && effectIndex < effects.size()) {
|
||||
effects.get(effectIndex).setDurationTicks(textField.getInteger());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the resulting effects list after the dialog closes.
|
||||
* Returns null if cancelled.
|
||||
*/
|
||||
public List<AbilityEffect> getResult() {
|
||||
if (cancelled) {
|
||||
return null;
|
||||
}
|
||||
return effects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the dialog was cancelled.
|
||||
*/
|
||||
public boolean wasCancelled() {
|
||||
return cancelled;
|
||||
}
|
||||
}
|
||||
@@ -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().ordinal());
|
||||
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, "" + 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, "" + 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.fromOrdinal(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,280 +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.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: Anchor Point
|
||||
addLabel(new GuiNpcLabel(210, "ability.anchorPoint", labelX, y + 5));
|
||||
GuiNpcButton anchorBtn = new GuiNpcButton(210, fieldX, y, 80, 20, AnchorPoint.getDisplayNames(), laser.getAnchorPointEnum().ordinal());
|
||||
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", 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 3: 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 4: 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 5: Density + Radius
|
||||
addLabel(new GuiNpcLabel(206, "ability.lightningDensity", labelX, y + 5));
|
||||
GuiNpcTextField densityField = new GuiNpcTextField(206, this, fontRendererObj, fieldX, y, 55, 18, "" + 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, "" + 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;
|
||||
case 210:
|
||||
laser.setAnchorPointEnum(AnchorPoint.fromOrdinal(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) {
|
||||
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().ordinal());
|
||||
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, "" + 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, "" + 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.fromOrdinal(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,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.AbilityOrbDual;
|
||||
import noppes.npcs.client.gui.SubGuiColorSelector;
|
||||
import noppes.npcs.client.gui.advanced.SubGuiAbilityConfig;
|
||||
import noppes.npcs.client.gui.util.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class SubGuiAbilityOrbDual extends SubGuiAbilityConfig {
|
||||
private final AbilityOrbDual orb;
|
||||
private int editingVisualColorId = 0;
|
||||
private int editingOrb = 0;
|
||||
|
||||
public SubGuiAbilityOrbDual(AbilityOrbDual 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;
|
||||
|
||||
addLabel(new GuiNpcLabel(110, "ability.dualFire", labelX, y + 5));
|
||||
addButton(new GuiNpcButtonYesNo(110, fieldX, y, orb.isDualFire()));
|
||||
|
||||
if (orb.isDualFire()) {
|
||||
addLabel(new GuiNpcLabel(111, "ability.dualFireDelay", col2LabelX, y + 5));
|
||||
addTextField(createIntField(111, col2FieldX, y, 50, orb.getDualFireDelay()));
|
||||
}
|
||||
|
||||
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(), orb.getAnchorPointEnum(editingOrb).ordinal());
|
||||
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(editingOrb) & 0xFFFFFF);
|
||||
GuiNpcButton innerColorBtn = new GuiNpcButton(200, fieldX, y, 55, 20, innerHex);
|
||||
innerColorBtn.setTextColor(orb.getInnerColor(editingOrb) & 0xFFFFFF);
|
||||
addButton(innerColorBtn);
|
||||
|
||||
addLabel(new GuiNpcLabel(205, "ability.rotationSpeed", col2LabelX, y + 5));
|
||||
addTextField(createFloatField(205, col2FieldX, y, 55, orb.getRotationSpeed(editingOrb)));
|
||||
|
||||
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(editingOrb) ? 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(editingOrb));
|
||||
alphaField.setEnabled(orb.isOuterColorEnabled(editingOrb));
|
||||
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(editingOrb) & 0xFFFFFF);
|
||||
GuiNpcButton outerColorBtn = new GuiNpcButton(201, fieldX, y, 55, 20, outerHex);
|
||||
outerColorBtn.setTextColor(orb.getOuterColor(editingOrb) & 0xFFFFFF);
|
||||
addButton(outerColorBtn);
|
||||
|
||||
addLabel(new GuiNpcLabel(203, "ability.outerWidth", col2LabelX, y + 5));
|
||||
addTextField(createFloatField(203, col2FieldX, y, 55, orb.getOuterColorWidth(editingOrb)));
|
||||
}
|
||||
|
||||
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(editingOrb) ? 1 : 0);
|
||||
lightningBtn.setHoverText("ability.hover.lightning");
|
||||
addButton(lightningBtn);
|
||||
|
||||
// Only show Lightning settings if Lightning is enabled
|
||||
if (orb.hasLightningEffect(editingOrb)) {
|
||||
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, "" + orb.getLightningDensity(editingOrb));
|
||||
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, "" + orb.getLightningRadius(editingOrb));
|
||||
radiusField.setMinMaxDefaultFloat(0.1f, 10.0f, 0.5f);
|
||||
addTextField(radiusField);
|
||||
}
|
||||
|
||||
y += 24;
|
||||
|
||||
addButton(new GuiNpcButton(400, col2FieldX, y, 55, 20, new String[]{"Orb 1", "Orb 2"}, editingOrb));
|
||||
}
|
||||
|
||||
@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 110:
|
||||
orb.setDualFire(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(editingOrb)));
|
||||
break;
|
||||
case 201:
|
||||
editingVisualColorId = 201;
|
||||
setSubGui(new SubGuiColorSelector(orb.getOuterColor(editingOrb)));
|
||||
break;
|
||||
case 202:
|
||||
orb.setOuterColorEnabled(editingOrb, value == 1);
|
||||
initGui();
|
||||
break;
|
||||
case 206:
|
||||
orb.setLightningEffect(editingOrb, value == 1);
|
||||
initGui();
|
||||
break;
|
||||
case 210:
|
||||
orb.setAnchorPointEnum(editingOrb, AnchorPoint.fromOrdinal(value));
|
||||
break;
|
||||
case 400:
|
||||
editingOrb = (editingOrb + 1) % 2;
|
||||
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) {
|
||||
orb.setInnerColor(editingOrb, rgb);
|
||||
} else if (editingVisualColorId == 201) {
|
||||
orb.setOuterColor(editingOrb, 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;
|
||||
case 111:
|
||||
orb.setDualFireDelay(field.getInteger());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void handleVisualTextField(int id, GuiNpcTextField field) {
|
||||
switch (id) {
|
||||
case 203:
|
||||
orb.setOuterColorWidth(editingOrb, parseFloat(field, orb.getOuterColorWidth(editingOrb)));
|
||||
break;
|
||||
case 204:
|
||||
orb.setOuterColorAlpha(editingOrb, parseFloat(field, orb.getOuterColorAlpha(editingOrb)));
|
||||
break;
|
||||
case 205:
|
||||
orb.setRotationSpeed(editingOrb, parseFloat(field, orb.getRotationSpeed(editingOrb)));
|
||||
break;
|
||||
case 207:
|
||||
orb.setLightningDensity(editingOrb, parseFloat(field, orb.getLightningDensity(editingOrb)));
|
||||
break;
|
||||
case 208:
|
||||
orb.setLightningRadius(editingOrb, parseFloat(field, orb.getLightningRadius(editingOrb)));
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,300 @@
|
||||
package noppes.npcs.client.gui.builder;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import noppes.npcs.controllers.AnimationController;
|
||||
import noppes.npcs.controllers.data.Animation;
|
||||
import noppes.npcs.client.gui.SubGuiColorSelector;
|
||||
import noppes.npcs.client.gui.select.GuiAnimationSelection;
|
||||
import noppes.npcs.client.gui.select.GuiSoundSelection;
|
||||
import noppes.npcs.client.gui.util.SubGuiInterface;
|
||||
|
||||
import java.util.function.BooleanSupplier;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
/**
|
||||
* Declarative field definition for GUI rendering.
|
||||
* Built via static factories and chaining methods.
|
||||
* Client-side only — never instantiate or reference on the server.
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class FieldDef {
|
||||
|
||||
private final String label;
|
||||
private final FieldType type;
|
||||
private String tab = null;
|
||||
private Supplier<Object> getter;
|
||||
private Consumer<Object> setter;
|
||||
private BooleanSupplier visibleWhen = () -> true;
|
||||
private BooleanSupplier enabledWhen = () -> true;
|
||||
private String hoverText = null;
|
||||
|
||||
// Numeric range
|
||||
private float min = Float.MIN_VALUE;
|
||||
private float max = Float.MAX_VALUE;
|
||||
|
||||
// Enum support
|
||||
private Class<? extends Enum<?>> enumClass;
|
||||
private String[] stringEnumValues;
|
||||
private Supplier<String> stringEnumGetter;
|
||||
private Consumer<String> stringEnumSetter;
|
||||
|
||||
// Sub-gui support
|
||||
private Supplier<SubGuiInterface> subGuiFactory;
|
||||
private Consumer<SubGuiInterface> subGuiResultHandler;
|
||||
|
||||
// Button display
|
||||
private Supplier<String> buttonLabelSupplier;
|
||||
private Supplier<Integer> buttonTextColorSupplier;
|
||||
private Runnable clearAction;
|
||||
|
||||
// Row pairing (ROW type only)
|
||||
private FieldDef leftChild;
|
||||
private FieldDef rightChild;
|
||||
|
||||
private FieldDef(String label, FieldType type) {
|
||||
this.label = label;
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
// ═══════════════════════════════════════════════════════════════════
|
||||
// STATIC FACTORIES
|
||||
// ═══════════════════════════════════════════════════════════════════
|
||||
|
||||
public static FieldDef section(String label) {
|
||||
return new FieldDef(label, FieldType.SECTION_HEADER);
|
||||
}
|
||||
|
||||
public static FieldDef floatField(String label, Supplier<Float> getter, Consumer<Float> setter) {
|
||||
FieldDef def = new FieldDef(label, FieldType.FLOAT);
|
||||
def.getter = () -> getter.get();
|
||||
def.setter = v -> setter.accept(((Number) v).floatValue());
|
||||
return def;
|
||||
}
|
||||
|
||||
public static FieldDef intField(String label, Supplier<Integer> getter, Consumer<Integer> setter) {
|
||||
FieldDef def = new FieldDef(label, FieldType.INT);
|
||||
def.getter = () -> getter.get();
|
||||
def.setter = v -> setter.accept(((Number) v).intValue());
|
||||
return def;
|
||||
}
|
||||
|
||||
public static FieldDef boolField(String label, Supplier<Boolean> getter, Consumer<Boolean> setter) {
|
||||
FieldDef def = new FieldDef(label, FieldType.BOOLEAN);
|
||||
def.getter = () -> getter.get();
|
||||
def.setter = v -> setter.accept((Boolean) v);
|
||||
return def;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static <E extends Enum<E>> FieldDef enumField(String label, Class<E> enumClass, Supplier<E> getter, Consumer<E> setter) {
|
||||
FieldDef def = new FieldDef(label, FieldType.ENUM);
|
||||
def.enumClass = enumClass;
|
||||
def.getter = () -> getter.get();
|
||||
def.setter = v -> setter.accept((E) v);
|
||||
return def;
|
||||
}
|
||||
|
||||
public static FieldDef stringEnumField(String label, String[] values, Supplier<String> getter, Consumer<String> setter) {
|
||||
FieldDef def = new FieldDef(label, FieldType.STRING_ENUM);
|
||||
def.stringEnumValues = values;
|
||||
def.stringEnumGetter = getter;
|
||||
def.stringEnumSetter = setter;
|
||||
return def;
|
||||
}
|
||||
|
||||
public static FieldDef stringField(String label, Supplier<String> getter, Consumer<String> setter) {
|
||||
FieldDef def = new FieldDef(label, FieldType.STRING);
|
||||
def.getter = () -> getter.get();
|
||||
def.setter = v -> setter.accept((String) v);
|
||||
return def;
|
||||
}
|
||||
|
||||
public static FieldDef labelField(String label, Supplier<String> textSupplier) {
|
||||
FieldDef def = new FieldDef(label, FieldType.LABEL);
|
||||
def.getter = () -> textSupplier.get();
|
||||
return def;
|
||||
}
|
||||
|
||||
public static FieldDef subGuiField(String label, Supplier<SubGuiInterface> factory, Consumer<SubGuiInterface> resultHandler) {
|
||||
FieldDef def = new FieldDef(label, FieldType.SUB_GUI);
|
||||
def.subGuiFactory = factory;
|
||||
def.subGuiResultHandler = resultHandler;
|
||||
return def;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a FieldDef with a custom FieldType. Used by extension code
|
||||
* (e.g. AbilityFieldDefs) to create fields with types like EFFECTS_LIST
|
||||
* that the base GuiFieldBuilder does not handle.
|
||||
*/
|
||||
public static FieldDef custom(String label, FieldType type, Supplier<Object> getter, Consumer<Object> setter) {
|
||||
FieldDef def = new FieldDef(label, type);
|
||||
def.getter = getter;
|
||||
def.setter = setter;
|
||||
return def;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a two-column row pairing two fields side by side.
|
||||
* If one child is hidden (via visibleWhen), the other renders full-width.
|
||||
*/
|
||||
public static FieldDef row(FieldDef left, FieldDef right) {
|
||||
FieldDef def = new FieldDef("", FieldType.ROW);
|
||||
def.leftChild = left;
|
||||
def.rightChild = right;
|
||||
return def;
|
||||
}
|
||||
|
||||
// ═══════════════════════════════════════════════════════════════════
|
||||
// CONVENIENCE FACTORIES (SUB_GUI wrappers)
|
||||
// ═══════════════════════════════════════════════════════════════════
|
||||
|
||||
public static FieldDef colorSubGui(String label, Supplier<Integer> getter, Consumer<Integer> setter) {
|
||||
return subGuiField(label,
|
||||
() -> new SubGuiColorSelector(getter.get()),
|
||||
gui -> setter.accept(((SubGuiColorSelector) gui).color & 0x00FFFFFF))
|
||||
.buttonLabel(() -> String.format("%06X", getter.get() & 0xFFFFFF))
|
||||
.buttonTextColor(() -> getter.get() & 0xFFFFFF);
|
||||
}
|
||||
|
||||
public static FieldDef soundSubGui(String label, Supplier<String> getter, Consumer<String> setter) {
|
||||
return subGuiField(label,
|
||||
() -> new GuiSoundSelection(getter.get()),
|
||||
gui -> {
|
||||
GuiSoundSelection s = (GuiSoundSelection) gui;
|
||||
if (s.selectedResource != null) setter.accept(s.selectedResource.toString());
|
||||
})
|
||||
.buttonLabel(() -> {
|
||||
String s = getter.get();
|
||||
return s == null || s.isEmpty() ? "gui.none" : s;
|
||||
})
|
||||
.clearable(() -> setter.accept(""));
|
||||
}
|
||||
|
||||
public static FieldDef animSubGui(String label,
|
||||
Supplier<Integer> idGetter, Consumer<Integer> idSetter,
|
||||
Supplier<String> nameGetter, Consumer<String> nameSetter) {
|
||||
return subGuiField(label,
|
||||
() -> new GuiAnimationSelection(idGetter.get(), nameGetter.get()),
|
||||
gui -> {
|
||||
GuiAnimationSelection sel = (GuiAnimationSelection) gui;
|
||||
if (sel.isBuiltInSelected()) {
|
||||
nameSetter.accept(sel.selectedBuiltInName);
|
||||
idSetter.accept(-1);
|
||||
} else {
|
||||
idSetter.accept(sel.selectedAnimationId);
|
||||
nameSetter.accept("");
|
||||
}
|
||||
})
|
||||
.buttonLabel(() -> {
|
||||
String name = nameGetter.get();
|
||||
if (name != null && !name.isEmpty()) return name;
|
||||
int id = idGetter.get();
|
||||
if (id >= 0) {
|
||||
Animation anim = AnimationController.Instance != null
|
||||
? (Animation) AnimationController.Instance.get(id) : null;
|
||||
String animName = anim != null ? anim.getName() : "";
|
||||
return animName != null && !animName.isEmpty()
|
||||
? "(ID: " + id + ") " + animName : "ID: " + id;
|
||||
}
|
||||
return "gui.none";
|
||||
})
|
||||
.clearable(() -> { idSetter.accept(-1); nameSetter.accept(""); });
|
||||
}
|
||||
|
||||
// ═══════════════════════════════════════════════════════════════════
|
||||
// CHAINING METHODS
|
||||
// ═══════════════════════════════════════════════════════════════════
|
||||
|
||||
public FieldDef tab(String tabName) {
|
||||
this.tab = tabName;
|
||||
return this;
|
||||
}
|
||||
|
||||
public FieldDef range(float min, float max) {
|
||||
this.min = min;
|
||||
this.max = max;
|
||||
return this;
|
||||
}
|
||||
|
||||
public FieldDef visibleWhen(BooleanSupplier condition) {
|
||||
this.visibleWhen = condition;
|
||||
return this;
|
||||
}
|
||||
|
||||
public FieldDef enabledWhen(BooleanSupplier condition) {
|
||||
this.enabledWhen = condition;
|
||||
return this;
|
||||
}
|
||||
|
||||
public FieldDef hover(String hoverText) {
|
||||
this.hoverText = hoverText;
|
||||
return this;
|
||||
}
|
||||
|
||||
public FieldDef buttonLabel(Supplier<String> supplier) {
|
||||
this.buttonLabelSupplier = supplier;
|
||||
return this;
|
||||
}
|
||||
|
||||
public FieldDef buttonTextColor(Supplier<Integer> supplier) {
|
||||
this.buttonTextColorSupplier = supplier;
|
||||
return this;
|
||||
}
|
||||
|
||||
public FieldDef clearable(Runnable action) {
|
||||
this.clearAction = action;
|
||||
return this;
|
||||
}
|
||||
|
||||
// ═══════════════════════════════════════════════════════════════════
|
||||
// GETTERS
|
||||
// ═══════════════════════════════════════════════════════════════════
|
||||
|
||||
public String getLabel() { return label; }
|
||||
public FieldType getType() { return type; }
|
||||
public String getTab() { return tab; }
|
||||
public boolean isVisible() { return visibleWhen.getAsBoolean(); }
|
||||
public boolean isEnabled() { return enabledWhen.getAsBoolean(); }
|
||||
public String getHoverText() { return hoverText; }
|
||||
public float getMin() { return min; }
|
||||
public float getMax() { return max; }
|
||||
public boolean hasRange() { return min != Float.MIN_VALUE || max != Float.MAX_VALUE; }
|
||||
public Class<? extends Enum<?>> getEnumClass() { return enumClass; }
|
||||
public String[] getStringEnumValues() { return stringEnumValues; }
|
||||
public Supplier<SubGuiInterface> getSubGuiFactory() { return subGuiFactory; }
|
||||
public Consumer<SubGuiInterface> getSubGuiResultHandler() { return subGuiResultHandler; }
|
||||
public boolean hasClearAction() { return clearAction != null; }
|
||||
public Runnable getClearAction() { return clearAction; }
|
||||
|
||||
public Object getValue() {
|
||||
return getter != null ? getter.get() : null;
|
||||
}
|
||||
|
||||
public void setValue(Object value) {
|
||||
if (setter != null) setter.accept(value);
|
||||
}
|
||||
|
||||
public String getStringEnumValue() {
|
||||
return stringEnumGetter != null ? stringEnumGetter.get() : null;
|
||||
}
|
||||
|
||||
public void setStringEnumValue(String value) {
|
||||
if (stringEnumSetter != null) stringEnumSetter.accept(value);
|
||||
}
|
||||
|
||||
public String getButtonLabel() {
|
||||
if (buttonLabelSupplier != null) return buttonLabelSupplier.get();
|
||||
return label;
|
||||
}
|
||||
|
||||
public Integer getButtonTextColor() {
|
||||
return buttonTextColorSupplier != null ? buttonTextColorSupplier.get() : null;
|
||||
}
|
||||
|
||||
public FieldDef getLeftChild() { return leftChild; }
|
||||
public FieldDef getRightChild() { return rightChild; }
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package noppes.npcs.client.gui.builder;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public enum FieldType {
|
||||
FLOAT,
|
||||
INT,
|
||||
BOOLEAN,
|
||||
ENUM,
|
||||
STRING_ENUM,
|
||||
SUB_GUI,
|
||||
STRING,
|
||||
SECTION_HEADER,
|
||||
LABEL,
|
||||
EFFECTS_LIST,
|
||||
ROW
|
||||
}
|
||||
@@ -0,0 +1,445 @@
|
||||
package noppes.npcs.client.gui.builder;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import noppes.npcs.client.gui.util.GuiNPCInterface;
|
||||
import noppes.npcs.client.gui.util.GuiNpcButton;
|
||||
import noppes.npcs.client.gui.util.GuiNpcButtonYesNo;
|
||||
import noppes.npcs.client.gui.util.GuiNpcLabel;
|
||||
import noppes.npcs.client.gui.util.GuiNpcTextField;
|
||||
import noppes.npcs.client.gui.util.GuiScrollWindow;
|
||||
import noppes.npcs.client.gui.util.SubGuiInterface;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* General-purpose builder that converts a list of {@link FieldDef} into positioned
|
||||
* GUI widgets inside a {@link GuiScrollWindow}.
|
||||
* <p>
|
||||
* Uses {@link FieldDef#row(FieldDef, FieldDef)} for two-column layouts.
|
||||
* Subclasses can override {@link #buildField} to handle custom field types.
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class GuiFieldBuilder {
|
||||
|
||||
// Layout defaults (2-column mode)
|
||||
protected int contentRight = 330;
|
||||
protected int colLLabel = 5;
|
||||
protected int colLField = 75;
|
||||
protected int colLWidth = 70;
|
||||
protected int colRLabel = 178;
|
||||
protected int colRField = 248;
|
||||
protected int colRWidth = 70;
|
||||
protected int rowHeight = 24;
|
||||
protected int labelPadding = 8;
|
||||
|
||||
// Dependencies
|
||||
protected final GuiNPCInterface parent;
|
||||
protected GuiScrollWindow sw;
|
||||
protected final FontRenderer fontRenderer;
|
||||
|
||||
// Scroll window ID
|
||||
protected int scrollWindowId = 0;
|
||||
|
||||
// ID counters
|
||||
protected int widgetId;
|
||||
protected int clearId;
|
||||
protected int labelId;
|
||||
|
||||
// Starting Y
|
||||
protected int startY = 5;
|
||||
protected int lastBuildY = 0;
|
||||
|
||||
// Output maps
|
||||
protected final Map<Integer, FieldDef> buttonFieldMap = new HashMap<>();
|
||||
protected final Map<Integer, FieldDef> textFieldMap = new HashMap<>();
|
||||
protected final Map<Integer, FieldDef> clearFieldMap = new HashMap<>();
|
||||
|
||||
public GuiFieldBuilder(GuiNPCInterface parent, FontRenderer fontRenderer) {
|
||||
this.parent = parent;
|
||||
this.fontRenderer = fontRenderer;
|
||||
}
|
||||
|
||||
// ═══════════════════════════════════════════════════════════════════
|
||||
// CONFIG CHAINING
|
||||
// ═══════════════════════════════════════════════════════════════════
|
||||
|
||||
public GuiFieldBuilder scrollWindowId(int id) { this.scrollWindowId = id; return this; }
|
||||
public GuiFieldBuilder contentRight(int v) { this.contentRight = v; return this; }
|
||||
public GuiFieldBuilder startIds(int widget, int clear, int label) {
|
||||
this.widgetId = widget; this.clearId = clear; this.labelId = label; return this;
|
||||
}
|
||||
public GuiFieldBuilder startY(int y) { this.startY = y; return this; }
|
||||
public GuiFieldBuilder rowHeight(int h) { this.rowHeight = h; return this; }
|
||||
|
||||
// ═══════════════════════════════════════════════════════════════════
|
||||
// BUILD
|
||||
// ═══════════════════════════════════════════════════════════════════
|
||||
|
||||
/**
|
||||
* Creates a {@link GuiScrollWindow} at the given position/size, builds all fields into it,
|
||||
* and sets maxScrollY automatically. The returned window is ready to use.
|
||||
*/
|
||||
public GuiScrollWindow buildScrollWindow(List<FieldDef> fields, int x, int y, int width, int height) {
|
||||
this.sw = new GuiScrollWindow(parent, x, y, width, height, 0);
|
||||
sw.backgroundColor = 0x88000000;
|
||||
// Register with parent first — this calls initGui() which clears widget lists,
|
||||
// so we must add widgets AFTER this point
|
||||
parent.addScrollableGui(scrollWindowId, sw);
|
||||
int finalY = build(fields);
|
||||
sw.maxScrollY = Math.max(finalY - height, 0);
|
||||
return sw;
|
||||
}
|
||||
|
||||
/**
|
||||
* Processes all fields and adds widgets to the scroll window.
|
||||
* @return the final Y position after all fields
|
||||
*/
|
||||
protected int build(List<FieldDef> fields) {
|
||||
buttonFieldMap.clear();
|
||||
textFieldMap.clear();
|
||||
clearFieldMap.clear();
|
||||
|
||||
int y = startY;
|
||||
|
||||
for (int i = 0; i < fields.size(); i++) {
|
||||
FieldDef def = fields.get(i);
|
||||
|
||||
// Let subclasses handle custom types; returns -1 if not handled
|
||||
int customResult = buildField(def, y, fields, i);
|
||||
if (customResult >= 0) {
|
||||
// Subclass handled it, check if index was advanced
|
||||
int newIndex = getLastHandledIndex();
|
||||
if (newIndex > i) i = newIndex;
|
||||
y = customResult;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Section header
|
||||
if (def.getType() == FieldType.SECTION_HEADER) {
|
||||
y += 3;
|
||||
GuiNpcLabel sectionLabel = new GuiNpcLabel(labelId++, def.getLabel(), colLLabel, y + 2, 0xFFFF55);
|
||||
if (def.getHoverText() != null && !def.getHoverText().isEmpty()) {
|
||||
sectionLabel.setHoverText(def.getHoverText());
|
||||
}
|
||||
sw.addLabel(sectionLabel);
|
||||
y += 15;
|
||||
continue;
|
||||
}
|
||||
|
||||
// ROW: explicit two-column pair
|
||||
if (def.getType() == FieldType.ROW) {
|
||||
FieldDef left = def.getLeftChild();
|
||||
FieldDef right = def.getRightChild();
|
||||
boolean leftVis = left != null && left.isVisible();
|
||||
boolean rightVis = right != null && right.isVisible();
|
||||
|
||||
if (leftVis && rightVis) {
|
||||
renderFieldAt(left, colLLabel, colLField, colLWidth, y);
|
||||
renderFieldAt(right, colRLabel, colRField, colRWidth, y);
|
||||
} else if (leftVis) {
|
||||
renderFullWidth(left, y);
|
||||
} else if (rightVis) {
|
||||
renderFullWidth(right, y);
|
||||
}
|
||||
if (leftVis || rightVis) y += rowHeight;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Full-width field
|
||||
renderFullWidth(def, y);
|
||||
y += rowHeight;
|
||||
}
|
||||
|
||||
lastBuildY = y;
|
||||
return y;
|
||||
}
|
||||
|
||||
/**
|
||||
* Hook for subclasses to handle custom field types (e.g. EFFECTS_LIST).
|
||||
* Return the new Y position if handled, or -1 if not handled (base class will process it).
|
||||
* If handling advances the field index, call {@link #setLastHandledIndex(int)}.
|
||||
*/
|
||||
protected int buildField(FieldDef def, int y, List<FieldDef> fields, int index) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
private int lastHandledIndex = -1;
|
||||
protected void setLastHandledIndex(int index) { this.lastHandledIndex = index; }
|
||||
protected int getLastHandledIndex() { return lastHandledIndex; }
|
||||
|
||||
// ═══════════════════════════════════════════════════════════════════
|
||||
// FIELD RENDERING
|
||||
// ═══════════════════════════════════════════════════════════════════
|
||||
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
protected void renderFieldAt(FieldDef def, int labelX, int fieldX, int fieldW, int y) {
|
||||
GuiNpcLabel fieldLabel = new GuiNpcLabel(labelId++, def.getLabel(), labelX, y + 5, 0xFFFFFF);
|
||||
String hover = def.getHoverText();
|
||||
if (hover != null && !hover.isEmpty()) {
|
||||
fieldLabel.setHoverText(hover);
|
||||
}
|
||||
sw.addLabel(fieldLabel);
|
||||
|
||||
switch (def.getType()) {
|
||||
case FLOAT: {
|
||||
float fVal = def.getValue() instanceof Number ? ((Number) def.getValue()).floatValue() : 0f;
|
||||
GuiNpcTextField tf = new GuiNpcTextField(widgetId, parent, fontRenderer, fieldX, y, fieldW, 20, String.valueOf(fVal));
|
||||
tf.setFloatsOnly();
|
||||
if (def.hasRange()) tf.setMinMaxDefaultFloat(def.getMin(), def.getMax(), fVal);
|
||||
if (!def.isEnabled()) tf.setEnabled(false);
|
||||
if (hover != null) tf.setHoverText(hover);
|
||||
sw.addTextField(tf);
|
||||
textFieldMap.put(widgetId, def);
|
||||
widgetId++;
|
||||
clearId++;
|
||||
break;
|
||||
}
|
||||
case INT: {
|
||||
int iVal = def.getValue() instanceof Number ? ((Number) def.getValue()).intValue() : 0;
|
||||
GuiNpcTextField tf = new GuiNpcTextField(widgetId, parent, fontRenderer, fieldX, y, fieldW, 20, String.valueOf(iVal));
|
||||
tf.setIntegersOnly();
|
||||
if (def.hasRange()) tf.setMinMaxDefault((int) def.getMin(), (int) def.getMax(), iVal);
|
||||
if (!def.isEnabled()) tf.setEnabled(false);
|
||||
if (hover != null) tf.setHoverText(hover);
|
||||
sw.addTextField(tf);
|
||||
textFieldMap.put(widgetId, def);
|
||||
widgetId++;
|
||||
clearId++;
|
||||
break;
|
||||
}
|
||||
case STRING: {
|
||||
String sVal = def.getValue() != null ? def.getValue().toString() : "";
|
||||
GuiNpcTextField tf = new GuiNpcTextField(widgetId, parent, fontRenderer, fieldX, y, fieldW, 20, sVal);
|
||||
if (!def.isEnabled()) tf.setEnabled(false);
|
||||
if (hover != null) tf.setHoverText(hover);
|
||||
sw.addTextField(tf);
|
||||
textFieldMap.put(widgetId, def);
|
||||
widgetId++;
|
||||
clearId++;
|
||||
break;
|
||||
}
|
||||
case LABEL: {
|
||||
String text = def.getValue() != null ? def.getValue().toString() : "";
|
||||
sw.addLabel(new GuiNpcLabel(labelId++, text, fieldX, y + 5, 0xAAAAAA));
|
||||
widgetId++;
|
||||
clearId++;
|
||||
break;
|
||||
}
|
||||
case BOOLEAN: {
|
||||
boolean bVal = def.getValue() instanceof Boolean ? (Boolean) def.getValue() : false;
|
||||
GuiNpcButtonYesNo btn = new GuiNpcButtonYesNo(widgetId, fieldX, y, fieldW, 20, bVal);
|
||||
if (!def.isEnabled()) btn.setEnabled(false);
|
||||
if (hover != null) btn.setHoverText(hover);
|
||||
sw.addButton(btn);
|
||||
buttonFieldMap.put(widgetId, def);
|
||||
widgetId++;
|
||||
clearId++;
|
||||
break;
|
||||
}
|
||||
case ENUM: {
|
||||
Class<? extends Enum<?>> enumClass = def.getEnumClass();
|
||||
if (enumClass != null) {
|
||||
Enum<?>[] constants = enumClass.getEnumConstants();
|
||||
String[] names = new String[constants.length];
|
||||
for (int i = 0; i < constants.length; i++) names[i] = constants[i].toString();
|
||||
int selected = def.getValue() instanceof Enum ? ((Enum<?>) def.getValue()).ordinal() : 0;
|
||||
GuiNpcButton btn = new GuiNpcButton(widgetId, fieldX, y, fieldW, 20, names, selected);
|
||||
if (!def.isEnabled()) btn.setEnabled(false);
|
||||
if (hover != null) btn.setHoverText(hover);
|
||||
sw.addButton(btn);
|
||||
buttonFieldMap.put(widgetId, def);
|
||||
}
|
||||
widgetId++;
|
||||
clearId++;
|
||||
break;
|
||||
}
|
||||
case STRING_ENUM: {
|
||||
String[] values = def.getStringEnumValues();
|
||||
if (values != null && values.length > 0) {
|
||||
String curVal = def.getStringEnumValue();
|
||||
int selected = 0;
|
||||
for (int i = 0; i < values.length; i++) {
|
||||
if (values[i].equals(curVal)) { selected = i; break; }
|
||||
}
|
||||
GuiNpcButton btn = new GuiNpcButton(widgetId, fieldX, y, fieldW, 20, values, selected);
|
||||
if (!def.isEnabled()) btn.setEnabled(false);
|
||||
if (hover != null) btn.setHoverText(hover);
|
||||
sw.addButton(btn);
|
||||
buttonFieldMap.put(widgetId, def);
|
||||
}
|
||||
widgetId++;
|
||||
clearId++;
|
||||
break;
|
||||
}
|
||||
case SUB_GUI: {
|
||||
String btnText = def.getButtonLabel();
|
||||
int btnW;
|
||||
if (def.hasClearAction()) {
|
||||
btnW = contentRight - 22 - fieldX;
|
||||
GuiNpcButton clearBtn = new GuiNpcButton(clearId, contentRight - 20, y, 20, 20, "X");
|
||||
sw.addButton(clearBtn);
|
||||
clearFieldMap.put(clearId, def);
|
||||
} else {
|
||||
btnW = contentRight - fieldX;
|
||||
}
|
||||
GuiNpcButton btn = new GuiNpcButton(widgetId, fieldX, y, btnW, 20, btnText);
|
||||
Integer textColor = def.getButtonTextColor();
|
||||
if (textColor != null) btn.setTextColor(textColor);
|
||||
if (!def.isEnabled()) btn.setEnabled(false);
|
||||
if (hover != null) btn.setHoverText(hover);
|
||||
sw.addButton(btn);
|
||||
buttonFieldMap.put(widgetId, def);
|
||||
widgetId++;
|
||||
clearId++;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
// Unknown type — skip, incrementing IDs to stay in sync
|
||||
widgetId++;
|
||||
clearId++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void renderFullWidth(FieldDef def, int y) {
|
||||
int fieldW = getFullFieldWidth(def);
|
||||
String translated = StatCollector.translateToLocal(def.getLabel());
|
||||
int labelW = fontRenderer.getStringWidth(translated);
|
||||
int fieldX = colLLabel + labelW + labelPadding;
|
||||
renderFieldAt(def, colLLabel, fieldX, fieldW, y);
|
||||
}
|
||||
|
||||
protected int getFullFieldWidth(FieldDef def) {
|
||||
switch (def.getType()) {
|
||||
case FLOAT:
|
||||
case INT: return 60;
|
||||
case STRING: return 200;
|
||||
case BOOLEAN: return 50;
|
||||
case LABEL: return 60;
|
||||
case ENUM:
|
||||
case STRING_ENUM: return 120;
|
||||
case SUB_GUI: return def.hasClearAction() ? 175 : 200;
|
||||
default: return 80;
|
||||
}
|
||||
}
|
||||
|
||||
// ═══════════════════════════════════════════════════════════════════
|
||||
// EVENT HANDLING
|
||||
// ═══════════════════════════════════════════════════════════════════
|
||||
|
||||
private FieldDef activeSubGuiField;
|
||||
|
||||
/**
|
||||
* Handles button events for declarative fields.
|
||||
* Call from parent GUI's buttonEvent(). Returns true if the event was handled.
|
||||
*/
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
public boolean handleButtonEvent(int buttonId, GuiButton button) {
|
||||
// Check clear buttons first
|
||||
if (clearFieldMap.containsKey(buttonId)) {
|
||||
FieldDef def = clearFieldMap.get(buttonId);
|
||||
if (def != null && def.hasClearAction()) {
|
||||
def.getClearAction().run();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// Check field buttons
|
||||
FieldDef def = buttonFieldMap.get(buttonId);
|
||||
if (def == null) return false;
|
||||
|
||||
switch (def.getType()) {
|
||||
case BOOLEAN:
|
||||
def.setValue(((GuiNpcButton) button).getValue() == 1);
|
||||
return true;
|
||||
case ENUM: {
|
||||
int idx = ((GuiNpcButton) button).getValue();
|
||||
Class<? extends Enum<?>> ec = def.getEnumClass();
|
||||
if (ec != null) {
|
||||
Enum<?>[] constants = ec.getEnumConstants();
|
||||
if (idx >= 0 && idx < constants.length) def.setValue(constants[idx]);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
case STRING_ENUM: {
|
||||
int idx = ((GuiNpcButton) button).getValue();
|
||||
String[] values = def.getStringEnumValues();
|
||||
if (values != null && idx >= 0 && idx < values.length) def.setStringEnumValue(values[idx]);
|
||||
return true;
|
||||
}
|
||||
case SUB_GUI:
|
||||
activeSubGuiField = def;
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles text field unfocus events for declarative fields.
|
||||
* Call from parent GUI's unFocused(). Returns true if the event was handled.
|
||||
*/
|
||||
public boolean handleTextFieldEvent(int textFieldId, GuiNpcTextField field) {
|
||||
FieldDef def = textFieldMap.get(textFieldId);
|
||||
if (def == null) return false;
|
||||
|
||||
switch (def.getType()) {
|
||||
case FLOAT:
|
||||
try { def.setValue(Float.parseFloat(field.getText())); } catch (NumberFormatException ignored) {}
|
||||
return true;
|
||||
case INT:
|
||||
try { def.setValue(Integer.parseInt(field.getText())); } catch (NumberFormatException ignored) {}
|
||||
return true;
|
||||
case STRING:
|
||||
def.setValue(field.getText());
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles sub-gui close events. Call from parent GUI's subGuiClosed().
|
||||
* Returns true if the event was handled (activeSubGuiField was set).
|
||||
*/
|
||||
public boolean handleSubGuiClosed(SubGuiInterface subgui) {
|
||||
if (activeSubGuiField != null) {
|
||||
FieldDef def = activeSubGuiField;
|
||||
activeSubGuiField = null;
|
||||
if (def.getSubGuiResultHandler() != null) {
|
||||
def.getSubGuiResultHandler().accept(subgui);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the FieldDef for the currently active sub-gui, or null.
|
||||
* After handleButtonEvent returns true for a SUB_GUI field, the parent
|
||||
* should check this and call setSubGui(def.getSubGuiFactory().get()).
|
||||
*/
|
||||
public FieldDef getActiveSubGuiField() { return activeSubGuiField; }
|
||||
|
||||
/**
|
||||
* Clears the active sub-gui field tracking.
|
||||
*/
|
||||
public void clearActiveSubGuiField() { activeSubGuiField = null; }
|
||||
|
||||
// ═══════════════════════════════════════════════════════════════════
|
||||
// GETTERS
|
||||
// ═══════════════════════════════════════════════════════════════════
|
||||
|
||||
public Map<Integer, FieldDef> getButtonFieldMap() { return buttonFieldMap; }
|
||||
public Map<Integer, FieldDef> getTextFieldMap() { return textFieldMap; }
|
||||
public Map<Integer, FieldDef> getClearFieldMap() { return clearFieldMap; }
|
||||
public GuiScrollWindow getScrollWindow() { return sw; }
|
||||
public int getLastBuildY() { return lastBuildY; }
|
||||
public int getNextLabelId() { return labelId; }
|
||||
}
|
||||
@@ -55,7 +55,6 @@ public class GuiAnimationSelection extends SubGuiInterface implements ICustomScr
|
||||
* Constructor for selecting by name (built-in) or ID (user).
|
||||
*/
|
||||
public GuiAnimationSelection(int animationId, String animationName) {
|
||||
drawDefaultBackground = false;
|
||||
title = "";
|
||||
setBackground("menubg.png");
|
||||
xSize = 220;
|
||||
|
||||
@@ -39,7 +39,6 @@ public class GuiSoundSelection extends SubGuiInterface implements ICustomScrollL
|
||||
public static HashMap<String, List<String>> cachedDomains = new HashMap<>();
|
||||
|
||||
public GuiSoundSelection(String sound) {
|
||||
drawDefaultBackground = false;
|
||||
title = "";
|
||||
setBackground("menubg.png");
|
||||
xSize = 366;
|
||||
|
||||
@@ -104,8 +104,10 @@ public class GuiCustomScroll extends GuiScreen {
|
||||
GL11.glTranslatef(guiLeft, guiTop, 0.0F);
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
||||
if (selectable)
|
||||
if (selectable && !hasSubGUI)
|
||||
hover = getMouseOver(i, j);
|
||||
else if (hasSubGUI)
|
||||
hover = -1;
|
||||
|
||||
drawItems();
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ package noppes.npcs.client.gui.util;
|
||||
|
||||
import kamkeel.npcs.util.TextSplitter;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
@@ -151,8 +152,23 @@ public class GuiNpcButton extends GuiButton {
|
||||
public void drawButton(Minecraft mc, int mouseX, int mouseY) {
|
||||
if (!this.visible)
|
||||
return;
|
||||
// Auto-truncate display text if wider than button
|
||||
String original = this.displayString;
|
||||
FontRenderer fr = mc.fontRenderer;
|
||||
if (fr != null) {
|
||||
int maxTextWidth = this.width - 6;
|
||||
if (fr.getStringWidth(original) > maxTextWidth) {
|
||||
String ellipsis = "...";
|
||||
int targetWidth = maxTextWidth - fr.getStringWidth(ellipsis);
|
||||
if (targetWidth > 0) {
|
||||
this.displayString = fr.trimStringToWidth(original, targetWidth) + ellipsis;
|
||||
}
|
||||
}
|
||||
}
|
||||
// First, draw the button normally using the superclass method.
|
||||
super.drawButton(mc, mouseX, mouseY);
|
||||
// Restore original display string
|
||||
this.displayString = original;
|
||||
// Then, if an icon texture is set, draw it.
|
||||
if (iconTexture != null) {
|
||||
mc.getTextureManager().bindTexture(iconTexture);
|
||||
|
||||
@@ -1,18 +1,32 @@
|
||||
package noppes.npcs.client.gui.util;
|
||||
|
||||
import kamkeel.npcs.util.TextSplitter;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.Gui;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import noppes.npcs.client.CustomNpcResourceListener;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
public class GuiNpcLabel {
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
public class GuiNpcLabel extends Gui {
|
||||
public String label;
|
||||
public int x, y, color;
|
||||
public boolean enabled = true;
|
||||
public int id;
|
||||
public boolean drawShadow = false;
|
||||
|
||||
// Hover text support
|
||||
public String hoverableText = "";
|
||||
private boolean wasHovered = false;
|
||||
private int hoverCount = 0;
|
||||
|
||||
public GuiNpcLabel(int id, Object label, int x, int y, int color) {
|
||||
this.id = id;
|
||||
this.label = StatCollector.translateToLocal(label.toString());
|
||||
@@ -25,6 +39,10 @@ public class GuiNpcLabel {
|
||||
this(id, label, x, y, CustomNpcResourceListener.DefaultTextColor);
|
||||
}
|
||||
|
||||
public void setHoverText(String text) {
|
||||
this.hoverableText = text;
|
||||
}
|
||||
|
||||
public void drawLabel(GuiScreen gui, FontRenderer fontRenderer) {
|
||||
if (enabled)
|
||||
fontRenderer.drawString(label, x, y, color, drawShadow);
|
||||
@@ -34,4 +52,119 @@ public class GuiNpcLabel {
|
||||
int size = Minecraft.getMinecraft().fontRenderer.getStringWidth(label);
|
||||
x += (width - size) / 2;
|
||||
}
|
||||
|
||||
public boolean isMouseOver(int mouseX, int mouseY, FontRenderer fr) {
|
||||
int width = fr.getStringWidth(label);
|
||||
return mouseX >= x && mouseX <= x + width && mouseY >= y && mouseY <= y + 10;
|
||||
}
|
||||
|
||||
/**
|
||||
* Draws hover tooltip if the mouse is over this label.
|
||||
* @param localMouseX Mouse X in scroll-local coordinates (for hit testing)
|
||||
* @param localMouseY Mouse Y in scroll-local coordinates (for hit testing)
|
||||
* @param screenMouseX Mouse X in screen coordinates (for tooltip positioning)
|
||||
* @param screenMouseY Mouse Y in screen coordinates (for tooltip positioning)
|
||||
* @param hasSubGui Whether a sub-gui is open
|
||||
* @param fr FontRenderer for measuring label width
|
||||
*/
|
||||
public void drawHover(int localMouseX, int localMouseY, int screenMouseX, int screenMouseY, boolean hasSubGui, FontRenderer fr) {
|
||||
if (hasSubGui || hoverableText.isEmpty()) return;
|
||||
|
||||
boolean hovered = isMouseOver(localMouseX, localMouseY, fr);
|
||||
if (!hovered) {
|
||||
wasHovered = false;
|
||||
hoverCount = 0;
|
||||
return;
|
||||
}
|
||||
if (!wasHovered) {
|
||||
wasHovered = true;
|
||||
hoverCount = 0;
|
||||
}
|
||||
if (hoverCount < 65) hoverCount++;
|
||||
|
||||
if (hoverCount > 60) {
|
||||
GL11.glPushMatrix();
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
String displayString = StatCollector.translateToLocal(hoverableText);
|
||||
GL11.glColor4f(1, 1, 1, 1);
|
||||
List<String> lines = TextSplitter.splitText(displayString, 30);
|
||||
drawHoveringText(lines, screenMouseX, screenMouseY, mc);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
protected void drawHoveringText(List textLines, int x, int y, Minecraft mc) {
|
||||
if (mc.fontRenderer == null || textLines.isEmpty())
|
||||
return;
|
||||
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_DEPTH_TEST);
|
||||
|
||||
int maxWidth = 0;
|
||||
Iterator iterator = textLines.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
String s = (String) iterator.next();
|
||||
int lineWidth = mc.fontRenderer.getStringWidth(s);
|
||||
if (lineWidth > maxWidth) {
|
||||
maxWidth = lineWidth;
|
||||
}
|
||||
}
|
||||
|
||||
int j2 = x + 12;
|
||||
int k2 = y - 12;
|
||||
int maxHeight = 8;
|
||||
|
||||
if (textLines.size() > 1) {
|
||||
maxHeight += 2 + (textLines.size() - 1) * 10;
|
||||
}
|
||||
|
||||
ScaledResolution scaledRes = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight);
|
||||
int screenWidth = scaledRes.getScaledWidth();
|
||||
int screenHeight = scaledRes.getScaledHeight();
|
||||
|
||||
if (j2 + maxWidth + 6 > screenWidth) {
|
||||
j2 = x - maxWidth - 16;
|
||||
}
|
||||
if (j2 < 4) {
|
||||
j2 = 4;
|
||||
}
|
||||
if (k2 + maxHeight + 6 > screenHeight) {
|
||||
k2 = screenHeight - maxHeight - 6;
|
||||
}
|
||||
if (k2 < 4) {
|
||||
k2 = 4;
|
||||
}
|
||||
|
||||
this.zLevel = 300.0F;
|
||||
int j1 = -267386864;
|
||||
this.drawGradientRect(j2 - 3, k2 - 4, j2 + maxWidth + 3, k2 - 3, j1, j1);
|
||||
this.drawGradientRect(j2 - 3, k2 + maxHeight + 3, j2 + maxWidth + 3, k2 + maxHeight + 4, j1, j1);
|
||||
this.drawGradientRect(j2 - 3, k2 - 3, j2 + maxWidth + 3, k2 + maxHeight + 3, j1, j1);
|
||||
this.drawGradientRect(j2 - 4, k2 - 3, j2 - 3, k2 + maxHeight + 3, j1, j1);
|
||||
this.drawGradientRect(j2 + maxWidth + 3, k2 - 3, j2 + maxWidth + 4, k2 + maxHeight + 3, j1, j1);
|
||||
int k1 = 1347420415;
|
||||
int l1 = (k1 & 16711422) >> 1 | k1 & -16777216;
|
||||
this.drawGradientRect(j2 - 3, k2 - 3 + 1, j2 - 3 + 1, k2 + maxHeight + 3 - 1, k1, l1);
|
||||
this.drawGradientRect(j2 + maxWidth + 2, k2 - 3 + 1, j2 + maxWidth + 3, k2 + maxHeight + 3 - 1, k1, l1);
|
||||
this.drawGradientRect(j2 - 3, k2 - 3, j2 + maxWidth + 3, k2 - 3 + 1, k1, k1);
|
||||
this.drawGradientRect(j2 - 3, k2 + maxHeight + 2, j2 + maxWidth + 3, k2 + maxHeight + 3, l1, l1);
|
||||
|
||||
for (int i2 = 0; i2 < textLines.size(); ++i2) {
|
||||
String s1 = (String) textLines.get(i2);
|
||||
mc.fontRenderer.drawStringWithShadow(s1, j2, k2, -1);
|
||||
if (i2 == 0) {
|
||||
k2 += 2;
|
||||
}
|
||||
k2 += 10;
|
||||
}
|
||||
|
||||
this.zLevel = 0.0F;
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||
RenderHelper.enableStandardItemLighting();
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
}
|
||||
}
|
||||
@@ -97,6 +97,11 @@ public class GuiScrollWindow extends GuiScreen implements ITextfieldListener, IC
|
||||
}
|
||||
|
||||
public void mouseClicked(int i, int j, int k) {
|
||||
// Ignore clicks outside the visible scroll window area
|
||||
if (i < xPos || i > xPos + clipWidth || j < yPos || j > yPos + clipHeight) {
|
||||
return;
|
||||
}
|
||||
|
||||
i = i - xPos;
|
||||
j = (int) (j - yPos + scrollY);
|
||||
|
||||
@@ -246,6 +251,12 @@ public class GuiScrollWindow extends GuiScreen implements ITextfieldListener, IC
|
||||
}
|
||||
|
||||
GL11.glPopMatrix();
|
||||
|
||||
// Draw hover texts in screen space (after scissor/translation are undone)
|
||||
// so tooltips are not clipped and are positioned correctly
|
||||
if (isMouseOver(mouseX, mouseY)) {
|
||||
drawHoverTexts(mouseX, mouseY);
|
||||
}
|
||||
}
|
||||
|
||||
public void drawScreen(int mouseX, int mouseY, float partialTicks, int mouseScroll) {
|
||||
@@ -275,8 +286,26 @@ public class GuiScrollWindow extends GuiScreen implements ITextfieldListener, IC
|
||||
}
|
||||
for (GuiNpcButton button : buttons.values()) {
|
||||
button.updateSubGUI(subGui);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Draws hover texts for buttons in screen space (called after GL scissor/translate are undone).
|
||||
* Hover state was already computed during drawComponents with scroll-local coords.
|
||||
*/
|
||||
private void drawHoverTexts(int mouseX, int mouseY) {
|
||||
boolean subGui = parent.hasSubGui();
|
||||
for (GuiNpcButton button : buttons.values()) {
|
||||
if (!button.hoverableText.isEmpty()) {
|
||||
button.drawHover(i, j, subGui);
|
||||
button.drawHover(mouseX, mouseY, subGui);
|
||||
}
|
||||
}
|
||||
// Label hover: convert screen mouse to scroll-local coords for hit testing
|
||||
int localMouseX = mouseX - xPos;
|
||||
int localMouseY = (int) (mouseY - yPos + scrollY);
|
||||
for (GuiNpcLabel label : labels.values()) {
|
||||
if (!label.hoverableText.isEmpty()) {
|
||||
label.drawHover(localMouseX, localMouseY, mouseX, mouseY, subGui, fontRendererObj);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,8 +26,8 @@ public class BlockBeamRenderer extends BlockRendererInterface {
|
||||
public void renderTileEntityAt(TileEntity var1, double var2, double var4,
|
||||
double var6, float var8) {
|
||||
TileVariant tile = (TileVariant) var1;
|
||||
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
|
||||
GL11.glTranslatef((float) var2 + 0.5f, (float) var4 + 1.5f, (float) var6 + 0.5f);
|
||||
//GL11.glScalef(1.2f, 1.1f, 1.2f);
|
||||
GL11.glRotatef(180, 0, 0, 1);
|
||||
|
||||
@@ -342,5 +342,10 @@ public class ScriptContainer implements IScriptUnit {
|
||||
public void setErrored(boolean errored) {
|
||||
this.errored = errored;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isJanino() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
package somehussar.gui;
|
||||
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import noppes.npcs.client.gui.util.GuiNpcLabel;
|
||||
import noppes.npcs.client.gui.util.SubGuiInterface;
|
||||
import somehussar.gui.annotationHandling.GuiFieldHandler;
|
||||
import somehussar.gui.annotationHandling.field.EditableField;
|
||||
|
||||
public class AnnotatedGui<T> extends SubGuiInterface {
|
||||
private final GuiFieldHandler.ClassMetadata metadata;
|
||||
|
||||
public AnnotatedGui(T object, String[] groups, GuiScreen parent) {
|
||||
this(object, groups, parent, 256, 216);
|
||||
}
|
||||
|
||||
public AnnotatedGui(T object, String[] groups, GuiScreen parent, int xSize, int ySize) {
|
||||
if (object != null)
|
||||
metadata = GuiFieldHandler.getMetadata(object.getClass());
|
||||
else
|
||||
metadata = null;
|
||||
setBackground("menubg.png");
|
||||
this.xSize = xSize;
|
||||
this.ySize = ySize;
|
||||
closeOnEsc = true;
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
if (metadata == null)
|
||||
return;
|
||||
|
||||
int i = 0;
|
||||
for (EditableField field : metadata.getParent().getDeclaredFields()) {
|
||||
addLabel(new GuiNpcLabel(i++, field.getName(), guiLeft+8, guiTop+i*15+5));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package somehussar.gui;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import noppes.npcs.client.gui.util.GuiNpcTextField;
|
||||
import somehussar.gui.annotationHandling.field.EditableField;
|
||||
|
||||
public class ImmediateTextField extends GuiNpcTextField{
|
||||
private final EditableField editableField;
|
||||
//
|
||||
// private final GuiNpcTextField encapsulatedField;
|
||||
|
||||
public ImmediateTextField(int id, EditableField field, int xPos, int yPos) {
|
||||
this(id, field, Minecraft.getMinecraft().fontRenderer, xPos, yPos);
|
||||
}
|
||||
public ImmediateTextField(int id, EditableField field, FontRenderer fontRenderer, int xPos, int yPos) {
|
||||
super(id, null, fontRenderer, xPos, yPos, 0, 0, null);
|
||||
|
||||
this.editableField = field;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawTextBox(int mousX, int mousY) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseClicked(int xPos, int yPos, int k) {
|
||||
xPos -= this.xPosition;
|
||||
yPos -= this.yPosition;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package somehussar.gui.annotationHandling;
|
||||
|
||||
public interface FieldConstraint {
|
||||
void validate(Object value);
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package somehussar.gui.annotationHandling;
|
||||
|
||||
public final class FieldConstraints {
|
||||
|
||||
private static final FieldConstraints EMPTY =
|
||||
new FieldConstraints(new FieldConstraint[0]);
|
||||
|
||||
private final FieldConstraint[] constraints;
|
||||
|
||||
public FieldConstraints(FieldConstraint[] constraints) {
|
||||
this.constraints = constraints;
|
||||
}
|
||||
|
||||
public static FieldConstraints empty() {
|
||||
return EMPTY;
|
||||
}
|
||||
|
||||
public void validate(Object value) {
|
||||
for (FieldConstraint c : constraints) {
|
||||
c.validate(value);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isEmpty() {
|
||||
return constraints.length == 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package somehussar.gui.annotationHandling;
|
||||
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface GuiEditable {
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@interface Field {
|
||||
String value();
|
||||
|
||||
/**
|
||||
* Display order
|
||||
* Higher value = higher priority.
|
||||
*/
|
||||
int order() default 0;
|
||||
|
||||
}
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@interface Group {
|
||||
String value();
|
||||
}
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@interface Size {
|
||||
int labelWidth() default 60;
|
||||
int fieldWidth() default 50;
|
||||
|
||||
GuiEditable.Size DEFAULT_SIZE = new GuiEditable.Size() {
|
||||
@Override
|
||||
public int labelWidth() {
|
||||
return 60;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int fieldWidth() {
|
||||
return 50;
|
||||
}
|
||||
@Override public Class<? extends Annotation> annotationType() { return GuiEditable.Size.class; }
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,140 @@
|
||||
package somehussar.gui.annotationHandling;
|
||||
|
||||
import somehussar.gui.annotationHandling.constraints.ConstraintFactory;
|
||||
import somehussar.gui.annotationHandling.constraints.NumericConstraint;
|
||||
import somehussar.gui.annotationHandling.constraints.NumericConstraintFactory;
|
||||
import somehussar.gui.annotationHandling.field.EditableField;
|
||||
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.lang.invoke.MethodHandles;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public final class GuiFieldHandler {
|
||||
|
||||
private static final Map<Class<?>, ClassMetadata> CACHE = new HashMap<>();
|
||||
private static final MethodHandles.Lookup LOOKUP = MethodHandles.lookup();
|
||||
|
||||
public static final Map<Class<? extends Annotation>, ConstraintFactory<?>> registry = new HashMap<>();
|
||||
|
||||
static {
|
||||
registry.put(NumericConstraint.class, new NumericConstraintFactory());
|
||||
}
|
||||
|
||||
|
||||
private GuiFieldHandler() {}
|
||||
|
||||
public static ClassMetadata getMetadata(Class<?> type) {
|
||||
return CACHE.computeIfAbsent(type, GuiFieldHandler::scanClass);
|
||||
}
|
||||
|
||||
@SuppressWarnings({"RawUseOfParameterized"})
|
||||
private static ClassMetadata scanClass(Class<?> type) {
|
||||
if (!type.isAnnotationPresent(GuiEditable.class)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
ClassMetadata parent = null;
|
||||
|
||||
Class<?> superCls = type.getSuperclass();
|
||||
if (superCls != null && superCls != Object.class) {
|
||||
parent = getMetadata(superCls);
|
||||
}
|
||||
|
||||
List<EditableField> list = new ArrayList<>();
|
||||
for (Field field : type.getDeclaredFields()) {
|
||||
EditableField editableField = createEditableField(field);
|
||||
|
||||
if (editableField != null) {
|
||||
list.add(editableField);
|
||||
}
|
||||
}
|
||||
|
||||
return new ClassMetadata(
|
||||
type,
|
||||
list.toArray(list.toArray(new EditableField[0])),
|
||||
parent
|
||||
);
|
||||
}
|
||||
|
||||
@SuppressWarnings({"RawUseOfParameterized", "unchecked"})
|
||||
private static EditableField createEditableField(Field field) {
|
||||
try {
|
||||
GuiEditable.Field fieldConfig = field.getAnnotation(GuiEditable.Field.class);
|
||||
if (fieldConfig == null) return null;
|
||||
if (Modifier.isFinal(field.getModifiers())) return null;
|
||||
|
||||
GuiEditable.Size size = field.getAnnotation(GuiEditable.Size.class);
|
||||
if (size == null) size = GuiEditable.Size.DEFAULT_SIZE;;
|
||||
|
||||
field.setAccessible(true);
|
||||
EditableField.Builder builder = new EditableField.Builder()
|
||||
.name(fieldConfig.value())
|
||||
.type(field.getType())
|
||||
.getter(LOOKUP.unreflectGetter(field))
|
||||
.setter(LOOKUP.unreflectSetter(field))
|
||||
.constraints(buildConstraints(field))
|
||||
.order(fieldConfig.order())
|
||||
.size(size);
|
||||
|
||||
|
||||
GuiEditable.Group group = field.getAnnotation(GuiEditable.Group.class);
|
||||
if (group != null)
|
||||
builder.group(group.value());
|
||||
|
||||
|
||||
return builder.build();
|
||||
} catch (IllegalAccessException e) {
|
||||
throw new RuntimeException(
|
||||
"Failed to bind field: " + field, e);
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings({"RawUseOfParameterized", "unchecked"})
|
||||
private static FieldConstraints buildConstraints(Field field) {
|
||||
List<FieldConstraint> list = new ArrayList<>();
|
||||
|
||||
for (Annotation ann : field.getAnnotations()) {
|
||||
ConstraintFactory factory = registry.get(ann.annotationType());
|
||||
if (factory != null) {
|
||||
FieldConstraint c = factory.create(field, ann);
|
||||
list.add(c);
|
||||
}
|
||||
}
|
||||
|
||||
if (list.isEmpty()) return FieldConstraints.empty();
|
||||
return new FieldConstraints(list.toArray(new FieldConstraint[0]));
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings({"RawUseOfParameterized"})
|
||||
public static final class ClassMetadata {
|
||||
final Class<?> type;
|
||||
final EditableField[] fields; // only declared fields
|
||||
final ClassMetadata parent; // superclass metadata (nullable)
|
||||
|
||||
ClassMetadata(Class<?> type, EditableField[] fields, ClassMetadata parent) {
|
||||
this.type = type;
|
||||
this.fields = fields;
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
public ClassMetadata getParent() {
|
||||
return parent;
|
||||
}
|
||||
|
||||
public EditableField[] getDeclaredFields() {
|
||||
return fields;
|
||||
}
|
||||
|
||||
public Class<?> getType() {
|
||||
return type;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package somehussar.gui.annotationHandling.constraints;
|
||||
|
||||
import somehussar.gui.annotationHandling.FieldConstraint;
|
||||
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
public interface ConstraintFactory<A extends Annotation> {
|
||||
FieldConstraint create(Field field, A annotation);
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package somehussar.gui.annotationHandling.constraints;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@Retention(value = RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.FIELD)
|
||||
public @interface NumericConstraint {
|
||||
double min() default Double.NEGATIVE_INFINITY;
|
||||
double max() default Double.POSITIVE_INFINITY;
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
package somehussar.gui.annotationHandling.constraints;
|
||||
|
||||
import somehussar.gui.annotationHandling.FieldConstraint;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
public class NumericConstraintFactory implements ConstraintFactory<NumericConstraint> {
|
||||
|
||||
@Override
|
||||
public FieldConstraint create(Field field, NumericConstraint ann) {
|
||||
return new NumericRangeConstraint(ann.min(), ann.max());
|
||||
}
|
||||
}
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
package somehussar.gui.annotationHandling.constraints;
|
||||
|
||||
import somehussar.gui.annotationHandling.FieldConstraint;
|
||||
|
||||
public final class NumericRangeConstraint implements FieldConstraint {
|
||||
|
||||
private final double min;
|
||||
private final double max;
|
||||
|
||||
public NumericRangeConstraint(double min, double max) {
|
||||
this.min = min;
|
||||
this.max = max;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validate(Object value) {
|
||||
if (!(value instanceof Number)) {
|
||||
throw new ConstraintViolationException("Expected number, got " + value);
|
||||
}
|
||||
|
||||
double v = ((Number) value).doubleValue();
|
||||
if (v < min || v > max) {
|
||||
throw new ConstraintViolationException(
|
||||
"Value " + v + " must be between " + min + " and " + max
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public static final class ConstraintViolationException extends RuntimeException {
|
||||
public ConstraintViolationException(String message) {
|
||||
super(message);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
package somehussar.gui.annotationHandling.field;
|
||||
|
||||
import somehussar.gui.annotationHandling.FieldConstraints;
|
||||
import somehussar.gui.annotationHandling.GuiEditable;
|
||||
|
||||
import java.lang.invoke.MethodHandle;
|
||||
|
||||
public final class EditableField<T> {
|
||||
|
||||
private final String name;
|
||||
private final Class<T> type;
|
||||
private final MethodHandle getter;
|
||||
private final MethodHandle setter;
|
||||
private final FieldConstraints constraints;
|
||||
private final int order;
|
||||
private final String group;
|
||||
private final GuiEditable.Size size;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public Class<?> getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
@SuppressWarnings({"unchecked"})
|
||||
public T read(T instance) {
|
||||
try {
|
||||
return (T) getter.invoke(instance);
|
||||
} catch (Throwable t) {
|
||||
throw new RuntimeException("Failed to read field " + name, t);
|
||||
}
|
||||
}
|
||||
|
||||
public void write(T instance, T value) {
|
||||
constraints.validate(value);
|
||||
try {
|
||||
setter.invoke(instance, value);
|
||||
} catch (Throwable t) {
|
||||
throw new RuntimeException("Failed to write field " + name, t);
|
||||
}
|
||||
}
|
||||
|
||||
public FieldConstraints getConstraints() {
|
||||
return this.constraints;
|
||||
}
|
||||
|
||||
public int getOrder() { return this.order; }
|
||||
|
||||
EditableField(Builder<T> b) {
|
||||
this.name = b.name;
|
||||
this.type = b.type;
|
||||
this.getter = b.getter;
|
||||
this.setter = b.setter;
|
||||
this.constraints = b.constraints;
|
||||
this.order = b.order;
|
||||
this.group = b.group;
|
||||
this.size = b.size;
|
||||
}
|
||||
|
||||
public static class Builder<T> {
|
||||
private String name;
|
||||
private Class<T> type;
|
||||
private MethodHandle getter;
|
||||
private MethodHandle setter;
|
||||
private FieldConstraints constraints;
|
||||
private int order;
|
||||
private String group = null;
|
||||
private GuiEditable.Size size;
|
||||
|
||||
public Builder<T> name(String v) { this.name = v; return this; }
|
||||
public Builder<T> type(Class<T> v) { this.type = v; return this; }
|
||||
public Builder<T> getter(MethodHandle v) { this.getter = v; return this; }
|
||||
public Builder<T> setter(MethodHandle v) { this.setter = v; return this; }
|
||||
public Builder<T> constraints(FieldConstraints v) { this.constraints = v; return this; }
|
||||
public Builder<T> order(int order) { this.order = order; return this; }
|
||||
public Builder<T> group(String value) { this.group = value; return this; }
|
||||
public Builder<T> size(GuiEditable.Size size) { this.size = size; return this; }
|
||||
|
||||
public EditableField<T> build() {
|
||||
return new EditableField<>(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1537,6 +1537,48 @@ ability.target.aggro_target=Target
|
||||
ability.target.self=Self
|
||||
ability.target.aoe_self=AOE Self
|
||||
ability.target.aoe_target=AOE Target
|
||||
ability.syncWindup=Sync Windup
|
||||
|
||||
# Anchor Point
|
||||
ability.anchor.front=Front
|
||||
ability.anchor.center=Center
|
||||
ability.anchor.rightHand=Right Hand
|
||||
ability.anchor.leftHand=Left Hand
|
||||
ability.anchor.aboveHead=Above Head
|
||||
ability.anchor.chest=Chest
|
||||
|
||||
# Sweep Mode
|
||||
ability.sweep.swipe=Swipe
|
||||
ability.sweep.spin=Spin
|
||||
|
||||
# Dash Mode
|
||||
ability.dash.aggressive=Aggressive
|
||||
ability.dash.defensive=Defensive
|
||||
|
||||
# Counter Type
|
||||
ability.counter.flat=Flat
|
||||
ability.counter.percent=Percent
|
||||
|
||||
# Hazard Shape
|
||||
ability.shape.circle=Circle
|
||||
ability.shape.ring=Ring
|
||||
ability.shape.cone=Cone
|
||||
|
||||
# Placement Mode
|
||||
ability.placement.atCaster=At Caster
|
||||
ability.placement.atTarget=At Target
|
||||
ability.placement.followCaster=Follow Caster
|
||||
ability.placement.followTarget=Follow Target
|
||||
|
||||
# Teleport Mode
|
||||
ability.teleport.blink=Blink
|
||||
ability.teleport.behind=Behind
|
||||
ability.teleport.single=Single
|
||||
|
||||
# Trap Placement
|
||||
ability.trapPlace.atCaster=At Caster
|
||||
ability.trapPlace.atTarget=At Target
|
||||
ability.trapPlace.aheadOfCaster=Ahead of Caster
|
||||
|
||||
telegraph.circle=Circle
|
||||
telegraph.ring=Ring
|
||||
@@ -1580,118 +1622,186 @@ ability.cnpc.disc_dual=Disc Dual
|
||||
ability.cnpc.laser_shot=Laser Shot
|
||||
ability.cnpc.sweeper=Sweeper
|
||||
|
||||
# Ability GUI - Type Tab
|
||||
# ═══════════════════════════════════════════════════════════════
|
||||
# Ability Config GUI
|
||||
# ═══════════════════════════════════════════════════════════════
|
||||
|
||||
# General Tab
|
||||
ability.weight=Weight
|
||||
ability.windUpTicks=Wind Up
|
||||
ability.cooldownTicks=Cooldown
|
||||
ability.lockMovement=Lock Movement
|
||||
ability.interruptible=Interruptible
|
||||
ability.dazedTicks=Dazed Ticks
|
||||
ability.targetingMode=Targeting
|
||||
|
||||
# Target Tab
|
||||
ability.minRange=Min Range
|
||||
ability.maxRange=Max Range
|
||||
ability.conditions=Conditions
|
||||
|
||||
# Effects Tab
|
||||
ability.windUpSound=Wind Up Sound
|
||||
ability.activeSound=Active Sound
|
||||
ability.windUpAnimation=Wind Up Animation
|
||||
ability.activeAnimation=Active Animation
|
||||
ability.showTelegraph=Show Telegraph
|
||||
ability.windUpColor=Wind Up Color
|
||||
ability.activeColor=Active Color
|
||||
|
||||
# Section Headers
|
||||
ability.section.timing=Timing
|
||||
ability.section.movement=Movement
|
||||
ability.section.sounds=Sounds
|
||||
ability.section.animations=Animations
|
||||
ability.section.telegraph=Telegraph
|
||||
ability.section.beam=Beam
|
||||
ability.section.sweep=Sweep
|
||||
ability.section.push=Push
|
||||
ability.section.leap=Leap
|
||||
ability.section.disc=Disc
|
||||
ability.section.homing=Homing
|
||||
ability.section.boomerang=Boomerang
|
||||
ability.section.explosive=Explosive
|
||||
ability.section.colors=Colors
|
||||
ability.section.effects=Effects
|
||||
ability.section.dual=Dual
|
||||
ability.section.beam1=Beam 1
|
||||
ability.section.beam2=Beam 2
|
||||
ability.section.disc1=Disc 1
|
||||
ability.section.disc2=Disc 2
|
||||
ability.section.orb1=Orb 1
|
||||
ability.section.orb2=Orb 2
|
||||
ability.section.counter=Counter
|
||||
ability.section.area=Area
|
||||
ability.section.damage=Damage
|
||||
ability.section.debuffs=Debuffs
|
||||
ability.section.healing=Healing
|
||||
ability.section.trigger=Trigger
|
||||
ability.section.aoe=AOE
|
||||
ability.section.pullDamage=Pull Damage
|
||||
|
||||
# Shared Sub-Section Labels (used under section headers)
|
||||
gui.radius=Radius
|
||||
gui.thickness=Thickness
|
||||
gui.rotationSpeed=Rotation Speed
|
||||
gui.strength=Strength
|
||||
gui.range=Range
|
||||
gui.delay=Delay
|
||||
gui.density=Density
|
||||
gui.length=Length
|
||||
gui.width=Width
|
||||
gui.height=Height
|
||||
gui.value=Value
|
||||
gui.chance=Chance
|
||||
gui.sound=Sound
|
||||
gui.animation=Animation
|
||||
gui.duration=Duration
|
||||
gui.amp=Amp
|
||||
gui.speed=Speed
|
||||
|
||||
# Common Type Settings
|
||||
ability.radius=Radius
|
||||
ability.knockback=Knockback
|
||||
ability.knockbackUp=KB Up
|
||||
ability.maxDist=Max Dist
|
||||
ability.minDist=Min Dist
|
||||
ability.knockbackUp=Knockback Up
|
||||
ability.distance=Distance
|
||||
ability.maxDistance=Max Distance
|
||||
ability.lifetime=Lifetime
|
||||
ability.stunTicks=Stun
|
||||
ability.leapHeight=Leap Height
|
||||
ability.stunTicks=Stun Ticks
|
||||
ability.hitWidth=Hit Width
|
||||
ability.effects=Effects
|
||||
gui.duration=Duration
|
||||
gui.amp=Amp
|
||||
ability.mode=Mode
|
||||
ability.duration=Duration
|
||||
ability.anchorPoint=Anchor Point
|
||||
ability.rotationSpeed=Rotation Speed
|
||||
|
||||
# Slam Settings
|
||||
# Slam
|
||||
ability.leapSpeed=Leap Speed
|
||||
ability.leapHeight=Leap Height
|
||||
|
||||
# Charge Settings
|
||||
ability.hitRadius=Hit Radius
|
||||
|
||||
# Cutter Settings
|
||||
# Cutter
|
||||
ability.range=Range
|
||||
ability.sweepMode=Sweep Mode
|
||||
ability.spinDuration=Spin Duration
|
||||
ability.arcAngle=Arc Angle
|
||||
ability.sweepWaves=Waves
|
||||
ability.rotSpeed=Rot Speed
|
||||
ability.piercing=Piercing
|
||||
ability.innerRadius=Inner Radius
|
||||
|
||||
# Projectile
|
||||
ability.projectileType=Projectile Type
|
||||
|
||||
# Orb Settings
|
||||
ability.homing=Homing
|
||||
ability.explosive=Explosive
|
||||
ability.firingSpeed=Firing Speed
|
||||
ability.amount=Amount
|
||||
ability.dualCharge=Dual Charging
|
||||
|
||||
# Vortex Settings
|
||||
ability.pullRadius=Radius
|
||||
ability.pullStrength=Strength
|
||||
ability.pullTo=Pull To
|
||||
ability.aoe=AOE
|
||||
# Charge
|
||||
ability.chargeSpeed=Charge Speed
|
||||
|
||||
# Dash
|
||||
ability.dashMode=Dash Mode
|
||||
ability.dashDistance=Dash Distance
|
||||
ability.dashSpeed=Dash Speed
|
||||
|
||||
# Teleport
|
||||
ability.blinkRadius=Blink Radius
|
||||
ability.blinkCount=Blink Count
|
||||
ability.blinkDelay=Blink Delay
|
||||
ability.behindDistance=Behind Distance
|
||||
ability.lineOfSight=Line of Sight
|
||||
ability.damageAtStart=Damage At Start
|
||||
ability.damageAtEnd=Damage At End
|
||||
|
||||
# Vortex
|
||||
ability.pullRadius=Pull Radius
|
||||
ability.pullStrength=Pull Strength
|
||||
ability.maxTargets=Max Targets
|
||||
|
||||
# Dash Settings
|
||||
ability.dash.aggressive=Aggressive
|
||||
ability.dash.defensive=Defensive
|
||||
ability.mode=Mode
|
||||
ability.behindDistance=Behind Dist
|
||||
# Shockwave
|
||||
ability.pushStrength=Push Strength
|
||||
|
||||
# Teleport Settings
|
||||
ability.blinkCount=Blinks
|
||||
ability.blinkDelay=Delay
|
||||
ability.blinkRadius=Radius
|
||||
ability.minRadius=Min Rad
|
||||
ability.dmgRadius=Dmg Radius
|
||||
ability.lineOfSight=Line Sight
|
||||
ability.dmgAtStart=Dmg Start
|
||||
# Guard
|
||||
ability.damageReduction=Damage Reduction
|
||||
|
||||
# Projectile Settings
|
||||
ability.explRadius=Expl Rad
|
||||
|
||||
# Beam Settings
|
||||
ability.beamLength=Length
|
||||
ability.beamWidth=Width
|
||||
ability.beamHeight=Height
|
||||
ability.dmgInterval=Interval
|
||||
ability.sweepAngle=Sweep Ang
|
||||
ability.sweepSpeed=Sweep Spd
|
||||
ability.lockTarget=Lock Tgt
|
||||
ability.rotations=Rotations
|
||||
|
||||
# Guard Settings
|
||||
ability.dmgReduce=Dmg Reduce
|
||||
ability.counterDmg=Counter Dmg
|
||||
ability.canCounter=Counter
|
||||
ability.counterChance=Counter %
|
||||
ability.counterType=Counter Type
|
||||
ability.counterValue=Counter Value
|
||||
ability.counterSound=Counter Sound
|
||||
ability.counterAnim=Counter Anim
|
||||
|
||||
# Heal Settings
|
||||
ability.healAmount=Amount
|
||||
ability.healPercent=Percent
|
||||
ability.healRadius=Radius
|
||||
# Heal
|
||||
ability.instantHeal=Instant Heal
|
||||
ability.healAmount=Heal Amount
|
||||
ability.healPercent=Heal Percent
|
||||
ability.healRadius=Heal Radius
|
||||
ability.healSelf=Heal Self
|
||||
ability.healAllies=Heal Allies
|
||||
|
||||
# Hazard Settings
|
||||
ability.dmgPerSec=Dmg/Sec
|
||||
ability.debuffDur=Debuff Dur
|
||||
# Hazard
|
||||
ability.shape=Shape
|
||||
ability.placement=Placement
|
||||
ability.affectsCaster=Hit Caster
|
||||
ability.ignoreInvuln=Ign Invuln
|
||||
ability.place.caster=At Caster
|
||||
ability.place.target=At Target
|
||||
ability.place.followCaster=Follow Caster
|
||||
ability.place.followTarget=Follow Target
|
||||
ability.place.ahead=Ahead
|
||||
ability.damagePerSecond=Damage/Sec
|
||||
ability.damageInterval=Damage Interval
|
||||
ability.slownessLevel=Slowness Level
|
||||
ability.debuffDuration=Debuff Duration
|
||||
ability.poisonLevel=Poison Level
|
||||
ability.affectsCaster=Affects Caster
|
||||
|
||||
# Trap Settings
|
||||
ability.triggerRadius=Trig Rad
|
||||
# Trap
|
||||
ability.armTime=Arm Time
|
||||
ability.maxTriggers=Max Trig
|
||||
ability.maxTriggers=Max Triggers
|
||||
ability.triggerCooldown=Trigger Cooldown
|
||||
|
||||
# Disc Settings
|
||||
ability.discRadius=Disc Rad
|
||||
ability.discThickness=Thickness
|
||||
ability.boomerang=Boomerang
|
||||
ability.boomerangDelay=Return Delay
|
||||
ability.homingStr=Homing Str
|
||||
ability.homingRange=Homing Rng
|
||||
ability.explosionRad=Expl Rad
|
||||
ability.rotationSpeed=Rot Speed
|
||||
# Sweeper
|
||||
ability.sweepSpeed=Sweep Speed
|
||||
ability.rotations=Rotations
|
||||
ability.piercing=Piercing
|
||||
ability.lockTarget=Lock Target
|
||||
|
||||
# Beam / Laser
|
||||
ability.beamWidth=Beam Width
|
||||
ability.headSize=Head Size
|
||||
ability.attachedToOwner=Attached to Owner
|
||||
ability.laserWidth=Laser Width
|
||||
ability.expansionSpeed=Expansion Speed
|
||||
ability.lingerTicks=Linger Ticks
|
||||
|
||||
# Visual Settings
|
||||
ability.innerColor=Inner Color
|
||||
ability.outerColor=Outer Color
|
||||
ability.outerEnabled=Outer Glow
|
||||
@@ -1700,22 +1810,11 @@ ability.outerAlpha=Outer Alpha
|
||||
ability.lightning=Lightning
|
||||
ability.lightningDensity=Density
|
||||
ability.lightningRadius=Radius
|
||||
ability.anchorPoint=Anchor Point
|
||||
ability.noVisualSettings=No visual settings for this ability type
|
||||
|
||||
# Dual Energy Projectile Settings
|
||||
ability.dualFire=Dual Fire
|
||||
ability.dualFireDelay=Fire Delay
|
||||
|
||||
# Laser Shot Settings
|
||||
ability.laserWidth=Laser Width
|
||||
ability.expansionSpeed=Expansion Spd
|
||||
ability.lingerTicks=Linger Ticks
|
||||
|
||||
# Energy Beam Settings
|
||||
ability.headSize=Head Size
|
||||
ability.attachedToOwner=Attached
|
||||
|
||||
# Ability Save/Load
|
||||
ability.save.confirm=Save ability preset
|
||||
ability.save.overwrite=Overwrite existing preset
|
||||
@@ -1729,23 +1828,17 @@ ability.manager.title=Ability Manager
|
||||
# Explosive Hover Text
|
||||
ability.explosive.noBlockDamage=Explosions do not destroy blocks
|
||||
|
||||
# Additional Orb Settings
|
||||
ability.explRadius=Expl Radius
|
||||
|
||||
# Telegraph Colors (for abilities that support separate colors)
|
||||
ability.windUpColor=Wind Up Color
|
||||
ability.activeColor=Active Color
|
||||
|
||||
# Shockwave Settings
|
||||
ability.pushRadius=Push Radius
|
||||
ability.pushStrength=Push Str
|
||||
# Shockwave Settings (dev)
|
||||
ability.shockwaveFalloff=Damage/knockback drop off with distance
|
||||
|
||||
# Ability Config GUI
|
||||
# Ability Config GUI (dev)
|
||||
ability.typeId=Type ID
|
||||
ability.conditions=Conditions
|
||||
ability.noTypeSettings=No type-specific settings
|
||||
|
||||
# ═══════════════════════════════════════════════════════════════
|
||||
# Ability Hover Tooltips
|
||||
# ═══════════════════════════════════════════════════════════════
|
||||
|
||||
ability.hover.weight=Higher weight = more likely to be chosen when multiple abilities available
|
||||
ability.hover.lockMove=Prevents NPC from moving while ability is charging or active
|
||||
ability.hover.interruptible=If enabled, ability can be interrupted by taking damage
|
||||
@@ -1768,6 +1861,7 @@ ability.hover.piercing=Hits multiple targets instead of stopping on first hit
|
||||
ability.hover.lightning=Add electrical effect to visuals
|
||||
ability.hover.outerGlow=Enable outer glow layer around projectile
|
||||
ability.hover.anchorPoint=Where on the NPC the ability spawns from
|
||||
ability.hover.dualCharge=Whether or not should create two anchor points
|
||||
ability.hover.damage=Base damage dealt to targets
|
||||
ability.hover.speed=Movement speed of projectile
|
||||
ability.hover.lifetime=Maximum ticks before despawning
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Reference in new issue
Block a user