mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-12 22:27:32 +00:00
Fix Ability Def Handler
This commit is contained in:
1 parent
b368871e4f
commit
fd85215592
24 files changed
+94
-112
No files matched your search
@@ -33,7 +33,6 @@ 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;
|
||||
@@ -345,24 +344,31 @@ public abstract class Ability implements IAbility {
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
* Add field definitions for this ability's GUI.
|
||||
* Override in subclasses to add type-specific fields. The list already contains
|
||||
* the base fields (General, Target, Effects tabs), so subclasses can also
|
||||
* modify, insert into, or remove base fields using {@link FieldDef#insertBefore},
|
||||
* {@link FieldDef#insertAfter}, or direct list manipulation.
|
||||
* <p>
|
||||
* Fields added here without an explicit {@code .tab()} will default to the "Type" tab.
|
||||
*
|
||||
* @param defs The mutable list of field definitions to add to or modify
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public List<FieldDef> getFieldDefinitions() {
|
||||
return Collections.emptyList();
|
||||
public void getAbilityDefinitions(List<FieldDef> defs) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns field definitions for all base Ability fields (General, Target, Effects tabs).
|
||||
* Builds and returns all field definitions for this ability's GUI.
|
||||
* Base fields (General, Target, Effects) are added first, then
|
||||
* {@link #getAbilityDefinitions(List)} is called so subclasses can add
|
||||
* type-specific fields and modify any existing fields.
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public List<FieldDef> getBaseFieldDefinitions() {
|
||||
public final List<FieldDef> getAllDefinitions() {
|
||||
List<FieldDef> defs = new ArrayList<>();
|
||||
|
||||
// General tab
|
||||
// ── General tab ──────────────────────────────────────────────
|
||||
defs.add(FieldDef.stringField("gui.name", this::getName, this::setName)
|
||||
.tab("General"));
|
||||
defs.add(FieldDef.row(
|
||||
@@ -370,7 +376,6 @@ public abstract class Ability implements IAbility {
|
||||
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()));
|
||||
@@ -403,7 +408,7 @@ public abstract class Ability implements IAbility {
|
||||
.range(0, 1000).visibleWhen(this::isInterruptible)
|
||||
).tab("General"));
|
||||
|
||||
// Target tab
|
||||
// ── 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)
|
||||
@@ -411,7 +416,6 @@ public abstract class Ability implements IAbility {
|
||||
if (!isTargetingModeLocked()) {
|
||||
TargetingMode[] allowed = getAllowedTargetingModes();
|
||||
if (allowed != null && allowed.length > 0) {
|
||||
// Build string enum from allowed targeting modes only
|
||||
String[] allowedKeys = new String[allowed.length];
|
||||
for (int i = 0; i < allowed.length; i++) {
|
||||
allowedKeys[i] = allowed[i].name();
|
||||
@@ -424,20 +428,18 @@ public abstract class Ability implements IAbility {
|
||||
})
|
||||
.tab("Target").hover("ability.hover.targeting"));
|
||||
} else {
|
||||
// No restrictions - show all modes
|
||||
defs.add(FieldDef.enumField("ability.targetingMode", TargetingMode.class,
|
||||
this::getTargetingMode, this::setTargetingMode)
|
||||
.tab("Target").hover("ability.hover.targeting"));
|
||||
}
|
||||
}
|
||||
|
||||
// Effects tab - Sounds
|
||||
// ── Effects tab ──────────────────────────────────────────────
|
||||
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,
|
||||
@@ -459,7 +461,6 @@ public abstract class Ability implements IAbility {
|
||||
);
|
||||
}
|
||||
|
||||
// Effects tab - Telegraph
|
||||
TelegraphType tType = getTelegraphType();
|
||||
if (tType != null && tType != TelegraphType.NONE) {
|
||||
defs.add(FieldDef.section("ability.section.telegraph").tab("Effects")
|
||||
@@ -472,36 +473,17 @@ public abstract class Ability implements IAbility {
|
||||
.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());
|
||||
modifyBaseFieldDefinitions(all);
|
||||
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");
|
||||
// ── Type-specific fields ─────────────────────────────────────
|
||||
int baseSize = defs.size();
|
||||
getAbilityDefinitions(defs);
|
||||
// Default tab for ability-added fields that don't specify one
|
||||
for (int i = baseSize; i < defs.size(); i++) {
|
||||
if (defs.get(i).getTab() == null) {
|
||||
defs.get(i).tab("Type");
|
||||
}
|
||||
}
|
||||
all.addAll(typeDefs);
|
||||
return all;
|
||||
}
|
||||
|
||||
/**
|
||||
* Override to modify the base field definitions before type-specific fields are added.
|
||||
* Use {@link FieldDef#insertBefore}, {@link FieldDef#insertAfter}, or direct list
|
||||
* manipulation to add, remove, or reorder base fields.
|
||||
*
|
||||
* @param baseFields The mutable list of base fields (General/Target/Effects tabs)
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
protected void modifyBaseFieldDefinitions(List<FieldDef> baseFields) {
|
||||
return defs;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -377,8 +377,8 @@ public class AbilityBeamDual extends Ability {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public List<FieldDef> getFieldDefinitions() {
|
||||
return Arrays.asList(
|
||||
public void getAbilityDefinitions(List<FieldDef> defs) {
|
||||
defs.addAll(Arrays.asList(
|
||||
// Type tab
|
||||
FieldDef.row(
|
||||
FieldDef.floatField("enchantment.damage", this::getDamage, this::setDamage),
|
||||
@@ -485,7 +485,7 @@ public class AbilityBeamDual extends Ability {
|
||||
() -> getLightningRadius(1), v -> setLightningRadius(1, v))
|
||||
.range(0.1f, 10.0f).visibleWhen(() -> hasLightningEffect(1))
|
||||
).tab("ability.tab.visual")
|
||||
);
|
||||
));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -397,8 +397,8 @@ public class AbilityCharge extends Ability implements IAbilityCharge {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public List<FieldDef> getFieldDefinitions() {
|
||||
return Arrays.asList(
|
||||
public void getAbilityDefinitions(List<FieldDef> defs) {
|
||||
defs.addAll(Arrays.asList(
|
||||
FieldDef.row(
|
||||
FieldDef.floatField("enchantment.damage", this::getDamage, this::setDamage),
|
||||
FieldDef.floatField("ability.chargeSpeed", this::getChargeSpeed, this::setChargeSpeed)
|
||||
@@ -408,6 +408,6 @@ public class AbilityCharge extends Ability implements IAbilityCharge {
|
||||
FieldDef.floatField("ability.hitWidth", this::getHitWidth, this::setHitWidth)
|
||||
),
|
||||
AbilityFieldDefs.effectsListField("ability.effects", this::getEffects, this::setEffects)
|
||||
);
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -338,8 +338,8 @@ public class AbilityCutter extends Ability implements IAbilityCutter {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public List<FieldDef> getFieldDefinitions() {
|
||||
return Arrays.asList(
|
||||
public void getAbilityDefinitions(List<FieldDef> defs) {
|
||||
defs.addAll(Arrays.asList(
|
||||
FieldDef.row(
|
||||
FieldDef.floatField("enchantment.damage", this::getDamage, this::setDamage),
|
||||
FieldDef.floatField("gui.range", this::getRange, this::setRange)
|
||||
@@ -359,6 +359,6 @@ public class AbilityCutter extends Ability implements IAbilityCutter {
|
||||
FieldDef.boolField("ability.piercing", this::isPiercing, this::setPiercing)
|
||||
.hover("ability.hover.piercing"),
|
||||
AbilityFieldDefs.effectsListField("ability.effects", this::getEffects, this::setEffects)
|
||||
);
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -370,14 +370,14 @@ public class AbilityDash extends Ability implements IAbilityDash {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public List<FieldDef> getFieldDefinitions() {
|
||||
return Arrays.asList(
|
||||
public void getAbilityDefinitions(List<FieldDef> defs) {
|
||||
defs.addAll(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)
|
||||
)
|
||||
);
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -273,8 +273,8 @@ public class AbilityDisc extends Ability implements IAbilityDisc {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public List<FieldDef> getFieldDefinitions() {
|
||||
return Arrays.asList(
|
||||
public void getAbilityDefinitions(List<FieldDef> defs) {
|
||||
defs.addAll(Arrays.asList(
|
||||
// Type tab
|
||||
FieldDef.row(
|
||||
FieldDef.floatField("enchantment.damage", this::getDamage, this::setDamage),
|
||||
@@ -333,6 +333,6 @@ public class AbilityDisc extends Ability implements IAbilityDisc {
|
||||
FieldDef.floatField("gui.radius", this::getLightningRadius, this::setLightningRadius)
|
||||
.range(0.1f, 10.0f).visibleWhen(this::hasLightningEffect)
|
||||
).tab("ability.tab.visual")
|
||||
);
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -386,8 +386,8 @@ public class AbilityDiscDual extends Ability {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public List<FieldDef> getFieldDefinitions() {
|
||||
return Arrays.asList(
|
||||
public void getAbilityDefinitions(List<FieldDef> defs) {
|
||||
defs.addAll(Arrays.asList(
|
||||
// Type tab
|
||||
FieldDef.row(
|
||||
FieldDef.floatField("enchantment.damage", this::getDamage, this::setDamage),
|
||||
@@ -495,7 +495,7 @@ public class AbilityDiscDual extends Ability {
|
||||
() -> getLightningRadius(1), v -> setLightningRadius(1, v))
|
||||
.range(0.1f, 10.0f).visibleWhen(() -> hasLightningEffect(1))
|
||||
).tab("ability.tab.visual")
|
||||
);
|
||||
));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -276,8 +276,8 @@ public class AbilityEnergyBeam extends Ability implements IAbilityEnergyBeam {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public List<FieldDef> getFieldDefinitions() {
|
||||
return Arrays.asList(
|
||||
public void getAbilityDefinitions(List<FieldDef> defs) {
|
||||
defs.addAll(Arrays.asList(
|
||||
// Type tab
|
||||
FieldDef.row(
|
||||
FieldDef.floatField("enchantment.damage", this::getDamage, this::setDamage),
|
||||
@@ -335,6 +335,6 @@ public class AbilityEnergyBeam extends Ability implements IAbilityEnergyBeam {
|
||||
FieldDef.floatField("gui.radius", this::getLightningRadius, this::setLightningRadius)
|
||||
.range(0.1f, 10.0f).visibleWhen(this::hasLightningEffect)
|
||||
).tab("ability.tab.visual")
|
||||
);
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -341,8 +341,8 @@ public class AbilityGuard extends Ability implements IAbilityGuard {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public List<FieldDef> getFieldDefinitions() {
|
||||
return Arrays.asList(
|
||||
public void getAbilityDefinitions(List<FieldDef> defs) {
|
||||
defs.addAll(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"),
|
||||
@@ -359,6 +359,6 @@ public class AbilityGuard extends Ability implements IAbilityGuard {
|
||||
.visibleWhen(this::canCounter),
|
||||
AbilityFieldDefs.effectsListField("ability.effects", this::getEffects, this::setEffects)
|
||||
|
||||
);
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -630,8 +630,8 @@ public class AbilityHazard extends Ability implements IAbilityHazard {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public List<FieldDef> getFieldDefinitions() {
|
||||
return Arrays.asList(
|
||||
public void getAbilityDefinitions(List<FieldDef> defs) {
|
||||
defs.addAll(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"),
|
||||
@@ -656,6 +656,6 @@ public class AbilityHazard extends Ability implements IAbilityHazard {
|
||||
FieldDef.boolField("ability.affectsCaster", this::isAffectsCaster, this::setAffectsCaster)
|
||||
.hover("ability.hover.affectsCaster"),
|
||||
AbilityFieldDefs.effectsListField("ability.effects", this::getEffects, this::setEffects)
|
||||
);
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -281,8 +281,8 @@ public class AbilityHeal extends Ability implements IAbilityHeal {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public List<FieldDef> getFieldDefinitions() {
|
||||
return Arrays.asList(
|
||||
public void getAbilityDefinitions(List<FieldDef> defs) {
|
||||
defs.addAll(Arrays.asList(
|
||||
FieldDef.boolField("ability.instantHeal", this::isInstantHeal, this::setInstantHeal)
|
||||
.hover("ability.hover.instant"),
|
||||
FieldDef.intField("ability.duration", this::getDurationTicks, this::setDurationTicks)
|
||||
@@ -299,6 +299,6 @@ public class AbilityHeal extends Ability implements IAbilityHeal {
|
||||
FieldDef.boolField("ability.healAllies", this::isHealAllies, this::setHealAllies)
|
||||
.hover("ability.hover.healAllies")
|
||||
)
|
||||
);
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -174,8 +174,8 @@ public class AbilityHeavyHit extends Ability implements IAbilityHeavyHit {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public List<FieldDef> getFieldDefinitions() {
|
||||
return Arrays.asList(
|
||||
public void getAbilityDefinitions(List<FieldDef> defs) {
|
||||
defs.addAll(Arrays.asList(
|
||||
FieldDef.row(
|
||||
FieldDef.floatField("enchantment.damage", this::getDamage, this::setDamage),
|
||||
FieldDef.floatField("ability.knockback", this::getKnockback, this::setKnockback)
|
||||
@@ -186,6 +186,6 @@ public class AbilityHeavyHit extends Ability implements IAbilityHeavyHit {
|
||||
FieldDef.floatField("ability.hitWidth", this::getHitWidth, this::setHitWidth)
|
||||
),
|
||||
AbilityFieldDefs.effectsListField("ability.effects", this::getEffects, this::setEffects)
|
||||
);
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -247,8 +247,8 @@ public class AbilityLaserShot extends Ability implements IAbilityLaserShot {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public List<FieldDef> getFieldDefinitions() {
|
||||
return Arrays.asList(
|
||||
public void getAbilityDefinitions(List<FieldDef> defs) {
|
||||
defs.addAll(Arrays.asList(
|
||||
// Type tab
|
||||
FieldDef.floatField("enchantment.damage", this::getDamage, this::setDamage),
|
||||
FieldDef.row(
|
||||
@@ -290,6 +290,6 @@ public class AbilityLaserShot extends Ability implements IAbilityLaserShot {
|
||||
FieldDef.floatField("gui.radius", this::getLightningRadius, this::setLightningRadius)
|
||||
.range(0.1f, 10.0f).visibleWhen(this::hasLightningEffect)
|
||||
).tab("ability.tab.visual")
|
||||
);
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -412,8 +412,8 @@ public class AbilityOrb extends Ability implements IAbilityOrb {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public List<FieldDef> getFieldDefinitions() {
|
||||
return Arrays.asList(
|
||||
public void getAbilityDefinitions(List<FieldDef> defs) {
|
||||
defs.addAll(Arrays.asList(
|
||||
// Type tab
|
||||
FieldDef.row(
|
||||
FieldDef.floatField("enchantment.damage", this::getDamage, this::setDamage),
|
||||
@@ -459,6 +459,6 @@ public class AbilityOrb extends Ability implements IAbilityOrb {
|
||||
FieldDef.floatField("gui.radius", this::getLightningRadius, this::setLightningRadius)
|
||||
.range(0.1f, 10.0f).visibleWhen(this::hasLightningEffect)
|
||||
).tab("ability.tab.visual")
|
||||
);
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -518,8 +518,8 @@ public class AbilityOrbBarrage extends Ability {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public List<FieldDef> getFieldDefinitions() {
|
||||
return Arrays.asList(
|
||||
public void getAbilityDefinitions(List<FieldDef> defs) {
|
||||
defs.addAll(Arrays.asList(
|
||||
// Type tab
|
||||
FieldDef.row(
|
||||
FieldDef.floatField("enchantment.damage", this::getDamage, this::setDamage),
|
||||
@@ -571,6 +571,6 @@ public class AbilityOrbBarrage extends Ability {
|
||||
FieldDef.floatField("gui.radius", this::getLightningRadius, this::setLightningRadius)
|
||||
.range(0.1f, 10.0f).visibleWhen(this::hasLightningEffect)
|
||||
).tab("ability.tab.visual")
|
||||
);
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -457,8 +457,8 @@ public class AbilityOrbDual extends Ability {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public List<FieldDef> getFieldDefinitions() {
|
||||
return Arrays.asList(
|
||||
public void getAbilityDefinitions(List<FieldDef> defs) {
|
||||
defs.addAll(Arrays.asList(
|
||||
// Type tab
|
||||
FieldDef.row(
|
||||
FieldDef.floatField("enchantment.damage", this::getDamage, this::setDamage),
|
||||
@@ -555,7 +555,7 @@ public class AbilityOrbDual extends Ability {
|
||||
() -> getLightningRadius(1), v -> setLightningRadius(1, v))
|
||||
.range(0.1f, 10.0f).visibleWhen(() -> hasLightningEffect(1))
|
||||
).tab("ability.tab.visual")
|
||||
);
|
||||
));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -251,8 +251,8 @@ public class AbilityProjectile extends Ability implements IAbilityProjectile {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public List<FieldDef> getFieldDefinitions() {
|
||||
return Arrays.asList(
|
||||
public void getAbilityDefinitions(List<FieldDef> defs) {
|
||||
defs.addAll(Arrays.asList(
|
||||
FieldDef.row(
|
||||
FieldDef.floatField("enchantment.damage", this::getDamage, this::setDamage),
|
||||
FieldDef.floatField("stats.speed", this::getSpeed, this::setSpeed)
|
||||
@@ -266,6 +266,6 @@ public class AbilityProjectile extends Ability implements IAbilityProjectile {
|
||||
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)
|
||||
);
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -166,8 +166,8 @@ public class AbilityShockwave extends Ability implements IAbilityShockwave {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public List<FieldDef> getFieldDefinitions() {
|
||||
return Arrays.asList(
|
||||
public void getAbilityDefinitions(List<FieldDef> defs) {
|
||||
defs.addAll(Arrays.asList(
|
||||
FieldDef.floatField("enchantment.damage", this::getDamage, this::setDamage),
|
||||
FieldDef.section("ability.section.push"),
|
||||
FieldDef.row(
|
||||
@@ -176,6 +176,6 @@ public class AbilityShockwave extends Ability implements IAbilityShockwave {
|
||||
),
|
||||
FieldDef.intField("ability.maxTargets", this::getMaxTargets, this::setMaxTargets),
|
||||
AbilityFieldDefs.effectsListField("ability.effects", this::getEffects, this::setEffects)
|
||||
);
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -597,8 +597,8 @@ public class AbilitySlam extends Ability implements IAbilitySlam {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public List<FieldDef> getFieldDefinitions() {
|
||||
return Arrays.asList(
|
||||
public void getAbilityDefinitions(List<FieldDef> defs) {
|
||||
defs.addAll(Arrays.asList(
|
||||
FieldDef.floatField("enchantment.damage", this::getDamage, this::setDamage),
|
||||
FieldDef.row(
|
||||
FieldDef.floatField("gui.radius", this::getRadius, this::setRadius),
|
||||
@@ -610,6 +610,6 @@ public class AbilitySlam extends Ability implements IAbilitySlam {
|
||||
FieldDef.floatField("gui.height", this::getLeapHeight, this::setLeapHeight)
|
||||
),
|
||||
AbilityFieldDefs.effectsListField("ability.effects", this::getEffects, this::setEffects)
|
||||
);
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -199,8 +199,8 @@ public class AbilitySweeper extends Ability implements IAbilitySweeper {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public List<FieldDef> getFieldDefinitions() {
|
||||
return Arrays.asList(
|
||||
public void getAbilityDefinitions(List<FieldDef> defs) {
|
||||
defs.addAll(Arrays.asList(
|
||||
|
||||
FieldDef.row(
|
||||
FieldDef.floatField("enchantment.damage", this::getDamage, this::setDamage),
|
||||
@@ -234,6 +234,6 @@ public class AbilitySweeper extends Ability implements IAbilitySweeper {
|
||||
.tab("ability.tab.visual").visibleWhen(this::isOuterColorEnabled),
|
||||
FieldDef.floatField("ability.outerWidth", this::getOuterColorWidth, this::setOuterColorWidth)
|
||||
.tab("ability.tab.visual").visibleWhen(this::isOuterColorEnabled)
|
||||
);
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -558,8 +558,8 @@ public class AbilityTeleport extends Ability implements IAbilityTeleport {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public List<FieldDef> getFieldDefinitions() {
|
||||
return Arrays.asList(
|
||||
public void getAbilityDefinitions(List<FieldDef> defs) {
|
||||
defs.addAll(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),
|
||||
@@ -586,6 +586,6 @@ public class AbilityTeleport extends Ability implements IAbilityTeleport {
|
||||
.hover("ability.hover.dmgAtEnd")
|
||||
),
|
||||
AbilityFieldDefs.effectsListField("ability.effects", this::getEffects, this::setEffects)
|
||||
);
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -468,8 +468,8 @@ public class AbilityTrap extends Ability implements IAbilityTrap {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public List<FieldDef> getFieldDefinitions() {
|
||||
return Arrays.asList(
|
||||
public void getAbilityDefinitions(List<FieldDef> defs) {
|
||||
defs.addAll(Arrays.asList(
|
||||
FieldDef.intField("ability.duration", this::getDurationTicks, this::setDurationTicks)
|
||||
.range(1, 2000),
|
||||
FieldDef.enumField("ability.placement", TrapPlacement.class, this::getPlacementEnum, this::setPlacementEnum)
|
||||
@@ -490,6 +490,6 @@ public class AbilityTrap extends Ability implements IAbilityTrap {
|
||||
),
|
||||
FieldDef.floatField("ability.knockback", this::getKnockback, this::setKnockback),
|
||||
AbilityFieldDefs.effectsListField("ability.effects", this::getEffects, this::setEffects)
|
||||
);
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -304,8 +304,8 @@ public class AbilityVortex extends Ability implements IAbilityVortex {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public List<FieldDef> getFieldDefinitions() {
|
||||
return Arrays.asList(
|
||||
public void getAbilityDefinitions(List<FieldDef> defs) {
|
||||
defs.addAll(Arrays.asList(
|
||||
FieldDef.row(
|
||||
FieldDef.floatField("ability.pullRadius", this::getPullRadius, this::setPullRadius),
|
||||
FieldDef.floatField("ability.pullStrength", this::getPullStrength, this::setPullStrength)
|
||||
@@ -326,6 +326,6 @@ public class AbilityVortex extends Ability implements IAbilityVortex {
|
||||
FieldDef.floatField("enchantment.damage", this::getPullDamage, this::setPullDamage)
|
||||
.visibleWhen(this::isDamageOnPull),
|
||||
AbilityFieldDefs.effectsListField("ability.effects", this::getEffects, this::setEffects)
|
||||
);
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -62,7 +62,7 @@ public class SubGuiAbilityConfig extends SubGuiInterface implements ITextfieldLi
|
||||
this.callback = callback;
|
||||
this.conditions = new ArrayList<>(ability.getConditions());
|
||||
|
||||
this.fieldDefs = ability.getAllFieldDefinitions();
|
||||
this.fieldDefs = ability.getAllDefinitions();
|
||||
discoverCustomTabs();
|
||||
|
||||
setBackground("menubg.png", 217);
|
||||
@@ -376,7 +376,7 @@ public class SubGuiAbilityConfig extends SubGuiInterface implements ITextfieldLi
|
||||
ability.readNBT(nbt);
|
||||
|
||||
this.conditions = new ArrayList<>(ability.getConditions());
|
||||
this.fieldDefs = ability.getAllFieldDefinitions();
|
||||
this.fieldDefs = ability.getAllDefinitions();
|
||||
discoverCustomTabs();
|
||||
initGui();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user