Declarative ability GUI: replace 18 SubGui classes with FieldDef system

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

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

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

No files matched your search

@@ -23,7 +23,11 @@ import noppes.npcs.entity.EntityNPCInterface;
import noppes.npcs.scripted.NpcAPI;
import noppes.npcs.scripted.event.AbilityEvent;
import kamkeel.npcs.controllers.data.ability.gui.FieldDef;
import kamkeel.npcs.controllers.data.ability.gui.TabTarget;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import net.minecraft.entity.Entity;
@@ -300,6 +304,91 @@ public abstract class Ability implements IAbility {
return true;
}
/**
* 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 List<FieldDef> getFieldDefinitions() {
return Collections.emptyList();
}
/**
* Returns field definitions for all base Ability fields (General, Target, Effects tabs).
*/
@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(TabTarget.GENERAL));
defs.add(FieldDef.intField("ability.weight", this::getWeight, this::setWeight)
.tab(TabTarget.GENERAL).range(1, 1000));
defs.add(FieldDef.enumField("ability.lockMove", LockMovementType.class,
this::getLockMovement, this::setLockMovement)
.tab(TabTarget.GENERAL).hover("ability.hover.lockMove"));
defs.add(FieldDef.boolField("ability.interruptible", this::isInterruptible, this::setInterruptible)
.tab(TabTarget.GENERAL).hover("ability.hover.interruptible"));
defs.add(FieldDef.intField("ability.dazed", this::getDazedTicks, this::setDazedTicks)
.tab(TabTarget.GENERAL).range(0, 1000)
.visibleWhen(this::isInterruptible));
defs.add(FieldDef.intField("ability.windup", this::getWindUpTicks, this::setWindUpTicks)
.tab(TabTarget.GENERAL).range(0, 1000));
defs.add(FieldDef.intField("ability.cooldown", this::getCooldownTicks, this::setCooldownTicks)
.tab(TabTarget.GENERAL).range(0, 10000));
defs.add(FieldDef.boolField("gui.enabled", this::isEnabled, this::setEnabled)
.tab(TabTarget.GENERAL));
// Target tab
defs.add(FieldDef.intField("ability.minRange", () -> (int) getMinRange(), v -> setMinRange(v))
.tab(TabTarget.TARGET).range(0, 100));
defs.add(FieldDef.intField("ability.maxRange", () -> (int) getMaxRange(), v -> setMaxRange(v))
.tab(TabTarget.TARGET).range(1, 100));
if (!isTargetingModeLocked()) {
defs.add(FieldDef.enumField("ability.targeting", TargetingMode.class,
this::getTargetingMode, this::setTargetingMode)
.tab(TabTarget.TARGET).hover("ability.hover.targeting"));
}
// Effects tab
defs.add(FieldDef.soundSubGui("ability.windUpSound", this::getWindUpSound, this::setWindUpSound)
.tab(TabTarget.EFFECTS));
defs.add(FieldDef.soundSubGui("ability.activeSound", this::getActiveSound, this::setActiveSound)
.tab(TabTarget.EFFECTS));
defs.add(FieldDef.animSubGui("ability.windUpAnim",
this::getWindUpAnimationId, this::setWindUpAnimationId,
this::getWindUpAnimationName, this::setWindUpAnimationName)
.tab(TabTarget.EFFECTS));
defs.add(FieldDef.animSubGui("ability.activeAnim",
this::getActiveAnimationId, this::setActiveAnimationId,
this::getActiveAnimationName, this::setActiveAnimationName)
.tab(TabTarget.EFFECTS));
TelegraphType tType = getTelegraphType();
if (tType != null && tType != TelegraphType.NONE) {
defs.add(FieldDef.boolField("ability.showTelegraph", this::isShowTelegraph, this::setShowTelegraph)
.tab(TabTarget.EFFECTS).hover("ability.hover.showTelegraph"));
defs.add(FieldDef.colorSubGui("ability.windUpColor", this::getWindUpColor, this::setWindUpColor)
.tab(TabTarget.EFFECTS).visibleWhen(this::isShowTelegraph));
defs.add(FieldDef.colorSubGui("ability.activeColor", this::getActiveColor, this::setActiveColor)
.tab(TabTarget.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());
all.addAll(getFieldDefinitions());
return all;
}
/**
* 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.
@@ -0,0 +1,7 @@
package kamkeel.npcs.controllers.data.ability.gui;
public enum ColumnHint {
FULL,
LEFT,
RIGHT
}
@@ -0,0 +1,287 @@
package kamkeel.npcs.controllers.data.ability.gui;
import kamkeel.npcs.controllers.data.ability.AbilityEffect;
import noppes.npcs.client.gui.SubGuiColorSelector;
import noppes.npcs.client.gui.advanced.ability.SubGuiAbilityEffects;
import noppes.npcs.client.gui.select.GuiAnimationSelection;
import noppes.npcs.client.gui.select.GuiSoundSelection;
import noppes.npcs.client.gui.util.SubGuiInterface;
import java.util.List;
import java.util.function.BooleanSupplier;
import java.util.function.Consumer;
import java.util.function.Supplier;
/**
* Declarative field definition for ability GUI rendering.
* Built via static factories and chaining methods.
*/
public class FieldDef {
private final String label;
private final FieldType type;
private TabTarget tab = TabTarget.TYPE;
private String customTabName = null;
private ColumnHint column = ColumnHint.FULL;
private Supplier<Object> getter;
private Consumer<Object> setter;
private BooleanSupplier visibleWhen = () -> true;
private String tooltip = null;
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;
private FieldDef(String label, FieldType type) {
this.label = label;
this.type = type;
}
// ═══════════════════════════════════════════════════════════════════
// STATIC FACTORIES
// ═══════════════════════════════════════════════════════════════════
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 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;
}
// ═══════════════════════════════════════════════════════════════════
// 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 effectsSubGui(String label, Supplier<List<AbilityEffect>> getter, Consumer<List<AbilityEffect>> setter) {
return subGuiField(label,
() -> new SubGuiAbilityEffects(getter.get()),
gui -> {
List<AbilityEffect> r = ((SubGuiAbilityEffects) gui).getResult();
if (r != null) setter.accept(r);
});
}
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" : truncateEnd(s, 10);
})
.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 truncateEnd(name, 8);
int id = idGetter.get();
return id >= 0 ? "ID: " + id : "gui.none";
})
.clearable(() -> { idSetter.accept(-1); nameSetter.accept(""); });
}
// ═══════════════════════════════════════════════════════════════════
// CHAINING METHODS
// ═══════════════════════════════════════════════════════════════════
public FieldDef tab(TabTarget tab) {
this.tab = tab;
return this;
}
public FieldDef customTab(String tabName) {
this.tab = TabTarget.CUSTOM;
this.customTabName = tabName;
return this;
}
public FieldDef range(float min, float max) {
this.min = min;
this.max = max;
return this;
}
public FieldDef column(ColumnHint column) {
this.column = column;
return this;
}
public FieldDef visibleWhen(BooleanSupplier condition) {
this.visibleWhen = condition;
return this;
}
public FieldDef tooltip(String tooltip) {
this.tooltip = tooltip;
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 TabTarget getTab() { return tab; }
public String getCustomTabName() { return customTabName; }
public ColumnHint getColumn() { return column; }
public boolean isVisible() { return visibleWhen.getAsBoolean(); }
public String getTooltip() { return tooltip; }
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;
}
// ═══════════════════════════════════════════════════════════════════
// HELPERS
// ═══════════════════════════════════════════════════════════════════
static String truncateEnd(String str, int maxLen) {
if (str == null) return "";
if (str.length() <= maxLen) return str;
int lastSlash = str.lastIndexOf('/');
if (lastSlash >= 0 && str.length() - lastSlash <= maxLen) {
return "..." + str.substring(lastSlash);
}
return "..." + str.substring(str.length() - maxLen + 3);
}
}
@@ -0,0 +1,11 @@
package kamkeel.npcs.controllers.data.ability.gui;
public enum FieldType {
FLOAT,
INT,
BOOLEAN,
ENUM,
STRING_ENUM,
SUB_GUI,
STRING
}
@@ -0,0 +1,28 @@
package kamkeel.npcs.controllers.data.ability.gui;
/**
* Simple data class representing a tab in the ability config GUI.
* Built automatically from the FieldDef list.
*/
public class TabDef {
public final String name;
public final TabTarget target;
public int index;
public TabDef(String name, TabTarget target, int index) {
this.name = name;
this.target = target;
this.index = index;
}
/**
* Returns a unique key combining target and custom name for deduplication.
*/
public String getKey() {
if (target == TabTarget.CUSTOM && name != null) {
return "CUSTOM:" + name;
}
return target.name();
}
}
@@ -0,0 +1,10 @@
package kamkeel.npcs.controllers.data.ability.gui;
public enum TabTarget {
GENERAL,
TYPE,
TARGET,
EFFECTS,
VISUAL,
CUSTOM
}
@@ -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 kamkeel.npcs.controllers.data.ability.gui.FieldDef;
import kamkeel.npcs.controllers.data.ability.gui.TabTarget;
import noppes.npcs.api.ability.type.IAbilityCharge;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
@@ -63,12 +63,6 @@ public class AbilityCharge extends Ability implements IAbilityCharge {
return true;
}
@Override
@SideOnly(Side.CLIENT)
public SubGuiAbilityConfig createConfigGui(IAbilityConfigCallback callback) {
return new SubGuiAbilityCharge(this, callback);
}
@Override
public boolean isTargetingModeLocked() {
return true;
@@ -405,4 +399,15 @@ public class AbilityCharge extends Ability implements IAbilityCharge {
public void setHitWidth(float hitWidth) {
this.hitWidth = hitWidth;
}
@Override
public List<FieldDef> getFieldDefinitions() {
return Arrays.asList(
FieldDef.floatField("enchantment.damage", this::getDamage, this::setDamage),
FieldDef.floatField("stats.speed", this::getChargeSpeed, this::setChargeSpeed),
FieldDef.floatField("ability.knockback", this::getKnockback, this::setKnockback),
FieldDef.floatField("ability.hitWidth", this::getHitWidth, this::setHitWidth),
FieldDef.effectsSubGui("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,14 @@ 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 kamkeel.npcs.controllers.data.ability.gui.FieldDef;
import kamkeel.npcs.controllers.data.ability.gui.TabTarget;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
@@ -68,12 +67,6 @@ public class AbilityCutter extends Ability implements IAbilityCutter {
return true;
}
@Override
@SideOnly(Side.CLIENT)
public SubGuiAbilityConfig createConfigGui(IAbilityConfigCallback callback) {
return new SubGuiAbilityCutter(this, callback);
}
@Override
public boolean isTargetingModeLocked() {
return true;
@@ -311,4 +304,24 @@ public class AbilityCutter extends Ability implements IAbilityCutter {
public float getCurrentRotation() {
return currentRotation;
}
@Override
public List<FieldDef> getFieldDefinitions() {
return Arrays.asList(
FieldDef.floatField("enchantment.damage", this::getDamage, this::setDamage),
FieldDef.floatField("gui.range", this::getRange, this::setRange),
FieldDef.floatField("ability.arcAngle", this::getArcAngle, this::setArcAngle),
FieldDef.floatField("ability.innerRadius", this::getInnerRadius, this::setInnerRadius),
FieldDef.floatField("ability.knockback", this::getKnockback, this::setKnockback),
FieldDef.floatField("ability.sweepSpeed", this::getSweepSpeed, this::setSweepSpeed),
FieldDef.enumField("ability.sweepMode", SweepMode.class, this::getSweepModeEnum, this::setSweepModeEnum)
.hover("ability.hover.sweepMode"),
FieldDef.boolField("ability.piercing", this::isPiercing, this::setPiercing)
.hover("ability.hover.piercing"),
FieldDef.intField("ability.duration", this::getSpinDurationTicks, this::setSpinDurationTicks)
.range(1, 1000)
.visibleWhen(() -> this.getSweepModeEnum() == SweepMode.SPIN),
FieldDef.effectsSubGui("ability.effects", this::getEffects, this::setEffects)
);
}
}
@@ -10,13 +10,14 @@ 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.SubGuiAbilityDash;
import noppes.npcs.client.gui.util.IAbilityConfigCallback;
import noppes.npcs.entity.EntityNPCInterface;
import kamkeel.npcs.controllers.data.ability.gui.FieldDef;
import kamkeel.npcs.controllers.data.ability.gui.TabTarget;
import noppes.npcs.api.ability.type.IAbilityDash;
import java.util.Arrays;
import java.util.List;
import java.util.Random;
/**
@@ -104,13 +105,6 @@ public class AbilityDash extends Ability implements IAbilityDash {
return true;
}
@Override
@SideOnly(Side.CLIENT)
public SubGuiAbilityConfig createConfigGui(
IAbilityConfigCallback callback) {
return new SubGuiAbilityDash(this, callback);
}
@Override
public boolean isTargetingModeLocked() {
return true;
@@ -349,4 +343,14 @@ public class AbilityDash extends Ability implements IAbilityDash {
public DashDirection getChosenDirection() {
return chosenDirection;
}
@Override
public List<FieldDef> getFieldDefinitions() {
return Arrays.asList(
FieldDef.enumField("ability.mode", DashMode.class, this::getDashModeEnum, this::setDashModeEnum)
.hover("ability.hover.dashMode"),
FieldDef.floatField("ability.dashDist", 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 kamkeel.npcs.controllers.data.ability.gui.FieldDef;
import kamkeel.npcs.controllers.data.ability.gui.TabTarget;
import noppes.npcs.api.ability.type.IAbilityDisc;
import java.util.Arrays;
import java.util.List;
import noppes.npcs.entity.EntityNPCInterface;
/**
@@ -69,12 +71,6 @@ public class AbilityDisc extends Ability implements IAbilityDisc {
return true;
}
@Override
@SideOnly(Side.CLIENT)
public SubGuiAbilityConfig createConfigGui(IAbilityConfigCallback callback) {
return new SubGuiAbilityDisc(this, callback);
}
@Override
public boolean isTargetingModeLocked() {
return true;
@@ -279,4 +275,56 @@ public class AbilityDisc extends Ability implements IAbilityDisc {
public int getPreviewActiveDuration() {
return lifespanData.maxLifetime > 0 ? Math.min(lifespanData.maxLifetime, 100) : 100;
}
@Override
public List<FieldDef> getFieldDefinitions() {
return Arrays.asList(
// Type tab
FieldDef.floatField("enchantment.damage", this::getDamage, this::setDamage),
FieldDef.floatField("stats.speed", this::getSpeed, this::setSpeed),
FieldDef.floatField("ability.discRadius", this::getDiscRadius, this::setDiscRadius),
FieldDef.floatField("ability.discThickness", this::getDiscThickness, this::setDiscThickness),
FieldDef.boolField("ability.homing", this::isHoming, this::setHoming)
.hover("ability.hover.homing"),
FieldDef.floatField("ability.homingStr", this::getHomingStrength, this::setHomingStrength)
.visibleWhen(this::isHoming),
FieldDef.boolField("ability.boomerang", this::isBoomerang, this::setBoomerang)
.hover("ability.hover.boomerang"),
FieldDef.intField("ability.boomerangDelay", this::getBoomerangDelay, this::setBoomerangDelay)
.visibleWhen(this::isBoomerang),
FieldDef.boolField("ability.explosive", this::isExplosive, this::setExplosive)
.hover("ability.hover.explosive"),
FieldDef.floatField("ability.explosionRad", this::getExplosionRadius, this::setExplosionRadius)
.visibleWhen(this::isExplosive),
FieldDef.floatField("ability.knockback", this::getKnockback, this::setKnockback),
FieldDef.floatField("ability.maxDist", this::getMaxDistance, this::setMaxDistance),
FieldDef.intField("ability.lifetime", this::getMaxLifetime, this::setMaxLifetime),
FieldDef.effectsSubGui("ability.effects", this::getEffects, this::setEffects),
// Visual tab
FieldDef.enumField("ability.anchorPoint", AnchorPoint.class, this::getAnchorPointEnum, this::setAnchorPointEnum)
.tab(TabTarget.VISUAL),
FieldDef.colorSubGui("ability.innerColor", this::getInnerColor, this::setInnerColor)
.tab(TabTarget.VISUAL),
FieldDef.colorSubGui("ability.outerColor", this::getOuterColor, this::setOuterColor)
.tab(TabTarget.VISUAL),
FieldDef.boolField("ability.outerEnabled", this::isOuterColorEnabled, this::setOuterColorEnabled)
.tab(TabTarget.VISUAL),
FieldDef.floatField("ability.outerWidth", this::getOuterColorWidth, this::setOuterColorWidth)
.tab(TabTarget.VISUAL)
.visibleWhen(this::isOuterColorEnabled),
FieldDef.floatField("ability.outerAlpha", this::getOuterColorAlpha, this::setOuterColorAlpha)
.tab(TabTarget.VISUAL).range(0, 1)
.visibleWhen(this::isOuterColorEnabled),
FieldDef.floatField("ability.rotationSpeed", this::getRotationSpeed, this::setRotationSpeed)
.tab(TabTarget.VISUAL),
FieldDef.boolField("ability.lightning", this::hasLightningEffect, this::setLightningEffect)
.tab(TabTarget.VISUAL),
FieldDef.floatField("ability.lightningDensity", this::getLightningDensity, this::setLightningDensity)
.tab(TabTarget.VISUAL).range(0.01f, 5.0f)
.visibleWhen(this::hasLightningEffect),
FieldDef.floatField("ability.lightningRadius", this::getLightningRadius, this::setLightningRadius)
.tab(TabTarget.VISUAL).range(0.1f, 10.0f)
.visibleWhen(this::hasLightningEffect)
);
}
}
@@ -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 kamkeel.npcs.controllers.data.ability.gui.FieldDef;
import kamkeel.npcs.controllers.data.ability.gui.TabTarget;
import noppes.npcs.api.ability.type.IAbilityEnergyBeam;
import java.util.Arrays;
import java.util.List;
import noppes.npcs.entity.EntityNPCInterface;
/**
@@ -66,12 +68,6 @@ public class AbilityEnergyBeam extends Ability implements IAbilityEnergyBeam {
return true;
}
@Override
@SideOnly(Side.CLIENT)
public SubGuiAbilityConfig createConfigGui(IAbilityConfigCallback callback) {
return new SubGuiAbilityEnergyBeam(this, callback);
}
@Override
public boolean isTargetingModeLocked() {
return true;
@@ -282,4 +278,54 @@ public class AbilityEnergyBeam extends Ability implements IAbilityEnergyBeam {
public int getPreviewActiveDuration() {
return lifespanData.maxLifetime > 0 ? Math.min(lifespanData.maxLifetime, 100) : 100;
}
@Override
public List<FieldDef> getFieldDefinitions() {
return Arrays.asList(
// Type tab
FieldDef.floatField("enchantment.damage", this::getDamage, this::setDamage),
FieldDef.floatField("stats.speed", this::getSpeed, this::setSpeed),
FieldDef.floatField("ability.beamWidth", this::getBeamWidth, this::setBeamWidth),
FieldDef.floatField("ability.headSize", this::getHeadSize, this::setHeadSize),
FieldDef.boolField("ability.homing", this::isHoming, this::setHoming)
.hover("ability.hover.homing"),
FieldDef.floatField("ability.homingStr", this::getHomingStrength, this::setHomingStrength)
.visibleWhen(this::isHoming),
FieldDef.floatField("ability.homingRange", this::getHomingRange, this::setHomingRange)
.visibleWhen(this::isHoming),
FieldDef.floatField("ability.maxDist", this::getMaxDistance, this::setMaxDistance),
FieldDef.boolField("ability.explosive", this::isExplosive, this::setExplosive)
.hover("ability.hover.explosive"),
FieldDef.floatField("ability.explosionRad", this::getExplosionRadius, this::setExplosionRadius)
.visibleWhen(this::isExplosive),
FieldDef.floatField("ability.knockback", this::getKnockback, this::setKnockback),
FieldDef.intField("ability.lifetime", this::getMaxLifetime, this::setMaxLifetime),
FieldDef.effectsSubGui("ability.effects", this::getEffects, this::setEffects),
// Visual tab
FieldDef.enumField("ability.anchorPoint", AnchorPoint.class, this::getAnchorPointEnum, this::setAnchorPointEnum)
.tab(TabTarget.VISUAL),
FieldDef.colorSubGui("ability.innerColor", this::getInnerColor, this::setInnerColor)
.tab(TabTarget.VISUAL),
FieldDef.colorSubGui("ability.outerColor", this::getOuterColor, this::setOuterColor)
.tab(TabTarget.VISUAL),
FieldDef.boolField("ability.outerEnabled", this::isOuterColorEnabled, this::setOuterColorEnabled)
.tab(TabTarget.VISUAL),
FieldDef.floatField("ability.outerWidth", this::getOuterColorWidth, this::setOuterColorWidth)
.tab(TabTarget.VISUAL)
.visibleWhen(this::isOuterColorEnabled),
FieldDef.floatField("ability.outerAlpha", this::getOuterColorAlpha, this::setOuterColorAlpha)
.tab(TabTarget.VISUAL).range(0, 1)
.visibleWhen(this::isOuterColorEnabled),
FieldDef.floatField("ability.rotationSpeed", this::getRotationSpeed, this::setRotationSpeed)
.tab(TabTarget.VISUAL),
FieldDef.boolField("ability.lightning", this::hasLightningEffect, this::setLightningEffect)
.tab(TabTarget.VISUAL),
FieldDef.floatField("ability.lightningDensity", this::getLightningDensity, this::setLightningDensity)
.tab(TabTarget.VISUAL).range(0.01f, 5.0f)
.visibleWhen(this::hasLightningEffect),
FieldDef.floatField("ability.lightningRadius", this::getLightningRadius, this::setLightningRadius)
.tab(TabTarget.VISUAL).range(0.1f, 10.0f)
.visibleWhen(this::hasLightningEffect)
);
}
}
@@ -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,15 @@ 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 kamkeel.npcs.controllers.data.ability.gui.FieldDef;
import kamkeel.npcs.controllers.data.ability.gui.TabTarget;
import java.util.Arrays;
import java.util.List;
import java.util.Random;
/**
@@ -67,13 +67,6 @@ public class AbilityGuard extends Ability implements IAbilityGuard {
return true;
}
@Override
@SideOnly(Side.CLIENT)
public SubGuiAbilityConfig createConfigGui(
IAbilityConfigCallback callback) {
return new SubGuiAbilityGuard(this, callback);
}
@Override
public boolean isTargetingModeLocked() {
return true;
@@ -290,4 +283,27 @@ public class AbilityGuard extends Ability implements IAbilityGuard {
public void setCounterAnimationId(int counterAnimationId) {
this.counterAnimationId = counterAnimationId;
}
@Override
public List<FieldDef> getFieldDefinitions() {
return Arrays.asList(
FieldDef.intField("ability.duration", this::getDurationTicks, this::setDurationTicks)
.range(1, 1000),
FieldDef.floatField("ability.dmgReduce", this::getDamageReduction, this::setDamageReduction),
FieldDef.boolField("ability.canCounter", this::isCanCounter, this::setCanCounter)
.hover("ability.hover.canCounter"),
FieldDef.enumField("ability.counterType", CounterType.class, this::getCounterTypeEnum, this::setCounterTypeEnum)
.hover("ability.hover.counterType")
.visibleWhen(this::isCanCounter),
FieldDef.floatField("ability.counterValue", this::getCounterValue, this::setCounterValue)
.visibleWhen(this::isCanCounter),
FieldDef.floatField("ability.counterChance", this::getCounterChance, this::setCounterChance)
.visibleWhen(this::isCanCounter),
FieldDef.stringField("ability.counterSound", this::getCounterSound, this::setCounterSound)
.visibleWhen(this::isCanCounter),
FieldDef.intField("ability.counterAnim", this::getCounterAnimationId, this::setCounterAnimationId)
.visibleWhen(this::isCanCounter),
FieldDef.effectsSubGui("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,14 @@ 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 kamkeel.npcs.controllers.data.ability.gui.FieldDef;
import kamkeel.npcs.controllers.data.ability.gui.TabTarget;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Random;
@@ -95,13 +94,6 @@ public class AbilityHazard extends Ability implements IAbilityHazard {
return true;
}
@Override
@SideOnly(Side.CLIENT)
public SubGuiAbilityConfig createConfigGui(
IAbilityConfigCallback callback) {
return new SubGuiAbilityHazard(this, callback);
}
@Override
public boolean isTargetingModeLocked() {
return true;
@@ -616,4 +608,26 @@ public class AbilityHazard extends Ability implements IAbilityHazard {
public double getZoneZ() {
return zoneZ;
}
@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.floatField("ability.radius", this::getRadius, this::setRadius),
FieldDef.floatField("ability.innerRadius", this::getInnerRadius, this::setInnerRadius),
FieldDef.floatField("ability.dmgPerSec", this::getDamagePerSecond, this::setDamagePerSecond),
FieldDef.intField("ability.dmgInterval", this::getDamageInterval, this::setDamageInterval),
FieldDef.intField("ability.slownessLvl", this::getSlownessLevel, this::setSlownessLevel),
FieldDef.intField("ability.debuffDur", this::getDebuffDuration, this::setDebuffDuration),
FieldDef.intField("ability.poisonLvl", this::getPoisonLevel, this::setPoisonLevel),
FieldDef.boolField("ability.affectsCaster", this::isAffectsCaster, this::setAffectsCaster)
.hover("ability.hover.affectsCaster"),
FieldDef.effectsSubGui("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,14 @@ 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 kamkeel.npcs.controllers.data.ability.gui.FieldDef;
import kamkeel.npcs.controllers.data.ability.gui.TabTarget;
import noppes.npcs.api.ability.type.IAbilityHeal;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
@@ -63,12 +61,6 @@ public class AbilityHeal extends Ability implements IAbilityHeal {
return true;
}
@Override
@SideOnly(Side.CLIENT)
public SubGuiAbilityConfig createConfigGui(IAbilityConfigCallback callback) {
return new SubGuiAbilityHeal(this, callback);
}
@Override
public boolean isTargetingModeLocked() {
return true;
@@ -289,4 +281,22 @@ public class AbilityHeal extends Ability implements IAbilityHeal {
public void setInstantHeal(boolean instantHeal) {
this.instantHeal = instantHeal;
}
@Override
public List<FieldDef> getFieldDefinitions() {
return Arrays.asList(
FieldDef.boolField("dialog.instant", this::isInstantHeal, this::setInstantHeal)
.hover("ability.hover.instant"),
FieldDef.intField("ability.duration", this::getDurationTicks, this::setDurationTicks)
.range(1, 1000)
.visibleWhen(() -> !this.isInstantHeal()),
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.boolField("ability.healSelf", this::isHealSelf, this::setHealSelf)
.hover("ability.hover.healSelf"),
FieldDef.boolField("ability.healAllies", this::isHealAllies, this::setHealAllies)
.hover("ability.hover.healAllies")
);
}
}
@@ -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;
@@ -9,12 +7,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 kamkeel.npcs.controllers.data.ability.gui.FieldDef;
import kamkeel.npcs.controllers.data.ability.gui.TabTarget;
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.
@@ -44,13 +44,6 @@ public class AbilityHeavyHit extends Ability implements IAbilityHeavyHit {
return true;
}
@Override
@SideOnly(Side.CLIENT)
public SubGuiAbilityConfig createConfigGui(
IAbilityConfigCallback callback) {
return new SubGuiAbilityHeavyHit(this, callback);
}
@Override
public boolean isTargetingModeLocked() {
return true;
@@ -113,4 +106,13 @@ public class AbilityHeavyHit extends Ability implements IAbilityHeavyHit {
public void setKnockback(float knockback) {
this.knockback = knockback;
}
@Override
public List<FieldDef> getFieldDefinitions() {
return Arrays.asList(
FieldDef.floatField("enchantment.damage", this::getDamage, this::setDamage),
FieldDef.floatField("ability.knockback", this::getKnockback, this::setKnockback),
FieldDef.effectsSubGui("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 kamkeel.npcs.controllers.data.ability.gui.FieldDef;
import kamkeel.npcs.controllers.data.ability.gui.TabTarget;
import kamkeel.npcs.controllers.data.ability.data.EnergyCombatData;
import kamkeel.npcs.controllers.data.ability.data.EnergyLifespanData;
import kamkeel.npcs.controllers.data.ability.data.EnergyLightningData;
@@ -16,10 +18,10 @@ 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.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;
/**
@@ -63,12 +65,6 @@ public class AbilityLaserShot extends Ability implements IAbilityLaserShot {
return true;
}
@Override
@SideOnly(Side.CLIENT)
public SubGuiAbilityConfig createConfigGui(IAbilityConfigCallback callback) {
return new SubGuiAbilityLaserShot(this, callback);
}
@Override
public boolean isTargetingModeLocked() {
return false;
@@ -229,4 +225,45 @@ public class AbilityLaserShot extends Ability implements IAbilityLaserShot {
public boolean spawnPreviewDuringWindup() {
return false; // Laser has no charging, spawns at active phase
}
@Override
public List<FieldDef> getFieldDefinitions() {
return Arrays.asList(
// Type tab
FieldDef.floatField("enchantment.damage", this::getDamage, this::setDamage),
FieldDef.floatField("ability.laserWidth", this::getLaserWidth, this::setLaserWidth),
FieldDef.floatField("ability.expansionSpeed", this::getExpansionSpeed, this::setExpansionSpeed),
FieldDef.intField("ability.lingerTicks", this::getLingerTicks, this::setLingerTicks),
FieldDef.floatField("ability.maxDist", this::getMaxDistance, this::setMaxDistance),
FieldDef.intField("ability.lifetime", this::getMaxLifetime, this::setMaxLifetime),
FieldDef.boolField("ability.explosive", this::isExplosive, this::setExplosive)
.hover("ability.hover.explosive"),
FieldDef.floatField("ability.explosionRad", this::getExplosionRadius, this::setExplosionRadius)
.visibleWhen(this::isExplosive),
FieldDef.floatField("ability.knockback", this::getKnockback, this::setKnockback),
FieldDef.floatField("ability.knockbackUp", this::getKnockbackUp, this::setKnockbackUp),
FieldDef.effectsSubGui("ability.effects", this::getEffects, this::setEffects),
// Visual tab
FieldDef.colorSubGui("ability.innerColor", this::getInnerColor, this::setInnerColor)
.tab(TabTarget.VISUAL),
FieldDef.colorSubGui("ability.outerColor", this::getOuterColor, this::setOuterColor)
.tab(TabTarget.VISUAL),
FieldDef.boolField("ability.outerEnabled", this::isOuterColorEnabled, this::setOuterColorEnabled)
.tab(TabTarget.VISUAL),
FieldDef.floatField("ability.outerWidth", this::getOuterColorWidth, this::setOuterColorWidth)
.tab(TabTarget.VISUAL)
.visibleWhen(this::isOuterColorEnabled),
FieldDef.floatField("ability.outerAlpha", this::getOuterColorAlpha, this::setOuterColorAlpha)
.tab(TabTarget.VISUAL).range(0, 1)
.visibleWhen(this::isOuterColorEnabled),
FieldDef.boolField("ability.lightning", this::hasLightningEffect, this::setLightningEffect)
.tab(TabTarget.VISUAL),
FieldDef.floatField("ability.lightningDensity", this::getLightningDensity, this::setLightningDensity)
.tab(TabTarget.VISUAL).range(0.01f, 5.0f)
.visibleWhen(this::hasLightningEffect),
FieldDef.floatField("ability.lightningRadius", this::getLightningRadius, this::setLightningRadius)
.tab(TabTarget.VISUAL).range(0.1f, 10.0f)
.visibleWhen(this::hasLightningEffect)
);
}
}
@@ -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 kamkeel.npcs.controllers.data.ability.gui.FieldDef;
import kamkeel.npcs.controllers.data.ability.gui.TabTarget;
import noppes.npcs.api.ability.type.IAbilityOrb;
import java.util.Arrays;
import java.util.List;
import noppes.npcs.entity.EntityNPCInterface;
/**
@@ -65,12 +67,6 @@ public class AbilityOrb extends Ability implements IAbilityOrb {
return true;
}
@Override
@SideOnly(Side.CLIENT)
public SubGuiAbilityConfig createConfigGui(IAbilityConfigCallback callback) {
return new SubGuiAbilityOrb(this, callback);
}
@Override
public boolean isTargetingModeLocked() {
return true;
@@ -418,4 +414,52 @@ public class AbilityOrb extends Ability implements IAbilityOrb {
public int getPreviewActiveDuration() {
return lifespanData.maxLifetime > 0 ? Math.min(lifespanData.maxLifetime, 100) : 100;
}
@Override
public List<FieldDef> getFieldDefinitions() {
return Arrays.asList(
// Type tab
FieldDef.floatField("enchantment.damage", this::getDamage, this::setDamage),
FieldDef.floatField("stats.speed", this::getOrbSpeed, this::setOrbSpeed),
FieldDef.floatField("stats.size", this::getOrbSize, this::setOrbSize),
FieldDef.floatField("ability.maxDist", this::getMaxDistance, this::setMaxDistance),
FieldDef.boolField("ability.homing", this::isHoming, this::setHoming)
.hover("ability.hover.homing"),
FieldDef.floatField("ability.homingStr", this::getHomingStrength, this::setHomingStrength)
.visibleWhen(this::isHoming),
FieldDef.boolField("ability.explosive", this::isExplosive, this::setExplosive)
.hover("ability.hover.explosive"),
FieldDef.floatField("ability.explosionRad", this::getExplosionRadius, this::setExplosionRadius)
.visibleWhen(this::isExplosive),
FieldDef.floatField("ability.knockback", this::getKnockback, this::setKnockback),
FieldDef.intField("ability.lifetime", this::getMaxLifetime, this::setMaxLifetime),
FieldDef.effectsSubGui("ability.effects", this::getEffects, this::setEffects),
// Visual tab
FieldDef.enumField("ability.anchorPoint", AnchorPoint.class, this::getAnchorPointEnum, this::setAnchorPointEnum)
.tab(TabTarget.VISUAL),
FieldDef.colorSubGui("ability.innerColor", this::getInnerColor, this::setInnerColor)
.tab(TabTarget.VISUAL),
FieldDef.floatField("ability.rotationSpeed", this::getRotationSpeed, this::setRotationSpeed)
.tab(TabTarget.VISUAL),
FieldDef.boolField("ability.outerEnabled", this::isOuterColorEnabled, this::setOuterColorEnabled)
.tab(TabTarget.VISUAL),
FieldDef.floatField("ability.outerAlpha", this::getOuterColorAlpha, this::setOuterColorAlpha)
.tab(TabTarget.VISUAL).range(0, 1)
.visibleWhen(this::isOuterColorEnabled),
FieldDef.colorSubGui("ability.outerColor", this::getOuterColor, this::setOuterColor)
.tab(TabTarget.VISUAL)
.visibleWhen(this::isOuterColorEnabled),
FieldDef.floatField("ability.outerWidth", this::getOuterColorWidth, this::setOuterColorWidth)
.tab(TabTarget.VISUAL)
.visibleWhen(this::isOuterColorEnabled),
FieldDef.boolField("ability.lightning", this::hasLightningEffect, this::setLightningEffect)
.tab(TabTarget.VISUAL),
FieldDef.floatField("ability.lightningDensity", this::getLightningDensity, this::setLightningDensity)
.tab(TabTarget.VISUAL).range(0.01f, 5.0f)
.visibleWhen(this::hasLightningEffect),
FieldDef.floatField("ability.lightningRadius", this::getLightningRadius, this::setLightningRadius)
.tab(TabTarget.VISUAL).range(0.1f, 10.0f)
.visibleWhen(this::hasLightningEffect)
);
}
}
@@ -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,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 kamkeel.npcs.controllers.data.ability.gui.FieldDef;
import kamkeel.npcs.controllers.data.ability.gui.TabTarget;
import java.util.Arrays;
import java.util.List;
/**
@@ -54,12 +53,6 @@ public class AbilityProjectile extends Ability implements IAbilityProjectile {
return true;
}
@Override
@SideOnly(Side.CLIENT)
public SubGuiAbilityConfig createConfigGui(IAbilityConfigCallback callback) {
return new SubGuiAbilityProjectile(this, callback);
}
@Override
public boolean isTargetingModeLocked() {
return true;
@@ -258,4 +251,23 @@ public class AbilityProjectile extends Ability implements IAbilityProjectile {
public void setHomingStrength(float homingStrength) {
this.homingStrength = homingStrength;
}
@Override
public List<FieldDef> getFieldDefinitions() {
return Arrays.asList(
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.projType", new String[]{"fireball", "arrow", "magic"}, this::getProjectileType, this::setProjectileType),
FieldDef.boolField("ability.explosive", this::isExplosive, this::setExplosive)
.hover("ability.hover.explosive"),
FieldDef.floatField("ability.explosionRad", this::getExplosionRadius, this::setExplosionRadius)
.visibleWhen(this::isExplosive),
FieldDef.boolField("ability.homing", this::isHoming, this::setHoming)
.hover("ability.hover.homing"),
FieldDef.floatField("ability.homingStr", this::getHomingStrength, this::setHomingStrength)
.visibleWhen(this::isHoming),
FieldDef.effectsSubGui("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,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 kamkeel.npcs.controllers.data.ability.gui.FieldDef;
import kamkeel.npcs.controllers.data.ability.gui.TabTarget;
import noppes.npcs.api.ability.type.IAbilityShockwave;
import java.util.Arrays;
import java.util.List;
/**
@@ -49,12 +47,6 @@ public class AbilityShockwave extends Ability implements IAbilityShockwave {
return true;
}
@Override
@SideOnly(Side.CLIENT)
public SubGuiAbilityConfig createConfigGui(IAbilityConfigCallback callback) {
return new SubGuiAbilityShockwave(this, callback);
}
@Override
public boolean isTargetingModeLocked() {
return true;
@@ -175,4 +167,14 @@ public class AbilityShockwave extends Ability implements IAbilityShockwave {
this.maxTargets = maxTargets;
}
@Override
public List<FieldDef> getFieldDefinitions() {
return Arrays.asList(
FieldDef.floatField("enchantment.damage", this::getDamage, this::setDamage),
FieldDef.floatField("ability.pushRadius", this::getPushRadius, this::setPushRadius),
FieldDef.floatField("ability.pushStrength", this::getPushStrength, this::setPushStrength),
FieldDef.intField("ability.maxTargets", this::getMaxTargets, this::setMaxTargets),
FieldDef.effectsSubGui("ability.effects", this::getEffects, this::setEffects)
);
}
}
@@ -13,14 +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 kamkeel.npcs.controllers.data.ability.gui.FieldDef;
import kamkeel.npcs.controllers.data.ability.gui.TabTarget;
import java.util.Arrays;
import java.util.List;
/**
@@ -71,12 +71,6 @@ public class AbilitySlam extends Ability implements IAbilitySlam {
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).
*/
@@ -573,4 +567,16 @@ public class AbilitySlam extends Ability implements IAbilitySlam {
public void setLeapHeight(float leapHeight) {
this.leapHeight = leapHeight;
}
@Override
public List<FieldDef> getFieldDefinitions() {
return Arrays.asList(
FieldDef.floatField("enchantment.damage", this::getDamage, this::setDamage),
FieldDef.floatField("ability.radius", this::getRadius, this::setRadius),
FieldDef.floatField("ability.knockback", this::getKnockbackStrength, this::setKnockbackStrength),
FieldDef.floatField("ability.leapSpeed", this::getLeapSpeed, this::setLeapSpeed),
FieldDef.floatField("ability.leapHeight", this::getLeapHeight, this::setLeapHeight),
FieldDef.effectsSubGui("ability.effects", this::getEffects, this::setEffects)
);
}
}
@@ -1,11 +1,11 @@
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;
import kamkeel.npcs.controllers.data.ability.data.EnergyColorData;
import kamkeel.npcs.controllers.data.ability.gui.FieldDef;
import kamkeel.npcs.controllers.data.ability.gui.TabTarget;
import kamkeel.npcs.controllers.data.telegraph.Telegraph;
import kamkeel.npcs.controllers.data.telegraph.TelegraphInstance;
import kamkeel.npcs.controllers.data.telegraph.TelegraphType;
@@ -14,10 +14,10 @@ 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;
/**
@@ -66,12 +66,6 @@ public class AbilitySweeper extends Ability implements IAbilitySweeper {
return true;
}
@Override
@SideOnly(Side.CLIENT)
public SubGuiAbilityConfig createConfigGui(IAbilityConfigCallback callback) {
return new SubGuiAbilitySweeper(this, callback);
}
@Override
public boolean isTargetingModeLocked() {
return true;
@@ -205,4 +199,33 @@ 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; }
@Override
public List<FieldDef> getFieldDefinitions() {
return Arrays.asList(
// Type tab
FieldDef.floatField("enchantment.damage", this::getDamage, this::setDamage),
FieldDef.intField("ability.dmgInterval", this::getDamageInterval, this::setDamageInterval),
FieldDef.floatField("ability.beamLength", this::getBeamLength, this::setBeamLength),
FieldDef.floatField("ability.beamWidth", this::getBeamWidth, this::setBeamWidth),
FieldDef.floatField("ability.beamHeight", this::getBeamHeight, this::setBeamHeight),
FieldDef.floatField("ability.sweepSpeed", this::getSweepSpeed, this::setSweepSpeed),
FieldDef.intField("ability.rotations", this::getNumberOfRotations, this::setNumberOfRotations),
FieldDef.boolField("ability.piercing", this::isPiercing, this::setPiercing)
.hover("ability.hover.piercing"),
FieldDef.boolField("ability.lockTarget", this::isLockOnTarget, this::setLockOnTarget)
.hover("ability.hover.lockTarget"),
FieldDef.effectsSubGui("ability.effects", this::getEffects, this::setEffects),
// Visual tab
FieldDef.colorSubGui("ability.innerColor", this::getInnerColor, this::setInnerColor)
.tab(TabTarget.VISUAL),
FieldDef.colorSubGui("ability.outerColor", this::getOuterColor, this::setOuterColor)
.tab(TabTarget.VISUAL),
FieldDef.boolField("ability.outerEnabled", this::isOuterColorEnabled, this::setOuterColorEnabled)
.tab(TabTarget.VISUAL),
FieldDef.floatField("ability.outerWidth", this::getOuterColorWidth, this::setOuterColorWidth)
.tab(TabTarget.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,14 @@ 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 kamkeel.npcs.controllers.data.ability.gui.FieldDef;
import kamkeel.npcs.controllers.data.ability.gui.TabTarget;
import java.util.Arrays;
import java.util.List;
import java.util.Random;
@@ -77,13 +76,6 @@ public class AbilityTeleport extends Ability implements IAbilityTeleport {
return true;
}
@Override
@SideOnly(Side.CLIENT)
public SubGuiAbilityConfig createConfigGui(
IAbilityConfigCallback callback) {
return new SubGuiAbilityTeleport(this, callback);
}
@Override
public boolean isTargetingModeLocked() {
return true;
@@ -534,4 +526,29 @@ public class AbilityTeleport extends Ability implements IAbilityTeleport {
public void setDamageRadius(float damageRadius) {
this.damageRadius = damageRadius;
}
@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.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.floatField("enchantment.damage", this::getDamage, this::setDamage),
FieldDef.floatField("ability.dmgRadius", this::getDamageRadius, this::setDamageRadius),
FieldDef.boolField("ability.dmgAtStart", this::isDamageAtStart, this::setDamageAtStart)
.hover("ability.hover.dmgAtStart"),
FieldDef.boolField("ability.dmgAtEnd", this::isDamageAtEnd, this::setDamageAtEnd)
.hover("ability.hover.dmgAtEnd"),
FieldDef.effectsSubGui("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,14 @@ 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 kamkeel.npcs.controllers.data.ability.gui.FieldDef;
import kamkeel.npcs.controllers.data.ability.gui.TabTarget;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Random;
@@ -78,12 +77,6 @@ public class AbilityTrap extends Ability implements IAbilityTrap {
return true;
}
@Override
@SideOnly(Side.CLIENT)
public SubGuiAbilityConfig createConfigGui(IAbilityConfigCallback callback) {
return new SubGuiAbilityTrap(this, callback);
}
@Override
public boolean isTargetingModeLocked() {
return true;
@@ -464,4 +457,21 @@ public class AbilityTrap extends Ability implements IAbilityTrap {
public boolean isArmed() {
return armed;
}
@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.floatField("ability.triggerRad", this::getTriggerRadius, this::setTriggerRadius),
FieldDef.floatField("enchantment.damage", this::getDamage, this::setDamage),
FieldDef.floatField("ability.dmgRadius", this::getDamageRadius, this::setDamageRadius),
FieldDef.intField("ability.armTime", this::getArmTime, this::setArmTime),
FieldDef.intField("ability.maxTriggers", this::getMaxTriggers, this::setMaxTriggers),
FieldDef.floatField("ability.knockback", this::getKnockback, this::setKnockback),
FieldDef.effectsSubGui("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,13 @@ 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 kamkeel.npcs.controllers.data.ability.gui.FieldDef;
import kamkeel.npcs.controllers.data.ability.gui.TabTarget;
import noppes.npcs.api.ability.type.IAbilityVortex;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
@@ -67,13 +65,6 @@ public class AbilityVortex extends Ability implements IAbilityVortex {
return true;
}
@Override
@SideOnly(Side.CLIENT)
public SubGuiAbilityConfig createConfigGui(
IAbilityConfigCallback callback) {
return new SubGuiAbilityVortex(this, callback);
}
@Override
public boolean isTargetingModeLocked() {
return true;
@@ -309,4 +300,21 @@ public class AbilityVortex extends Ability implements IAbilityVortex {
public void setPullDamage(float pullDamage) {
this.pullDamage = pullDamage;
}
@Override
public List<FieldDef> getFieldDefinitions() {
return Arrays.asList(
FieldDef.floatField("ability.pullRadius", this::getPullRadius, this::setPullRadius),
FieldDef.floatField("ability.pullStrength", this::getPullStrength, this::setPullStrength),
FieldDef.floatField("enchantment.damage", this::getDamage, this::setDamage),
FieldDef.floatField("ability.knockback", this::getKnockback, this::setKnockback),
FieldDef.boolField("ability.aoe", this::isAoe, this::setAoe)
.hover("ability.hover.aoe"),
FieldDef.intField("ability.maxTargets", this::getMaxTargets, this::setMaxTargets),
FieldDef.boolField("ability.dmgOnPull", this::isDamageOnPull, this::setDamageOnPull)
.hover("ability.hover.dmgOnPull"),
FieldDef.floatField("ability.pullDamage", this::getPullDamage, this::setPullDamage),
FieldDef.effectsSubGui("ability.effects", this::getEffects, this::setEffects)
);
}
}