mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-19 07:19:05 +00:00
Reformat Code
This commit is contained in:
1 parent
21e920426e
commit
1de1c4e710
169 files changed
+3967
-1556
No files matched your search
@@ -1,7 +1,7 @@
|
||||
package noppes.npcs;
|
||||
|
||||
import kamkeel.npcs.controllers.data.ability.Ability;
|
||||
import kamkeel.npcs.controllers.AbilityController;
|
||||
import kamkeel.npcs.controllers.data.ability.Ability;
|
||||
import kamkeel.npcs.controllers.data.ability.AbilityPhase;
|
||||
import kamkeel.npcs.controllers.data.ability.ChainedAbility;
|
||||
import kamkeel.npcs.controllers.data.ability.ChainedAbilityEntry;
|
||||
@@ -12,7 +12,12 @@ import net.minecraft.util.DamageSource;
|
||||
import noppes.npcs.controllers.AnimationController;
|
||||
import noppes.npcs.controllers.data.Animation;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Shared base class for NPC and Player ability data management.
|
||||
@@ -31,81 +36,119 @@ public abstract class AbstractDataAbilities {
|
||||
// SHARED RUNTIME STATE (not saved to NBT)
|
||||
// ═══════════════════════════════════════════════════════════════════
|
||||
|
||||
/** Currently executing ability (null if none) */
|
||||
/**
|
||||
* Currently executing ability (null if none)
|
||||
*/
|
||||
protected Ability currentAbility;
|
||||
|
||||
/** World time when cooldown ends */
|
||||
/**
|
||||
* World time when cooldown ends
|
||||
*/
|
||||
protected long cooldownEndTime = 0;
|
||||
|
||||
/** Rotation lock state */
|
||||
/**
|
||||
* Rotation lock state
|
||||
*/
|
||||
protected boolean rotationLocked = false;
|
||||
protected float lockedYaw = 0;
|
||||
protected float lockedPitch = 0;
|
||||
|
||||
/** Position lock state */
|
||||
/**
|
||||
* Position lock state
|
||||
*/
|
||||
protected boolean positionLocked = false;
|
||||
protected double lockedPosX = 0;
|
||||
protected double lockedPosY = 0;
|
||||
protected double lockedPosZ = 0;
|
||||
|
||||
/** Chained ability execution state */
|
||||
/**
|
||||
* Chained ability execution state
|
||||
*/
|
||||
protected ChainedAbility currentChain;
|
||||
protected int chainEntryIndex = -1;
|
||||
protected int chainDelayRemaining = -1;
|
||||
|
||||
/** Set when interrupt already rolled cooldown (prevents double cooldown on NPC dazed completion). */
|
||||
/**
|
||||
* Set when interrupt already rolled cooldown (prevents double cooldown on NPC dazed completion).
|
||||
*/
|
||||
protected boolean interruptCooldownRolled = false;
|
||||
|
||||
// ═══════════════════════════════════════════════════════════════════
|
||||
// ABSTRACT METHODS - Subclasses must implement
|
||||
// ═══════════════════════════════════════════════════════════════════
|
||||
|
||||
/** Get the entity this ability data belongs to (NPC or Player). */
|
||||
/**
|
||||
* Get the entity this ability data belongs to (NPC or Player).
|
||||
*/
|
||||
protected abstract EntityLivingBase getEntity();
|
||||
|
||||
/** Get the current target for ability execution. */
|
||||
/**
|
||||
* Get the current target for ability execution.
|
||||
*/
|
||||
protected abstract EntityLivingBase getTarget();
|
||||
|
||||
/** Get the current world time. */
|
||||
/**
|
||||
* Get the current world time.
|
||||
*/
|
||||
protected abstract long getWorldTime();
|
||||
|
||||
// -- Event Firing --
|
||||
|
||||
/** Fire tick event. Implementation differs between NPC (NpcAPI) and Player (ScriptController). */
|
||||
/**
|
||||
* Fire tick event. Implementation differs between NPC (NpcAPI) and Player (ScriptController).
|
||||
*/
|
||||
protected abstract void fireTickEvent(Ability ability, EntityLivingBase target);
|
||||
|
||||
/** Fire execute event. Returns true if cancelled. */
|
||||
/**
|
||||
* Fire execute event. Returns true if cancelled.
|
||||
*/
|
||||
protected abstract boolean fireExecuteEvent(Ability ability, EntityLivingBase target);
|
||||
|
||||
/** Fire complete event. */
|
||||
/**
|
||||
* Fire complete event.
|
||||
*/
|
||||
protected abstract void fireCompleteEvent(Ability ability, EntityLivingBase target);
|
||||
|
||||
/** Fire interrupt event. */
|
||||
/**
|
||||
* Fire interrupt event.
|
||||
*/
|
||||
protected abstract void fireInterruptEvent(Ability ability, EntityLivingBase target,
|
||||
DamageSource source, float damage);
|
||||
|
||||
// -- Telegraph --
|
||||
|
||||
/** Spawn telegraphs for an ability. */
|
||||
/**
|
||||
* Spawn telegraphs for an ability.
|
||||
*/
|
||||
protected abstract void spawnTelegraph(Ability ability, EntityLivingBase target);
|
||||
|
||||
/** Remove telegraphs for an ability. */
|
||||
/**
|
||||
* Remove telegraphs for an ability.
|
||||
*/
|
||||
protected abstract void removeTelegraph(Ability ability);
|
||||
|
||||
// -- Animation/Sound Data Access --
|
||||
|
||||
/** Set animation data on the entity. */
|
||||
/**
|
||||
* Set animation data on the entity.
|
||||
*/
|
||||
protected abstract void setAnimationData(Animation animation);
|
||||
|
||||
/** Clear animation data on the entity. */
|
||||
/**
|
||||
* Clear animation data on the entity.
|
||||
*/
|
||||
protected abstract void clearAnimationData();
|
||||
|
||||
/** Play a sound at the entity's location. */
|
||||
/**
|
||||
* Play a sound at the entity's location.
|
||||
*/
|
||||
protected abstract void playAbilitySound(String sound);
|
||||
|
||||
// -- Rotation (subclass handles extra fields and application) --
|
||||
|
||||
/** Capture rotation values for locking. NPC captures 4 fields, Player captures 2. */
|
||||
/**
|
||||
* Capture rotation values for locking. NPC captures 4 fields, Player captures 2.
|
||||
*/
|
||||
protected abstract void captureLockedRotation();
|
||||
|
||||
// -- Completion --
|
||||
@@ -116,7 +159,9 @@ public abstract class AbstractDataAbilities {
|
||||
*/
|
||||
protected abstract void rollCooldown(Ability ability);
|
||||
|
||||
/** Additional completion logic (NPC clears lastTarget, Player clears key/target and syncs). */
|
||||
/**
|
||||
* Additional completion logic (NPC clears lastTarget, Player clears key/target and syncs).
|
||||
*/
|
||||
protected abstract void onAbilityComplete();
|
||||
|
||||
/**
|
||||
@@ -128,17 +173,30 @@ public abstract class AbstractDataAbilities {
|
||||
|
||||
// -- Hooks (optional overrides) --
|
||||
|
||||
/** Called before onExecute in ACTIVE phase. NPC uses this for faceTarget/hitScan. */
|
||||
protected void onPreExecute(Ability ability, EntityLivingBase target) {}
|
||||
/**
|
||||
* Called before onExecute in ACTIVE phase. NPC uses this for faceTarget/hitScan.
|
||||
*/
|
||||
protected void onPreExecute(Ability ability, EntityLivingBase target) {
|
||||
}
|
||||
|
||||
/** Called after the phase switch. NPC uses this for hit scan updates and movement control. */
|
||||
protected void onPostPhaseTick(Ability ability, EntityLivingBase target) {}
|
||||
/**
|
||||
* Called after the phase switch. NPC uses this for hit scan updates and movement control.
|
||||
*/
|
||||
protected void onPostPhaseTick(Ability ability, EntityLivingBase target) {
|
||||
}
|
||||
|
||||
/** Additional lock releases in BURST_DELAY. NPC releases hitScan. */
|
||||
protected void onBurstDelayReleaseLocks() {}
|
||||
/**
|
||||
* Additional lock releases in BURST_DELAY. NPC releases hitScan.
|
||||
*/
|
||||
protected void onBurstDelayReleaseLocks() {
|
||||
}
|
||||
|
||||
/** Hook for retargeting during chain execution when target dies. NPC overrides, Player returns null. */
|
||||
protected EntityLivingBase retargetForChain() { return null; }
|
||||
/**
|
||||
* Hook for retargeting during chain execution when target dies. NPC overrides, Player returns null.
|
||||
*/
|
||||
protected EntityLivingBase retargetForChain() {
|
||||
return null;
|
||||
}
|
||||
|
||||
// ═══════════════════════════════════════════════════════════════════
|
||||
// SHARED ANIMATION METHODS
|
||||
@@ -178,22 +236,30 @@ public abstract class AbstractDataAbilities {
|
||||
// STATE QUERIES
|
||||
// ═══════════════════════════════════════════════════════════════════
|
||||
|
||||
/** Check if an ability is currently executing. */
|
||||
/**
|
||||
* Check if an ability is currently executing.
|
||||
*/
|
||||
public boolean isExecutingAbility() {
|
||||
return currentAbility != null && currentAbility.isExecuting();
|
||||
}
|
||||
|
||||
/** Get the currently executing ability. */
|
||||
/**
|
||||
* Get the currently executing ability.
|
||||
*/
|
||||
public Ability getCurrentAbility() {
|
||||
return currentAbility;
|
||||
}
|
||||
|
||||
/** Check if a chained ability is currently executing. */
|
||||
/**
|
||||
* Check if a chained ability is currently executing.
|
||||
*/
|
||||
public boolean isExecutingChain() {
|
||||
return currentChain != null;
|
||||
}
|
||||
|
||||
/** Get the currently executing chained ability. */
|
||||
/**
|
||||
* Get the currently executing chained ability.
|
||||
*/
|
||||
public ChainedAbility getCurrentChain() {
|
||||
return currentChain;
|
||||
}
|
||||
@@ -202,11 +268,14 @@ public abstract class AbstractDataAbilities {
|
||||
// TOGGLE STATE (active toggles, independent of currentAbility)
|
||||
// ═══════════════════════════════════════════════════════════════════
|
||||
|
||||
/** Currently active toggles. Key = ability key, Value = toggle entry with tick counter. */
|
||||
/**
|
||||
* Currently active toggles. Key = ability key, Value = toggle entry with tick counter.
|
||||
*/
|
||||
protected Map<String, ToggleEntry> activeToggles = new LinkedHashMap<>();
|
||||
|
||||
/**
|
||||
* Toggle an ability ON or OFF. If currently on, turns off; if off, turns on.
|
||||
*
|
||||
* @param key The ability key (e.g., "npcdbc:ki_fist")
|
||||
* @return true if the toggle is now ON, false if OFF
|
||||
*/
|
||||
@@ -221,8 +290,9 @@ public abstract class AbstractDataAbilities {
|
||||
|
||||
/**
|
||||
* Set a toggle to a specific state.
|
||||
*
|
||||
* @param key The ability key
|
||||
* @param on true to activate, false to deactivate
|
||||
* @param on true to activate, false to deactivate
|
||||
*/
|
||||
public void setAbilityToggled(String key, boolean on) {
|
||||
if (on && !activeToggles.containsKey(key)) {
|
||||
@@ -300,8 +370,11 @@ public abstract class AbstractDataAbilities {
|
||||
}
|
||||
}
|
||||
|
||||
/** Hook for subclass to react to toggle state changes (sync packets, script events). */
|
||||
protected void onToggleStateChanged(String key, boolean active) {}
|
||||
/**
|
||||
* Hook for subclass to react to toggle state changes (sync packets, script events).
|
||||
*/
|
||||
protected void onToggleStateChanged(String key, boolean active) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear all active toggles (e.g., on death/reset).
|
||||
@@ -336,23 +409,31 @@ public abstract class AbstractDataAbilities {
|
||||
// COOLDOWN MANAGEMENT
|
||||
// ═══════════════════════════════════════════════════════════════════
|
||||
|
||||
/** Check if on cooldown. */
|
||||
/**
|
||||
* Check if on cooldown.
|
||||
*/
|
||||
public boolean isOnCooldown() {
|
||||
return getWorldTime() < cooldownEndTime;
|
||||
}
|
||||
|
||||
/** Get remaining cooldown ticks. */
|
||||
/**
|
||||
* Get remaining cooldown ticks.
|
||||
*/
|
||||
public long getRemainingCooldown() {
|
||||
long remaining = cooldownEndTime - getWorldTime();
|
||||
return remaining > 0 ? remaining : 0;
|
||||
}
|
||||
|
||||
/** Reset cooldown (allow immediate ability use). */
|
||||
/**
|
||||
* Reset cooldown (allow immediate ability use).
|
||||
*/
|
||||
public void resetCooldown() {
|
||||
cooldownEndTime = 0;
|
||||
}
|
||||
|
||||
/** Set the cooldown end time directly. */
|
||||
/**
|
||||
* Set the cooldown end time directly.
|
||||
*/
|
||||
public void setCooldownEndTime(long endTime) {
|
||||
cooldownEndTime = endTime;
|
||||
}
|
||||
@@ -381,8 +462,11 @@ public abstract class AbstractDataAbilities {
|
||||
onPositionLockChanged(false);
|
||||
}
|
||||
|
||||
/** Hook for subclass to react to position lock state changes (e.g., NPC sets data watcher flag). */
|
||||
protected void onPositionLockChanged(boolean locked) {}
|
||||
/**
|
||||
* Hook for subclass to react to position lock state changes (e.g., NPC sets data watcher flag).
|
||||
*/
|
||||
protected void onPositionLockChanged(boolean locked) {
|
||||
}
|
||||
|
||||
// ═══════════════════════════════════════════════════════════════════
|
||||
// ROTATION LOCKING
|
||||
@@ -396,8 +480,11 @@ public abstract class AbstractDataAbilities {
|
||||
onRotationLockChanged(false);
|
||||
}
|
||||
|
||||
/** Hook for subclass to react to rotation lock state changes (e.g., NPC sets flag, clears hitScan). */
|
||||
protected void onRotationLockChanged(boolean locked) {}
|
||||
/**
|
||||
* Hook for subclass to react to rotation lock state changes (e.g., NPC sets flag, clears hitScan).
|
||||
*/
|
||||
protected void onRotationLockChanged(boolean locked) {
|
||||
}
|
||||
|
||||
// ═══════════════════════════════════════════════════════════════════
|
||||
// CORE TICK - Phase transition logic shared between NPC and Player
|
||||
@@ -441,7 +528,7 @@ public abstract class AbstractDataAbilities {
|
||||
|
||||
// Fire extender tick hook (e.g., per-tick resource drain)
|
||||
if (!AbilityController.Instance.fireOnAbilityTick(currentAbility, entity, target,
|
||||
currentAbility.getPhase(), currentAbility.getCurrentTick())) {
|
||||
currentAbility.getPhase(), currentAbility.getCurrentTick())) {
|
||||
interruptCurrentAbility(null, 0);
|
||||
return;
|
||||
}
|
||||
@@ -711,7 +798,8 @@ public abstract class AbstractDataAbilities {
|
||||
* Hook called after interrupt completes. Subclass handles clearing state and syncing.
|
||||
* NPC: keeps currentAbility (ticks through DAZED). Player: clears immediately.
|
||||
*/
|
||||
protected void onInterruptComplete() {}
|
||||
protected void onInterruptComplete() {
|
||||
}
|
||||
|
||||
// ═══════════════════════════════════════════════════════════════════
|
||||
// CHAINED ABILITY EXECUTION
|
||||
|
||||
@@ -13,13 +13,13 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.FakePlayer;
|
||||
import noppes.npcs.api.IWorld;
|
||||
import noppes.npcs.blocks.tiles.TileNpcContainer;
|
||||
import noppes.npcs.config.ConfigScript;
|
||||
import noppes.npcs.constants.EnumGuiType;
|
||||
import noppes.npcs.containers.ContainerAuction;
|
||||
import noppes.npcs.containers.ContainerAnvilRepair;
|
||||
import noppes.npcs.containers.ContainerAuctionBidding;
|
||||
import noppes.npcs.containers.ContainerAuctionTrades;
|
||||
import noppes.npcs.containers.ContainerAuctionListing;
|
||||
import noppes.npcs.containers.ContainerAuctionSell;
|
||||
import noppes.npcs.containers.ContainerAnvilRepair;
|
||||
import noppes.npcs.containers.ContainerAuctionTrades;
|
||||
import noppes.npcs.containers.ContainerCarpentryBench;
|
||||
import noppes.npcs.containers.ContainerCrate;
|
||||
import noppes.npcs.containers.ContainerCustomGui;
|
||||
@@ -43,7 +43,6 @@ import noppes.npcs.containers.ContainerNpcQuestReward;
|
||||
import noppes.npcs.containers.ContainerNpcQuestTypeItem;
|
||||
import noppes.npcs.controllers.data.AnimationData;
|
||||
import noppes.npcs.controllers.data.PlayerData;
|
||||
import noppes.npcs.config.ConfigScript;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
public class CommonProxy implements IGuiHandler {
|
||||
|
||||
@@ -21,13 +21,22 @@ import io.github.somehussar.janinoloader.api.IDynamicCompilerBuilder;
|
||||
import kamkeel.npcs.addon.AddonManager;
|
||||
import kamkeel.npcs.command.CommandKamkeel;
|
||||
import kamkeel.npcs.command.profile.CommandProfile;
|
||||
import kamkeel.npcs.controllers.AbilityController;
|
||||
import kamkeel.npcs.controllers.AttributeController;
|
||||
import kamkeel.npcs.controllers.ProfileController;
|
||||
import kamkeel.npcs.controllers.SyncController;
|
||||
import kamkeel.npcs.controllers.TelegraphController;
|
||||
import kamkeel.npcs.controllers.AbilityController;
|
||||
import kamkeel.npcs.controllers.data.profile.CNPCData;
|
||||
import kamkeel.npcs.developer.Developer;
|
||||
import kamkeel.npcs.entity.EntityAbilityBeam;
|
||||
import kamkeel.npcs.entity.EntityAbilityDisc;
|
||||
import kamkeel.npcs.entity.EntityAbilityLaser;
|
||||
import kamkeel.npcs.entity.EntityAbilityOrb;
|
||||
import kamkeel.npcs.entity.EntityAbilitySweeper;
|
||||
import kamkeel.npcs.entity.EntityAbilityZone;
|
||||
import kamkeel.npcs.entity.EntityEnergyDome;
|
||||
import kamkeel.npcs.entity.EntityEnergyPanel;
|
||||
import kamkeel.npcs.entity.EntityEnergySlicer;
|
||||
import kamkeel.npcs.network.PacketHandler;
|
||||
import kamkeel.npcs.util.BukkitUtil;
|
||||
import net.minecraft.block.Block;
|
||||
@@ -86,15 +95,6 @@ import noppes.npcs.entity.EntityNpcDragon;
|
||||
import noppes.npcs.entity.EntityNpcPony;
|
||||
import noppes.npcs.entity.EntityNpcSlime;
|
||||
import noppes.npcs.entity.EntityProjectile;
|
||||
import kamkeel.npcs.entity.EntityAbilityOrb;
|
||||
import kamkeel.npcs.entity.EntityAbilityDisc;
|
||||
import kamkeel.npcs.entity.EntityAbilityLaser;
|
||||
import kamkeel.npcs.entity.EntityAbilityBeam;
|
||||
import kamkeel.npcs.entity.EntityAbilitySweeper;
|
||||
import kamkeel.npcs.entity.EntityAbilityZone;
|
||||
import kamkeel.npcs.entity.EntityEnergyDome;
|
||||
import kamkeel.npcs.entity.EntityEnergyPanel;
|
||||
import kamkeel.npcs.entity.EntityEnergySlicer;
|
||||
import noppes.npcs.entity.old.EntityNPCDwarfFemale;
|
||||
import noppes.npcs.entity.old.EntityNPCDwarfMale;
|
||||
import noppes.npcs.entity.old.EntityNPCElfFemale;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package noppes.npcs;
|
||||
|
||||
import kamkeel.npcs.controllers.data.ability.Ability;
|
||||
import kamkeel.npcs.controllers.AbilityController;
|
||||
import kamkeel.npcs.controllers.data.ability.AbilityPhase;
|
||||
import kamkeel.npcs.controllers.data.ability.Ability;
|
||||
import kamkeel.npcs.controllers.data.ability.AbilityAction;
|
||||
import kamkeel.npcs.controllers.data.ability.AbilityPhase;
|
||||
import kamkeel.npcs.controllers.data.ability.ChainedAbility;
|
||||
import kamkeel.npcs.controllers.data.ability.IAbilityAction;
|
||||
import kamkeel.npcs.controllers.data.ability.type.AbilityGuard;
|
||||
@@ -86,10 +86,14 @@ public class DataAbilities extends AbstractDataAbilities {
|
||||
private transient boolean hitScanActive = false;
|
||||
private transient EntityLivingBase hitScanTarget = null;
|
||||
|
||||
/** Bit flag for rotation control (LOCKED or TRACK) in data watcher slot 15 */
|
||||
/**
|
||||
* Bit flag for rotation control (LOCKED or TRACK) in data watcher slot 15
|
||||
*/
|
||||
private static final int ROTATION_CONTROLLED_FLAG = 16;
|
||||
|
||||
/** Bit flag for position lock in data watcher slot 15 */
|
||||
/**
|
||||
* Bit flag for position lock in data watcher slot 15
|
||||
*/
|
||||
private static final int POSITION_LOCKED_FLAG = 32;
|
||||
|
||||
// ═══════════════════════════════════════════════════════════════════
|
||||
@@ -143,7 +147,7 @@ public class DataAbilities extends AbstractDataAbilities {
|
||||
|
||||
@Override
|
||||
protected void fireInterruptEvent(Ability ability, EntityLivingBase target,
|
||||
DamageSource source, float damage) {
|
||||
DamageSource source, float damage) {
|
||||
AbilityEvent.InterruptEvent interruptEvent = new AbilityEvent.InterruptEvent(
|
||||
npc.wrappedNPC, ability, target, source, damage);
|
||||
NpcAPI.EVENT_BUS.post(interruptEvent);
|
||||
@@ -247,7 +251,7 @@ public class DataAbilities extends AbstractDataAbilities {
|
||||
// Update hit scan state - actual facing is deferred to applyRotationControl()
|
||||
// which runs AFTER super.onLivingUpdate() to override AI look helper
|
||||
if (ability != null && ability.isExecuting()
|
||||
&& ability.isHitScanForCurrentPhase() && target != null) {
|
||||
&& ability.isHitScanForCurrentPhase() && target != null) {
|
||||
enableHitScan(target);
|
||||
} else if (hitScanActive) {
|
||||
releaseRotationControl();
|
||||
@@ -613,7 +617,7 @@ public class DataAbilities extends AbstractDataAbilities {
|
||||
* If an ability is currently executing, it will be cancelled.
|
||||
*
|
||||
* @param ability The ability to start
|
||||
* @param target The target entity (can be null for self-targeted abilities)
|
||||
* @param target The target entity (can be null for self-targeted abilities)
|
||||
* @return true if the ability was started successfully
|
||||
*/
|
||||
public boolean forceStartAbility(Ability ability, EntityLivingBase target) {
|
||||
@@ -640,7 +644,7 @@ public class DataAbilities extends AbstractDataAbilities {
|
||||
* Execute an ability on this NPC by key (built-in name or custom UUID).
|
||||
* The NPC does NOT need to have this ability assigned.
|
||||
*
|
||||
* @param key The ability key (built-in name or custom UUID)
|
||||
* @param key The ability key (built-in name or custom UUID)
|
||||
* @param target The target entity (can be null for self-targeted abilities)
|
||||
* @return true if the ability was started successfully
|
||||
*/
|
||||
@@ -729,7 +733,9 @@ public class DataAbilities extends AbstractDataAbilities {
|
||||
// ACTION SLOT MANAGEMENT
|
||||
// ═══════════════════════════════════════════════════════════════════
|
||||
|
||||
/** Get the unified action slot list. */
|
||||
/**
|
||||
* Get the unified action slot list.
|
||||
*/
|
||||
public List<AbilityAction> getAbilityActions() {
|
||||
return actionSlots;
|
||||
}
|
||||
@@ -748,17 +754,23 @@ public class DataAbilities extends AbstractDataAbilities {
|
||||
return resolved;
|
||||
}
|
||||
|
||||
/** Add an inline ability. */
|
||||
/**
|
||||
* Add an inline ability.
|
||||
*/
|
||||
public void addAbility(Ability ability) {
|
||||
actionSlots.add(AbilityAction.inline(ability));
|
||||
}
|
||||
|
||||
/** Add a reference ability by key (built-in name or custom ability name). */
|
||||
/**
|
||||
* Add a reference ability by key (built-in name or custom ability name).
|
||||
*/
|
||||
public void addAbilityReference(String key) {
|
||||
actionSlots.add(AbilityAction.abilityReference(key));
|
||||
}
|
||||
|
||||
/** Add a chained ability reference by name. */
|
||||
/**
|
||||
* Add a chained ability reference by name.
|
||||
*/
|
||||
public void addChainReference(String name) {
|
||||
if (name != null && !name.isEmpty()) {
|
||||
for (AbilityAction slot : actionSlots) {
|
||||
@@ -770,7 +782,9 @@ public class DataAbilities extends AbstractDataAbilities {
|
||||
}
|
||||
}
|
||||
|
||||
/** Remove an action slot by index. */
|
||||
/**
|
||||
* Remove an action slot by index.
|
||||
*/
|
||||
public void removeAction(int index) {
|
||||
if (index >= 0 && index < actionSlots.size()) {
|
||||
actionSlots.remove(index);
|
||||
@@ -804,13 +818,17 @@ public class DataAbilities extends AbstractDataAbilities {
|
||||
return null;
|
||||
}
|
||||
|
||||
/** Check if a slot at a given index is a reference. */
|
||||
/**
|
||||
* Check if a slot at a given index is a reference.
|
||||
*/
|
||||
public boolean isSlotReference(int index) {
|
||||
if (index < 0 || index >= actionSlots.size()) return false;
|
||||
return actionSlots.get(index).isReference();
|
||||
}
|
||||
|
||||
/** Convert a reference slot to inline. Returns false if resolution fails or is a chain. */
|
||||
/**
|
||||
* Convert a reference slot to inline. Returns false if resolution fails or is a chain.
|
||||
*/
|
||||
public boolean convertToInline(int index) {
|
||||
if (index < 0 || index >= actionSlots.size()) return false;
|
||||
return actionSlots.get(index).convertToInline();
|
||||
@@ -934,7 +952,7 @@ public class DataAbilities extends AbstractDataAbilities {
|
||||
/**
|
||||
* Apply rotation control after super.onLivingUpdate() and super.onUpdate().
|
||||
* Handles both LOCKED (freeze at captured values) and TRACK (face target) modes.
|
||||
*
|
||||
* <p>
|
||||
* Server: computes the correct rotation (locked values or target facing).
|
||||
* Client: trusts the server-synced rotation values and prevents body smoothing override.
|
||||
*/
|
||||
|
||||
@@ -20,9 +20,9 @@ import net.minecraftforge.event.world.WorldEvent;
|
||||
import noppes.npcs.api.IBlock;
|
||||
import noppes.npcs.api.IPos;
|
||||
import noppes.npcs.api.IWorld;
|
||||
import noppes.npcs.api.entity.IEnergyProjectile;
|
||||
import noppes.npcs.api.entity.IAnimatable;
|
||||
import noppes.npcs.api.entity.ICustomNpc;
|
||||
import noppes.npcs.api.entity.IEnergyProjectile;
|
||||
import noppes.npcs.api.entity.IEntity;
|
||||
import noppes.npcs.api.entity.IPlayer;
|
||||
import noppes.npcs.api.entity.IProjectile;
|
||||
@@ -64,10 +64,10 @@ import noppes.npcs.scripted.event.NpcEvent;
|
||||
import noppes.npcs.scripted.event.PartyEvent;
|
||||
import noppes.npcs.scripted.event.ProjectileEvent;
|
||||
import noppes.npcs.scripted.event.RecipeScriptEvent;
|
||||
import noppes.npcs.scripted.event.player.AuctionEvent;
|
||||
import noppes.npcs.scripted.event.player.CustomGuiEvent;
|
||||
import noppes.npcs.scripted.event.player.DialogEvent;
|
||||
import noppes.npcs.scripted.event.player.FactionEvent;
|
||||
import noppes.npcs.scripted.event.player.AuctionEvent;
|
||||
import noppes.npcs.scripted.event.player.PlayerAbilityEvent;
|
||||
import noppes.npcs.scripted.event.player.PlayerEvent;
|
||||
import noppes.npcs.scripted.event.player.PlayerEvent.ChatEvent;
|
||||
@@ -561,7 +561,7 @@ public class EventHooks {
|
||||
// ==================== ENERGY BARRIER EVENTS ====================
|
||||
|
||||
private static void dispatchBarrierEvent(net.minecraft.entity.Entity barrierEntity, int ownerEntityId,
|
||||
noppes.npcs.scripted.event.EnergyBarrierEvent event, EnumScriptType type) {
|
||||
noppes.npcs.scripted.event.EnergyBarrierEvent event, EnumScriptType type) {
|
||||
ScriptController.Instance.globalNpcScripts.callScript(type, event);
|
||||
|
||||
net.minecraft.entity.Entity owner = barrierEntity.worldObj.getEntityByID(ownerEntityId);
|
||||
|
||||
@@ -6,10 +6,10 @@ import cpw.mods.fml.common.gameevent.PlayerEvent;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import kamkeel.npcs.addon.DBCAddon;
|
||||
import kamkeel.npcs.controllers.AbilityController;
|
||||
import kamkeel.npcs.controllers.AttributeController;
|
||||
import kamkeel.npcs.controllers.SyncController;
|
||||
import kamkeel.npcs.controllers.data.ability.Ability;
|
||||
import kamkeel.npcs.controllers.AbilityController;
|
||||
import kamkeel.npcs.util.AttributeAttackUtil;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
@@ -6,9 +6,9 @@ import cpw.mods.fml.common.gameevent.TickEvent;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent.Phase;
|
||||
import kamkeel.npcs.controllers.ProfileController;
|
||||
import kamkeel.npcs.controllers.SyncController;
|
||||
import noppes.npcs.controllers.AuctionController;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.world.WorldServer;
|
||||
import noppes.npcs.controllers.AuctionController;
|
||||
import noppes.npcs.controllers.ScriptController;
|
||||
import noppes.npcs.controllers.data.PlayerData;
|
||||
import noppes.npcs.controllers.data.action.ActionManager;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package noppes.npcs.ai;
|
||||
|
||||
import kamkeel.npcs.addon.DBCAddon;
|
||||
import kamkeel.npcs.controllers.data.ability.type.AbilityGuard;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
@@ -12,10 +12,8 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import noppes.npcs.CustomItems;
|
||||
import noppes.npcs.CustomNpcs;
|
||||
import noppes.npcs.CustomNpcsPermissions;
|
||||
import noppes.npcs.blocks.tiles.TileWaypoint;
|
||||
import noppes.npcs.constants.EnumGuiType;
|
||||
|
||||
public class BlockWaypoint extends BlockContainer {
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
/**
|
||||
* Client-side cache for auction configuration synced from server.
|
||||
* Prevents client from using local ConfigMarket which may differ from server settings.
|
||||
*
|
||||
* <p>
|
||||
* IMPORTANT: This class is CLIENT-ONLY. Server-side NBT writing is done in
|
||||
* AuctionConfigSync to avoid @SideOnly crashes on dedicated servers.
|
||||
*/
|
||||
@@ -56,11 +56,31 @@ public class AuctionClientConfig {
|
||||
}
|
||||
|
||||
// Getters
|
||||
public static boolean isAuctionEnabled() { return auctionEnabled; }
|
||||
public static long getListingFee() { return listingFee; }
|
||||
public static String getCurrencyName() { return currencyName; }
|
||||
public static int getAuctionDurationHours() { return auctionDurationHours; }
|
||||
public static double getMinBidIncrement() { return minBidIncrement; }
|
||||
public static int getMaxActiveListings() { return maxActiveListings; }
|
||||
public static int getClaimExpirationDays() { return claimExpirationDays; }
|
||||
public static boolean isAuctionEnabled() {
|
||||
return auctionEnabled;
|
||||
}
|
||||
|
||||
public static long getListingFee() {
|
||||
return listingFee;
|
||||
}
|
||||
|
||||
public static String getCurrencyName() {
|
||||
return currencyName;
|
||||
}
|
||||
|
||||
public static int getAuctionDurationHours() {
|
||||
return auctionDurationHours;
|
||||
}
|
||||
|
||||
public static double getMinBidIncrement() {
|
||||
return minBidIncrement;
|
||||
}
|
||||
|
||||
public static int getMaxActiveListings() {
|
||||
return maxActiveListings;
|
||||
}
|
||||
|
||||
public static int getClaimExpirationDays() {
|
||||
return claimExpirationDays;
|
||||
}
|
||||
}
|
||||
@@ -20,12 +20,12 @@ import net.minecraftforge.client.event.RenderHandEvent;
|
||||
import net.minecraftforge.client.event.RenderLivingEvent;
|
||||
import net.minecraftforge.client.event.RenderPlayerEvent;
|
||||
import net.minecraftforge.event.entity.player.ItemTooltipEvent;
|
||||
import noppes.npcs.client.gui.player.AuctionTooltipHandler;
|
||||
import noppes.npcs.client.gui.customoverlay.OverlayCustom;
|
||||
import noppes.npcs.client.gui.hud.ClientHudManager;
|
||||
import noppes.npcs.client.gui.hud.CompassHudComponent;
|
||||
import noppes.npcs.client.gui.hud.EnumHudComponent;
|
||||
import noppes.npcs.client.gui.hud.QuestTrackingComponent;
|
||||
import noppes.npcs.client.gui.player.AuctionTooltipHandler;
|
||||
import noppes.npcs.client.renderer.MarkRenderer;
|
||||
import noppes.npcs.client.renderer.RenderCNPCPlayer;
|
||||
import noppes.npcs.constants.EnumAnimationPart;
|
||||
@@ -91,9 +91,9 @@ public class ClientEventHandler {
|
||||
// Block mouse movement during ability rotation lock.
|
||||
// Allow clicks (button >= 0) and scroll (dwheel != 0) to pass through.
|
||||
if (mc.theWorld != null && mc.thePlayer != null
|
||||
&& ClientAbilityState.shouldLockRotation()
|
||||
&& (event.dx != 0 || event.dy != 0)
|
||||
&& event.button == -1 && event.dwheel == 0) {
|
||||
&& ClientAbilityState.shouldLockRotation()
|
||||
&& (event.dx != 0 || event.dy != 0)
|
||||
&& event.button == -1 && event.dwheel == 0) {
|
||||
event.setCanceled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -6,8 +6,27 @@ import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.ObfuscationReflectionHelper;
|
||||
import kamkeel.npcs.addon.client.DBCClient;
|
||||
import kamkeel.npcs.client.renderer.RenderAbilityBeam;
|
||||
import kamkeel.npcs.client.renderer.RenderAbilityDisc;
|
||||
import kamkeel.npcs.client.renderer.RenderAbilityLaser;
|
||||
import kamkeel.npcs.client.renderer.RenderAbilityOrb;
|
||||
import kamkeel.npcs.client.renderer.RenderAbilitySweeper;
|
||||
import kamkeel.npcs.client.renderer.RenderAbilityZone;
|
||||
import kamkeel.npcs.client.renderer.RenderEnergyDome;
|
||||
import kamkeel.npcs.client.renderer.RenderEnergyPanel;
|
||||
import kamkeel.npcs.client.renderer.RenderEnergySlicer;
|
||||
import kamkeel.npcs.client.renderer.TelegraphRenderer;
|
||||
import kamkeel.npcs.client.renderer.lightning.LightningHandler;
|
||||
import kamkeel.npcs.controllers.data.telegraph.TelegraphManager;
|
||||
import kamkeel.npcs.entity.EntityAbilityBeam;
|
||||
import kamkeel.npcs.entity.EntityAbilityDisc;
|
||||
import kamkeel.npcs.entity.EntityAbilityLaser;
|
||||
import kamkeel.npcs.entity.EntityAbilityOrb;
|
||||
import kamkeel.npcs.entity.EntityAbilitySweeper;
|
||||
import kamkeel.npcs.entity.EntityAbilityZone;
|
||||
import kamkeel.npcs.entity.EntityEnergyDome;
|
||||
import kamkeel.npcs.entity.EntityEnergyPanel;
|
||||
import kamkeel.npcs.entity.EntityEnergySlicer;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.model.ModelBiped;
|
||||
@@ -88,12 +107,12 @@ import noppes.npcs.client.gui.global.GuiNPCManageAnimations;
|
||||
import noppes.npcs.client.gui.global.GuiNPCManageBanks;
|
||||
import noppes.npcs.client.gui.global.GuiNPCManageDialogs;
|
||||
import noppes.npcs.client.gui.global.GuiNPCManageEffects;
|
||||
import noppes.npcs.client.gui.global.GuiNpcManageAbilities;
|
||||
import noppes.npcs.client.gui.global.GuiNPCManageFactions;
|
||||
import noppes.npcs.client.gui.global.GuiNPCManageLinked;
|
||||
import noppes.npcs.client.gui.global.GuiNPCManageQuest;
|
||||
import noppes.npcs.client.gui.global.GuiNPCManageTags;
|
||||
import noppes.npcs.client.gui.global.GuiNPCManageTransporters;
|
||||
import noppes.npcs.client.gui.global.GuiNpcManageAbilities;
|
||||
import noppes.npcs.client.gui.global.GuiNpcManageMagic;
|
||||
import noppes.npcs.client.gui.global.GuiNpcManageRecipes;
|
||||
import noppes.npcs.client.gui.global.GuiNpcQuestReward;
|
||||
@@ -105,15 +124,15 @@ import noppes.npcs.client.gui.mainmenu.GuiNpcAI;
|
||||
import noppes.npcs.client.gui.mainmenu.GuiNpcAdvanced;
|
||||
import noppes.npcs.client.gui.mainmenu.GuiNpcDisplay;
|
||||
import noppes.npcs.client.gui.mainmenu.GuiNpcStats;
|
||||
import noppes.npcs.client.gui.player.GuiAuctionBidding;
|
||||
import noppes.npcs.client.gui.player.GuiAuctionListing;
|
||||
import noppes.npcs.client.gui.player.GuiAuctionSell;
|
||||
import noppes.npcs.client.gui.player.GuiAuctionTrades;
|
||||
import noppes.npcs.client.gui.player.GuiBigSign;
|
||||
import noppes.npcs.client.gui.player.GuiCrate;
|
||||
import noppes.npcs.client.gui.player.GuiMailbox;
|
||||
import noppes.npcs.client.gui.player.GuiMailmanWrite;
|
||||
import noppes.npcs.client.gui.player.GuiNPCBankChest;
|
||||
import noppes.npcs.client.gui.player.GuiAuctionBidding;
|
||||
import noppes.npcs.client.gui.player.GuiAuctionTrades;
|
||||
import noppes.npcs.client.gui.player.GuiAuctionListing;
|
||||
import noppes.npcs.client.gui.player.GuiAuctionSell;
|
||||
import noppes.npcs.client.gui.player.GuiNPCTrader;
|
||||
import noppes.npcs.client.gui.player.GuiNpcAnvil;
|
||||
import noppes.npcs.client.gui.player.GuiNpcCarpentryBench;
|
||||
@@ -146,25 +165,6 @@ import noppes.npcs.client.renderer.RenderNpcCrystal;
|
||||
import noppes.npcs.client.renderer.RenderNpcDragon;
|
||||
import noppes.npcs.client.renderer.RenderNpcSlime;
|
||||
import noppes.npcs.client.renderer.RenderProjectile;
|
||||
import kamkeel.npcs.client.renderer.RenderAbilityOrb;
|
||||
import kamkeel.npcs.client.renderer.RenderAbilityDisc;
|
||||
import kamkeel.npcs.client.renderer.RenderAbilityLaser;
|
||||
import kamkeel.npcs.client.renderer.RenderAbilityBeam;
|
||||
import kamkeel.npcs.client.renderer.RenderAbilitySweeper;
|
||||
import kamkeel.npcs.client.renderer.RenderAbilityZone;
|
||||
import kamkeel.npcs.client.renderer.RenderEnergyDome;
|
||||
import kamkeel.npcs.client.renderer.RenderEnergyPanel;
|
||||
import kamkeel.npcs.client.renderer.RenderEnergySlicer;
|
||||
import kamkeel.npcs.client.renderer.lightning.LightningHandler;
|
||||
import kamkeel.npcs.entity.EntityAbilityOrb;
|
||||
import kamkeel.npcs.entity.EntityAbilityDisc;
|
||||
import kamkeel.npcs.entity.EntityAbilityLaser;
|
||||
import kamkeel.npcs.entity.EntityAbilityBeam;
|
||||
import kamkeel.npcs.entity.EntityAbilitySweeper;
|
||||
import kamkeel.npcs.entity.EntityAbilityZone;
|
||||
import kamkeel.npcs.entity.EntityEnergyDome;
|
||||
import kamkeel.npcs.entity.EntityEnergyPanel;
|
||||
import kamkeel.npcs.entity.EntityEnergySlicer;
|
||||
import noppes.npcs.client.renderer.blocks.BlockBannerRenderer;
|
||||
import noppes.npcs.client.renderer.blocks.BlockBarrelRenderer;
|
||||
import noppes.npcs.client.renderer.blocks.BlockBeamRenderer;
|
||||
@@ -200,13 +200,16 @@ import noppes.npcs.client.renderer.items.ItemShortLampRenderer;
|
||||
import noppes.npcs.client.renderer.items.ItemTallLampRenderer;
|
||||
import noppes.npcs.client.renderer.items.ItemToolRenderer;
|
||||
import noppes.npcs.client.renderer.items.ScriptedBlockItemRenderer;
|
||||
import noppes.npcs.client.ScriptClientConfig;
|
||||
import noppes.npcs.config.ConfigClient;
|
||||
import noppes.npcs.config.ConfigItem;
|
||||
import noppes.npcs.config.ConfigMain;
|
||||
import noppes.npcs.config.StringCache;
|
||||
import noppes.npcs.constants.EnumGuiType;
|
||||
import noppes.npcs.containers.ContainerAnvilRepair;
|
||||
import noppes.npcs.containers.ContainerAuctionBidding;
|
||||
import noppes.npcs.containers.ContainerAuctionListing;
|
||||
import noppes.npcs.containers.ContainerAuctionSell;
|
||||
import noppes.npcs.containers.ContainerAuctionTrades;
|
||||
import noppes.npcs.containers.ContainerCarpentryBench;
|
||||
import noppes.npcs.containers.ContainerCrate;
|
||||
import noppes.npcs.containers.ContainerCustomGui;
|
||||
@@ -219,11 +222,6 @@ import noppes.npcs.containers.ContainerNPCFollower;
|
||||
import noppes.npcs.containers.ContainerNPCFollowerHire;
|
||||
import noppes.npcs.containers.ContainerNPCFollowerSetup;
|
||||
import noppes.npcs.containers.ContainerNPCInv;
|
||||
import noppes.npcs.containers.ContainerAuction;
|
||||
import noppes.npcs.containers.ContainerAuctionBidding;
|
||||
import noppes.npcs.containers.ContainerAuctionTrades;
|
||||
import noppes.npcs.containers.ContainerAuctionListing;
|
||||
import noppes.npcs.containers.ContainerAuctionSell;
|
||||
import noppes.npcs.containers.ContainerNPCTrader;
|
||||
import noppes.npcs.containers.ContainerNPCTraderSetup;
|
||||
import noppes.npcs.containers.ContainerNpcItemGiver;
|
||||
@@ -525,9 +523,7 @@ public class ClientProxy extends CommonProxy {
|
||||
abilityNpc.width = 0.6f;
|
||||
}
|
||||
return new GuiNpcManageAbilities(abilityNpc, npc != null);
|
||||
}
|
||||
|
||||
else if (gui == EnumGuiType.MainMenuGlobal)
|
||||
} else if (gui == EnumGuiType.MainMenuGlobal)
|
||||
return new GuiNPCGlobalMainMenu(npc);
|
||||
|
||||
else if (gui == EnumGuiType.MainMenuAI)
|
||||
|
||||
@@ -136,8 +136,8 @@ public class ClientTickHandler {
|
||||
|
||||
// Prevent jumping when locked (allow gravity only if not flying)
|
||||
if ((ClientAbilityState.movementLocked || ClientAbilityState.positionLocked)
|
||||
&& !ClientAbilityState.hasAbilityMovement
|
||||
&& !AbilityController.Instance.isPlayerFlying(mc.thePlayer)) {
|
||||
&& !ClientAbilityState.hasAbilityMovement
|
||||
&& !AbilityController.Instance.isPlayerFlying(mc.thePlayer)) {
|
||||
mc.thePlayer.motionY = Math.min(mc.thePlayer.motionY, 0);
|
||||
}
|
||||
}
|
||||
@@ -226,7 +226,7 @@ public class ClientTickHandler {
|
||||
// Block movement keys during ability lock (only when no GUI is open and world exists).
|
||||
// Non-movement keys (ESC, chat, inventory, etc.) always pass through.
|
||||
if (mc.theWorld != null && mc.currentScreen == null && keyDown
|
||||
&& ClientAbilityState.shouldSuppressMovementInput() && isMovementKey(key)) {
|
||||
&& ClientAbilityState.shouldSuppressMovementInput() && isMovementKey(key)) {
|
||||
// Unpress the keybind so vanilla doesn't process it
|
||||
KeyBinding.setKeyBindState(key, false);
|
||||
return;
|
||||
|
||||
@@ -7,7 +7,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
/**
|
||||
* Client-side cache for script configuration synced from server.
|
||||
* Prevents client from using local ConfigScript which may differ from server settings.
|
||||
*
|
||||
* <p>
|
||||
* IMPORTANT: This class is CLIENT-ONLY. Server-side NBT writing is done in
|
||||
* ScriptConfigSync to avoid @SideOnly crashes on dedicated servers.
|
||||
*/
|
||||
@@ -46,16 +46,44 @@ public class ScriptClientConfig {
|
||||
}
|
||||
|
||||
// Setters for individual packet updates
|
||||
public static void setScriptingEnabled(boolean value) { scriptingEnabled = value; }
|
||||
public static void setRunLoadedScriptsFirst(boolean value) { runLoadedScriptsFirst = value; }
|
||||
public static void setGlobalPlayerScripts(boolean value) { globalPlayerScripts = value; }
|
||||
public static void setGlobalForgeScripts(boolean value) { globalForgeScripts = value; }
|
||||
public static void setGlobalNPCScripts(boolean value) { globalNPCScripts = value; }
|
||||
public static void setScriptingEnabled(boolean value) {
|
||||
scriptingEnabled = value;
|
||||
}
|
||||
|
||||
public static void setRunLoadedScriptsFirst(boolean value) {
|
||||
runLoadedScriptsFirst = value;
|
||||
}
|
||||
|
||||
public static void setGlobalPlayerScripts(boolean value) {
|
||||
globalPlayerScripts = value;
|
||||
}
|
||||
|
||||
public static void setGlobalForgeScripts(boolean value) {
|
||||
globalForgeScripts = value;
|
||||
}
|
||||
|
||||
public static void setGlobalNPCScripts(boolean value) {
|
||||
globalNPCScripts = value;
|
||||
}
|
||||
|
||||
// Getters
|
||||
public static boolean isScriptingEnabled() { return scriptingEnabled; }
|
||||
public static boolean isRunLoadedScriptsFirst() { return runLoadedScriptsFirst; }
|
||||
public static boolean isGlobalPlayerScripts() { return globalPlayerScripts; }
|
||||
public static boolean isGlobalForgeScripts() { return globalForgeScripts; }
|
||||
public static boolean isGlobalNPCScripts() { return globalNPCScripts; }
|
||||
public static boolean isScriptingEnabled() {
|
||||
return scriptingEnabled;
|
||||
}
|
||||
|
||||
public static boolean isRunLoadedScriptsFirst() {
|
||||
return runLoadedScriptsFirst;
|
||||
}
|
||||
|
||||
public static boolean isGlobalPlayerScripts() {
|
||||
return globalPlayerScripts;
|
||||
}
|
||||
|
||||
public static boolean isGlobalForgeScripts() {
|
||||
return globalForgeScripts;
|
||||
}
|
||||
|
||||
public static boolean isGlobalNPCScripts() {
|
||||
return globalNPCScripts;
|
||||
}
|
||||
}
|
||||
@@ -16,9 +16,9 @@ public class ZoneParticleFX extends EntityFX {
|
||||
private final boolean glow;
|
||||
|
||||
public ZoneParticleFX(World world, double x, double y, double z,
|
||||
double motionX, double motionY, double motionZ,
|
||||
float r, float g, float b, float alpha,
|
||||
float scale, int maxAge, float gravity, boolean glow) {
|
||||
double motionX, double motionY, double motionZ,
|
||||
float r, float g, float b, float alpha,
|
||||
float scale, int maxAge, float gravity, boolean glow) {
|
||||
super(world, x, y, z, 0, 0, 0);
|
||||
this.motionX = motionX;
|
||||
this.motionY = motionY;
|
||||
|
||||
@@ -74,10 +74,10 @@ public class GuiNpcMobSpawnerFullscreen extends GuiDirectory implements IGuiData
|
||||
this.posZ = posZ;
|
||||
|
||||
// Configure GuiDirectory layout percentages
|
||||
leftPanelPercent = 0.15f;
|
||||
leftPanelPercent = 0.15f;
|
||||
rightPanelPercent = 0.08f;
|
||||
minLeftPanelW = 120;
|
||||
minRightPanelW = 62;
|
||||
minLeftPanelW = 120;
|
||||
minRightPanelW = 62;
|
||||
|
||||
PacketClient.sendClient(new CloneAllTagsPacket());
|
||||
if (GuiNpcMobSpawner.showingClones == 2) {
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
package noppes.npcs.client.gui;
|
||||
|
||||
import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.packets.request.dialog.DialogSavePacket;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.client.NoppesUtil;
|
||||
import noppes.npcs.client.gui.util.GuiCustomScroll;
|
||||
import noppes.npcs.client.gui.util.GuiMenuTopButton;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package noppes.npcs.client.gui.advanced;
|
||||
|
||||
import kamkeel.npcs.controllers.data.ability.Ability;
|
||||
import kamkeel.npcs.controllers.AbilityController;
|
||||
import kamkeel.npcs.controllers.data.ability.Ability;
|
||||
import kamkeel.npcs.controllers.data.ability.AbilityAction;
|
||||
import kamkeel.npcs.controllers.data.ability.AbilityVariant;
|
||||
import kamkeel.npcs.controllers.data.ability.ChainedAbility;
|
||||
@@ -33,7 +33,14 @@ import noppes.npcs.client.gui.util.SubGuiInterface;
|
||||
import noppes.npcs.constants.EnumScrollData;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.Vector;
|
||||
|
||||
/**
|
||||
* GUI for managing NPC abilities.
|
||||
@@ -42,30 +49,30 @@ import java.util.*;
|
||||
public class GuiNPCAbilities extends GuiNPCInterface2 implements IScrollData, ICustomScrollListener, IGuiData, ITextfieldListener, ISubGuiListener, IAbilityConfigCallback, IChainedAbilityConfigCallback {
|
||||
|
||||
// ── Button IDs ────────────────────────────────────────────────────────────
|
||||
private static final int BTN_SCROLL_TYPE = 50;
|
||||
private static final int BTN_ADD_ABILITY = 70;
|
||||
private static final int BTN_REMOVE = 71;
|
||||
private static final int BTN_EDIT = 72;
|
||||
private static final int BTN_MOVE_UP = 73;
|
||||
private static final int BTN_MOVE_DOWN = 74;
|
||||
private static final int BTN_LOAD = 75;
|
||||
private static final int BTN_SAVE_PRESET = 76;
|
||||
private static final int BTN_TOGGLE_SLOT = 77;
|
||||
private static final int BTN_ADD_CHAIN = 78;
|
||||
private static final int BTN_ENABLED = 100;
|
||||
private static final int BTN_SCROLL_TYPE = 50;
|
||||
private static final int BTN_ADD_ABILITY = 70;
|
||||
private static final int BTN_REMOVE = 71;
|
||||
private static final int BTN_EDIT = 72;
|
||||
private static final int BTN_MOVE_UP = 73;
|
||||
private static final int BTN_MOVE_DOWN = 74;
|
||||
private static final int BTN_LOAD = 75;
|
||||
private static final int BTN_SAVE_PRESET = 76;
|
||||
private static final int BTN_TOGGLE_SLOT = 77;
|
||||
private static final int BTN_ADD_CHAIN = 78;
|
||||
private static final int BTN_ENABLED = 100;
|
||||
|
||||
// ── Scroll IDs ────────────────────────────────────────────────────────────
|
||||
private static final int SCROLL_TYPES = 0;
|
||||
private static final int SCROLL_NPC = 1;
|
||||
private static final int SCROLL_TYPES = 0;
|
||||
private static final int SCROLL_NPC = 1;
|
||||
|
||||
// ── TextField / Label IDs ─────────────────────────────────────────────────
|
||||
private static final int TF_MIN_COOLDOWN = 101;
|
||||
private static final int TF_MAX_COOLDOWN = 102;
|
||||
private static final int TF_SEARCH = 4;
|
||||
private static final int LBL_TYPES = 1;
|
||||
private static final int LBL_NPC = 2;
|
||||
private static final int LBL_MIN_COOLDOWN = 101;
|
||||
private static final int LBL_MAX_COOLDOWN = 102;
|
||||
private static final int TF_MIN_COOLDOWN = 101;
|
||||
private static final int TF_MAX_COOLDOWN = 102;
|
||||
private static final int TF_SEARCH = 4;
|
||||
private static final int LBL_TYPES = 1;
|
||||
private static final int LBL_NPC = 2;
|
||||
private static final int LBL_MIN_COOLDOWN = 101;
|
||||
private static final int LBL_MAX_COOLDOWN = 102;
|
||||
|
||||
// ── Scroll lists ──────────────────────────────────────────────────────────
|
||||
private GuiCustomScroll availableTypesScroll;
|
||||
@@ -127,7 +134,8 @@ public class GuiNPCAbilities extends GuiNPCInterface2 implements IScrollData, IC
|
||||
@Override
|
||||
public String toString() {
|
||||
switch (this) {
|
||||
case CNPC: return "CustomNPCs";
|
||||
case CNPC:
|
||||
return "CustomNPCs";
|
||||
case MODDED:
|
||||
if (Register.isEmpty("ability"))
|
||||
return "modded";
|
||||
@@ -135,8 +143,10 @@ public class GuiNPCAbilities extends GuiNPCInterface2 implements IScrollData, IC
|
||||
String namespace = Register.REGISTERED_NAMESPACES.get("ability").get(modIndex);
|
||||
String displayName = Register.NAMESPACE_DISPLAY_NAMES.get(namespace);
|
||||
return displayName != null ? displayName : namespace;
|
||||
case ALL: return "filter.all";
|
||||
default: return name();
|
||||
case ALL:
|
||||
return "filter.all";
|
||||
default:
|
||||
return name();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -855,13 +865,37 @@ public class GuiNPCAbilities extends GuiNPCInterface2 implements IScrollData, IC
|
||||
|
||||
@Override
|
||||
public void subGuiClosed(SubGuiInterface subgui) {
|
||||
if (subgui instanceof SubGuiAbilityVariantSelect) { handleVariantSelectClosed((SubGuiAbilityVariantSelect) subgui); initGui(); return; }
|
||||
if (subgui instanceof SubGuiChainedAbilityConfig) { handleChainConfigClosed(); initGui(); return; }
|
||||
if (subgui instanceof SubGuiAbilityEditMode) { handleEditModeClosed((SubGuiAbilityEditMode) subgui); return; }
|
||||
if (subgui instanceof SubGuiAbilitySaveConfirm) { handleSaveConfirmClosed((SubGuiAbilitySaveConfirm) subgui); initGui(); return; }
|
||||
if (subgui instanceof SubGuiLoadTypeChoice) { handleLoadTypeChoiceClosed((SubGuiLoadTypeChoice) subgui); return; }
|
||||
if (subgui instanceof SubGuiChainSelect) { handleChainSelectClosed((SubGuiChainSelect) subgui); return; }
|
||||
if (subgui instanceof SubGuiAbilityConfig) { handleAbilityConfigClosed(); return; }
|
||||
if (subgui instanceof SubGuiAbilityVariantSelect) {
|
||||
handleVariantSelectClosed((SubGuiAbilityVariantSelect) subgui);
|
||||
initGui();
|
||||
return;
|
||||
}
|
||||
if (subgui instanceof SubGuiChainedAbilityConfig) {
|
||||
handleChainConfigClosed();
|
||||
initGui();
|
||||
return;
|
||||
}
|
||||
if (subgui instanceof SubGuiAbilityEditMode) {
|
||||
handleEditModeClosed((SubGuiAbilityEditMode) subgui);
|
||||
return;
|
||||
}
|
||||
if (subgui instanceof SubGuiAbilitySaveConfirm) {
|
||||
handleSaveConfirmClosed((SubGuiAbilitySaveConfirm) subgui);
|
||||
initGui();
|
||||
return;
|
||||
}
|
||||
if (subgui instanceof SubGuiLoadTypeChoice) {
|
||||
handleLoadTypeChoiceClosed((SubGuiLoadTypeChoice) subgui);
|
||||
return;
|
||||
}
|
||||
if (subgui instanceof SubGuiChainSelect) {
|
||||
handleChainSelectClosed((SubGuiChainSelect) subgui);
|
||||
return;
|
||||
}
|
||||
if (subgui instanceof SubGuiAbilityConfig) {
|
||||
handleAbilityConfigClosed();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
private void handleVariantSelectClosed(SubGuiAbilityVariantSelect gui) {
|
||||
|
||||
@@ -3,10 +3,10 @@ package noppes.npcs.client.gui.advanced;
|
||||
import kamkeel.npcs.controllers.data.ability.Ability;
|
||||
import kamkeel.npcs.controllers.data.ability.Condition;
|
||||
import kamkeel.npcs.controllers.data.ability.gui.AbilityFieldBuilder;
|
||||
import noppes.npcs.client.gui.builder.FieldDef;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import noppes.npcs.client.gui.builder.FieldDef;
|
||||
import noppes.npcs.client.gui.util.GuiMenuTopButton;
|
||||
import noppes.npcs.client.gui.util.GuiNpcButton;
|
||||
import noppes.npcs.client.gui.util.GuiNpcLabel;
|
||||
@@ -75,11 +75,11 @@ public class SubGuiAbilityConfig extends SubGuiInterface implements ITextfieldLi
|
||||
for (FieldDef def : fieldDefs) {
|
||||
String tab = def.getTab();
|
||||
if (tab != null
|
||||
&& !TAB_NAME_GENERAL.equals(tab)
|
||||
&& !TAB_NAME_TYPE.equals(tab)
|
||||
&& !TAB_NAME_TARGET.equals(tab)
|
||||
&& !TAB_NAME_EFFECTS.equals(tab)
|
||||
&& !customTabNames.contains(tab)) {
|
||||
&& !TAB_NAME_GENERAL.equals(tab)
|
||||
&& !TAB_NAME_TYPE.equals(tab)
|
||||
&& !TAB_NAME_TARGET.equals(tab)
|
||||
&& !TAB_NAME_EFFECTS.equals(tab)
|
||||
&& !customTabNames.contains(tab)) {
|
||||
customTabNames.add(tab);
|
||||
}
|
||||
}
|
||||
@@ -187,11 +187,21 @@ public class SubGuiAbilityConfig extends SubGuiInterface implements ITextfieldLi
|
||||
}
|
||||
} else {
|
||||
switch (tabIndex) {
|
||||
case TAB_GENERAL: tabName = TAB_NAME_GENERAL; break;
|
||||
case TAB_TYPE: tabName = TAB_NAME_TYPE; break;
|
||||
case TAB_TARGET: tabName = TAB_NAME_TARGET; break;
|
||||
case TAB_EFFECTS: tabName = TAB_NAME_EFFECTS; break;
|
||||
default: tabName = TAB_NAME_TYPE; break;
|
||||
case TAB_GENERAL:
|
||||
tabName = TAB_NAME_GENERAL;
|
||||
break;
|
||||
case TAB_TYPE:
|
||||
tabName = TAB_NAME_TYPE;
|
||||
break;
|
||||
case TAB_TARGET:
|
||||
tabName = TAB_NAME_TARGET;
|
||||
break;
|
||||
case TAB_EFFECTS:
|
||||
tabName = TAB_NAME_EFFECTS;
|
||||
break;
|
||||
default:
|
||||
tabName = TAB_NAME_TYPE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -264,17 +274,36 @@ public class SubGuiAbilityConfig extends SubGuiInterface implements ITextfieldLi
|
||||
int id = guibutton.id;
|
||||
|
||||
// Tab switching — fixed tabs
|
||||
if (id == 90) { activeTab = TAB_GENERAL; initGui(); return; }
|
||||
if (id == 91) { activeTab = TAB_TYPE; initGui(); return; }
|
||||
if (id == 92) { activeTab = TAB_TARGET; initGui(); return; }
|
||||
if (id == 93) { activeTab = TAB_EFFECTS; initGui(); return; }
|
||||
if (id == 90) {
|
||||
activeTab = TAB_GENERAL;
|
||||
initGui();
|
||||
return;
|
||||
}
|
||||
if (id == 91) {
|
||||
activeTab = TAB_TYPE;
|
||||
initGui();
|
||||
return;
|
||||
}
|
||||
if (id == 92) {
|
||||
activeTab = TAB_TARGET;
|
||||
initGui();
|
||||
return;
|
||||
}
|
||||
if (id == 93) {
|
||||
activeTab = TAB_EFFECTS;
|
||||
initGui();
|
||||
return;
|
||||
}
|
||||
// Custom tabs (94+)
|
||||
if (id >= 94 && id < 94 + customTabNames.size()) {
|
||||
activeTab = 4 + (id - 94);
|
||||
initGui();
|
||||
return;
|
||||
}
|
||||
if (id == -1000) { close(); return; }
|
||||
if (id == -1000) {
|
||||
close();
|
||||
return;
|
||||
}
|
||||
|
||||
// Condition buttons (50-80)
|
||||
if (handleConditionButton(id)) return;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package noppes.npcs.client.gui.advanced;
|
||||
|
||||
import kamkeel.npcs.controllers.data.ability.Ability;
|
||||
import kamkeel.npcs.controllers.AbilityController;
|
||||
import kamkeel.npcs.controllers.data.ability.Ability;
|
||||
import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.packets.request.ability.CustomAbilitiesGetPacket;
|
||||
import kamkeel.npcs.network.packets.request.ability.CustomAbilityGetPacket;
|
||||
|
||||
@@ -43,37 +43,37 @@ public class SubGuiChainedAbilityConfig extends SubGuiInterface implements IText
|
||||
private static final int LABEL_ID_START = 3000;
|
||||
|
||||
// ── Tab constants (core tabs) ────────────────────────────────────────────
|
||||
private static final int TAB_GENERAL = 0;
|
||||
private static final int TAB_ENTRIES = 1;
|
||||
private static final int TAB_GENERAL = 0;
|
||||
private static final int TAB_ENTRIES = 1;
|
||||
private static final int TAB_CONDITIONS = 2;
|
||||
private static final int CORE_TAB_COUNT = 3;
|
||||
|
||||
// ── Tab button IDs ────────────────────────────────────────────────────────
|
||||
private static final int BTN_TAB_GENERAL = 90;
|
||||
private static final int BTN_TAB_ENTRIES = 91;
|
||||
private static final int BTN_TAB_GENERAL = 90;
|
||||
private static final int BTN_TAB_ENTRIES = 91;
|
||||
private static final int BTN_TAB_CONDITIONS = 92;
|
||||
private static final int BTN_TAB_EXTRA_BASE = 93;
|
||||
private static final int BTN_CLOSE = -1000;
|
||||
private static final int BTN_CLOSE = -1000;
|
||||
|
||||
// ── Entries tab: per-entry ID encoding ─────────────────────────────────────
|
||||
// Actual ID = ENTRY_BASE + i * ENTRY_STRIDE + offset
|
||||
// offset 0 = name/select button, 1 = delay text field, 2 = up, 3 = down, 4 = delete
|
||||
private static final int ENTRY_BASE = 100;
|
||||
private static final int ENTRY_END = 200;
|
||||
private static final int ENTRY_STRIDE = 10;
|
||||
private static final int ENTRY_BASE = 100;
|
||||
private static final int ENTRY_END = 200;
|
||||
private static final int ENTRY_STRIDE = 10;
|
||||
private static final int BTN_ADD_ENTRY = 200;
|
||||
|
||||
// ── Conditions tab: per-condition ID encoding ─────────────────────────────
|
||||
// Actual ID = COND_BASE + i * COND_STRIDE + offset
|
||||
// offset 0 = name/click, 1 = edit, 2 = delete
|
||||
private static final int COND_BASE = 50;
|
||||
private static final int COND_END = 80;
|
||||
private static final int COND_STRIDE = 10;
|
||||
private static final int BTN_ADD_COND = 80;
|
||||
private static final int COND_BASE = 50;
|
||||
private static final int COND_END = 80;
|
||||
private static final int COND_STRIDE = 10;
|
||||
private static final int BTN_ADD_COND = 80;
|
||||
|
||||
// ── Layout constants ──────────────────────────────────────────────────────
|
||||
private static final int L_LABEL_X = 5;
|
||||
private static final int ROW_H = 24;
|
||||
private static final int L_LABEL_X = 5;
|
||||
private static final int ROW_H = 24;
|
||||
private static final int MAX_ENTRIES = 10;
|
||||
|
||||
private final ChainedAbility chain;
|
||||
@@ -109,7 +109,7 @@ public class SubGuiChainedAbilityConfig extends SubGuiInterface implements IText
|
||||
}
|
||||
|
||||
public SubGuiChainedAbilityConfig(ChainedAbility chain, IChainedAbilityConfigCallback callback,
|
||||
boolean npcContext, List<AbilityAction> npcSlots) {
|
||||
boolean npcContext, List<AbilityAction> npcSlots) {
|
||||
this.chain = chain;
|
||||
this.callback = callback;
|
||||
this.npcContext = npcContext;
|
||||
@@ -417,10 +417,26 @@ public class SubGuiChainedAbilityConfig extends SubGuiInterface implements IText
|
||||
int id = guibutton.id;
|
||||
|
||||
// Tab switching — core tabs
|
||||
if (id == BTN_TAB_GENERAL) { activeTab = TAB_GENERAL; initGui(); return; }
|
||||
if (id == BTN_TAB_ENTRIES) { activeTab = TAB_ENTRIES; initGui(); return; }
|
||||
if (id == BTN_TAB_CONDITIONS) { activeTab = TAB_CONDITIONS; initGui(); return; }
|
||||
if (id == BTN_CLOSE) { saveOnClose = true; close(); return; }
|
||||
if (id == BTN_TAB_GENERAL) {
|
||||
activeTab = TAB_GENERAL;
|
||||
initGui();
|
||||
return;
|
||||
}
|
||||
if (id == BTN_TAB_ENTRIES) {
|
||||
activeTab = TAB_ENTRIES;
|
||||
initGui();
|
||||
return;
|
||||
}
|
||||
if (id == BTN_TAB_CONDITIONS) {
|
||||
activeTab = TAB_CONDITIONS;
|
||||
initGui();
|
||||
return;
|
||||
}
|
||||
if (id == BTN_CLOSE) {
|
||||
saveOnClose = true;
|
||||
close();
|
||||
return;
|
||||
}
|
||||
|
||||
// Tab switching — extra tabs
|
||||
if (id >= BTN_TAB_EXTRA_BASE && id < BTN_TAB_EXTRA_BASE + extraTabs.size()) {
|
||||
@@ -575,12 +591,35 @@ public class SubGuiChainedAbilityConfig extends SubGuiInterface implements IText
|
||||
}
|
||||
}
|
||||
|
||||
if (subgui instanceof SubGuiAbilitySelect) { handleAbilitySelectClosed((SubGuiAbilitySelect) subgui); initGui(); return; }
|
||||
if (subgui instanceof SubGuiChainedEntrySource) { handleEntrySourceClosed((SubGuiChainedEntrySource) subgui); return; }
|
||||
if (subgui instanceof SubGuiNpcSlotPicker) { handleSlotPickerClosed((SubGuiNpcSlotPicker) subgui); initGui(); return; }
|
||||
if (subgui instanceof SubGuiAbilityTypeSelect) { handleTypeSelectClosed((SubGuiAbilityTypeSelect) subgui); if (!hasSubGui()) initGui(); return; }
|
||||
if (subgui instanceof SubGuiAbilityConfig) { editingEntryIndex = -1; initGui(); return; }
|
||||
if (subgui instanceof SubGuiConditionEdit) { handleConditionEditClosed((SubGuiConditionEdit) subgui); initGui(); return; }
|
||||
if (subgui instanceof SubGuiAbilitySelect) {
|
||||
handleAbilitySelectClosed((SubGuiAbilitySelect) subgui);
|
||||
initGui();
|
||||
return;
|
||||
}
|
||||
if (subgui instanceof SubGuiChainedEntrySource) {
|
||||
handleEntrySourceClosed((SubGuiChainedEntrySource) subgui);
|
||||
return;
|
||||
}
|
||||
if (subgui instanceof SubGuiNpcSlotPicker) {
|
||||
handleSlotPickerClosed((SubGuiNpcSlotPicker) subgui);
|
||||
initGui();
|
||||
return;
|
||||
}
|
||||
if (subgui instanceof SubGuiAbilityTypeSelect) {
|
||||
handleTypeSelectClosed((SubGuiAbilityTypeSelect) subgui);
|
||||
if (!hasSubGui()) initGui();
|
||||
return;
|
||||
}
|
||||
if (subgui instanceof SubGuiAbilityConfig) {
|
||||
editingEntryIndex = -1;
|
||||
initGui();
|
||||
return;
|
||||
}
|
||||
if (subgui instanceof SubGuiConditionEdit) {
|
||||
handleConditionEditClosed((SubGuiConditionEdit) subgui);
|
||||
initGui();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
private void handleAbilitySelectClosed(SubGuiAbilitySelect gui) {
|
||||
|
||||
@@ -2,12 +2,12 @@ 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 noppes.npcs.controllers.AnimationController;
|
||||
import noppes.npcs.controllers.data.Animation;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.function.BooleanSupplier;
|
||||
@@ -175,8 +175,8 @@ public class FieldDef {
|
||||
}
|
||||
|
||||
public static FieldDef animSubGui(String label,
|
||||
Supplier<Integer> idGetter, Consumer<Integer> idSetter,
|
||||
Supplier<String> nameGetter, Consumer<String> nameSetter) {
|
||||
Supplier<Integer> idGetter, Consumer<Integer> idSetter,
|
||||
Supplier<String> nameGetter, Consumer<String> nameSetter) {
|
||||
return subGuiField(label,
|
||||
() -> new GuiAnimationSelection(idGetter.get(), nameGetter.get()),
|
||||
gui -> {
|
||||
@@ -202,7 +202,10 @@ public class FieldDef {
|
||||
}
|
||||
return "gui.none";
|
||||
})
|
||||
.clearable(() -> { idSetter.accept(-1); nameSetter.accept(""); });
|
||||
.clearable(() -> {
|
||||
idSetter.accept(-1);
|
||||
nameSetter.accept("");
|
||||
});
|
||||
}
|
||||
|
||||
// ═══════════════════════════════════════════════════════════════════
|
||||
@@ -264,21 +267,65 @@ public class FieldDef {
|
||||
// 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.NEGATIVE_INFINITY || max != Float.POSITIVE_INFINITY; }
|
||||
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 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.NEGATIVE_INFINITY || max != Float.POSITIVE_INFINITY;
|
||||
}
|
||||
|
||||
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;
|
||||
@@ -305,8 +352,13 @@ public class FieldDef {
|
||||
return buttonTextColorSupplier != null ? buttonTextColorSupplier.get() : null;
|
||||
}
|
||||
|
||||
public FieldDef getLeftChild() { return leftChild; }
|
||||
public FieldDef getRightChild() { return rightChild; }
|
||||
public FieldDef getLeftChild() {
|
||||
return leftChild;
|
||||
}
|
||||
|
||||
public FieldDef getRightChild() {
|
||||
return rightChild;
|
||||
}
|
||||
|
||||
// ═══════════════════════════════════════════════════════════════════
|
||||
// LIST MANIPULATION (for mod injection)
|
||||
@@ -356,7 +408,7 @@ public class FieldDef {
|
||||
*
|
||||
* @param fields The field list to modify
|
||||
* @param targetLabel The label of the field to modify
|
||||
* @param condition The condition to replace
|
||||
* @param condition The condition to replace
|
||||
* @return true if the target was found and the condition was modified
|
||||
*/
|
||||
public static boolean modifyVisibility(List<FieldDef> fields, String targetLabel, BooleanSupplier condition) {
|
||||
|
||||
@@ -69,13 +69,32 @@ public class GuiFieldBuilder {
|
||||
// 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 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;
|
||||
}
|
||||
public GuiFieldBuilder startY(int y) { this.startY = y; return this; }
|
||||
public GuiFieldBuilder rowHeight(int h) { this.rowHeight = h; return this; }
|
||||
|
||||
// ═══════════════════════════════════════════════════════════════════
|
||||
// BUILD
|
||||
@@ -98,6 +117,7 @@ public class GuiFieldBuilder {
|
||||
|
||||
/**
|
||||
* Processes all fields and adds widgets to the scroll window.
|
||||
*
|
||||
* @return the final Y position after all fields
|
||||
*/
|
||||
protected int build(List<FieldDef> fields) {
|
||||
@@ -173,8 +193,14 @@ public class GuiFieldBuilder {
|
||||
}
|
||||
|
||||
private int lastHandledIndex = -1;
|
||||
protected void setLastHandledIndex(int index) { this.lastHandledIndex = index; }
|
||||
protected int getLastHandledIndex() { return lastHandledIndex; }
|
||||
|
||||
protected void setLastHandledIndex(int index) {
|
||||
this.lastHandledIndex = index;
|
||||
}
|
||||
|
||||
protected int getLastHandledIndex() {
|
||||
return lastHandledIndex;
|
||||
}
|
||||
|
||||
// ═══════════════════════════════════════════════════════════════════
|
||||
// FIELD RENDERING
|
||||
@@ -268,7 +294,10 @@ public class GuiFieldBuilder {
|
||||
String curVal = def.getStringEnumValue();
|
||||
int selected = 0;
|
||||
for (int i = 0; i < values.length; i++) {
|
||||
if (values[i].equals(curVal)) { selected = i; break; }
|
||||
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);
|
||||
@@ -321,14 +350,21 @@ public class GuiFieldBuilder {
|
||||
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 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;
|
||||
case STRING_ENUM:
|
||||
return 120;
|
||||
case SUB_GUI:
|
||||
return def.hasClearAction() ? 175 : 200;
|
||||
default:
|
||||
return 80;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -410,7 +446,8 @@ public class GuiFieldBuilder {
|
||||
def.setValue(newVal);
|
||||
return true;
|
||||
}
|
||||
} catch (NumberFormatException ignored) {}
|
||||
} catch (NumberFormatException ignored) {
|
||||
}
|
||||
return false;
|
||||
case INT:
|
||||
try {
|
||||
@@ -421,7 +458,8 @@ public class GuiFieldBuilder {
|
||||
def.setValue(newVal);
|
||||
return true;
|
||||
}
|
||||
} catch (NumberFormatException ignored) {}
|
||||
} catch (NumberFormatException ignored) {
|
||||
}
|
||||
return false;
|
||||
case STRING:
|
||||
String newVal = field.getText();
|
||||
@@ -453,10 +491,27 @@ public class GuiFieldBuilder {
|
||||
// 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; }
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,8 @@
|
||||
package noppes.npcs.client.gui.global;
|
||||
|
||||
import kamkeel.npcs.controllers.data.ability.Ability;
|
||||
import kamkeel.npcs.controllers.AbilityController;
|
||||
import kamkeel.npcs.controllers.data.ability.Ability;
|
||||
import kamkeel.npcs.controllers.data.ability.AbilityVariant;
|
||||
import kamkeel.npcs.controllers.data.ability.ChainedAbility;
|
||||
import kamkeel.npcs.network.PacketClient;
|
||||
import kamkeel.npcs.network.packets.request.ability.BuiltInAbilityGetPacket;
|
||||
@@ -19,7 +20,6 @@ import net.minecraft.client.gui.GuiYesNoCallback;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import noppes.npcs.client.NoppesUtil;
|
||||
import kamkeel.npcs.controllers.data.ability.AbilityVariant;
|
||||
import noppes.npcs.client.gui.advanced.SubGuiAbilityTypeSelect;
|
||||
import noppes.npcs.client.gui.advanced.SubGuiAbilityVariantSelect;
|
||||
import noppes.npcs.client.gui.advanced.SubGuiChainedAbilityConfig;
|
||||
@@ -50,7 +50,7 @@ import java.util.Vector;
|
||||
|
||||
/**
|
||||
* Global GUI for managing saved ability presets with 3D preview.
|
||||
*
|
||||
* <p>
|
||||
* Features:
|
||||
* - Left side: 3D preview of NPC with ability effects
|
||||
* - Right side: Ability list with search
|
||||
@@ -58,29 +58,29 @@ import java.util.Vector;
|
||||
* - Toggle between Custom and Built-in ability views
|
||||
*/
|
||||
public class GuiNpcManageAbilities extends GuiAbilityInterface
|
||||
implements ICustomScrollListener, ISubGuiListener, IAbilityConfigCallback,
|
||||
IChainedAbilityConfigCallback, ITextfieldListener, GuiYesNoCallback,
|
||||
IScrollData, IGuiData {
|
||||
implements ICustomScrollListener, ISubGuiListener, IAbilityConfigCallback,
|
||||
IChainedAbilityConfigCallback, ITextfieldListener, GuiYesNoCallback,
|
||||
IScrollData, IGuiData {
|
||||
|
||||
// ── Button IDs ────────────────────────────────────────────────────────────
|
||||
private static final int BTN_REMOVE = 1;
|
||||
private static final int BTN_ADD = 2;
|
||||
private static final int BTN_TOGGLE_VIEW = 10;
|
||||
private static final int BTN_EDIT = 100;
|
||||
private static final int BTN_PREVIEW_PLAY = 91;
|
||||
private static final int BTN_PREVIEW_PAUSE = 92;
|
||||
private static final int BTN_PREVIEW_STOP = 93;
|
||||
private static final int BTN_REMOVE = 1;
|
||||
private static final int BTN_ADD = 2;
|
||||
private static final int BTN_TOGGLE_VIEW = 10;
|
||||
private static final int BTN_EDIT = 100;
|
||||
private static final int BTN_PREVIEW_PLAY = 91;
|
||||
private static final int BTN_PREVIEW_PAUSE = 92;
|
||||
private static final int BTN_PREVIEW_STOP = 93;
|
||||
|
||||
// ── TextField / Label IDs ─────────────────────────────────────────────────
|
||||
private static final int TF_SEARCH = 55;
|
||||
private static final int TF_SEARCH = 55;
|
||||
private static final int LBL_PREVIEW_STATUS = 90;
|
||||
|
||||
// ── Scroll IDs ────────────────────────────────────────────────────────────
|
||||
private static final int SCROLL_MAIN = 0;
|
||||
private static final int SCROLL_MAIN = 0;
|
||||
|
||||
// ── Confirm dialog IDs ────────────────────────────────────────────────────
|
||||
private static final int CONFIRM_REMOVE_ABILITY = 1;
|
||||
private static final int CONFIRM_REMOVE_CHAIN = 2;
|
||||
private static final int CONFIRM_REMOVE_CHAIN = 2;
|
||||
|
||||
// ==================== DATA ====================
|
||||
private GuiCustomScroll scroll;
|
||||
@@ -474,11 +474,20 @@ public class GuiNpcManageAbilities extends GuiAbilityInterface
|
||||
|
||||
@Override
|
||||
public void subGuiClosed(SubGuiInterface subgui) {
|
||||
if (subgui instanceof SubGuiChainedAbilityConfig) { handleChainConfigClosed(); initGui(); return; }
|
||||
if (subgui instanceof SubGuiAbilityVariantSelect) { if (handleVariantSelectClosed((SubGuiAbilityVariantSelect) subgui)) return; }
|
||||
else if (subgui instanceof SubGuiAbilityTypeSelect) { if (handleTypeSelectClosed((SubGuiAbilityTypeSelect) subgui)) return; }
|
||||
else if (subgui instanceof SubGuiDuplicateNameConfirm) { if (handleDuplicateNameClosed((SubGuiDuplicateNameConfirm) subgui)) return; }
|
||||
else if (pendingSaveAbility != null) { if (handlePendingSave()) return; }
|
||||
if (subgui instanceof SubGuiChainedAbilityConfig) {
|
||||
handleChainConfigClosed();
|
||||
initGui();
|
||||
return;
|
||||
}
|
||||
if (subgui instanceof SubGuiAbilityVariantSelect) {
|
||||
if (handleVariantSelectClosed((SubGuiAbilityVariantSelect) subgui)) return;
|
||||
} else if (subgui instanceof SubGuiAbilityTypeSelect) {
|
||||
if (handleTypeSelectClosed((SubGuiAbilityTypeSelect) subgui)) return;
|
||||
} else if (subgui instanceof SubGuiDuplicateNameConfirm) {
|
||||
if (handleDuplicateNameClosed((SubGuiDuplicateNameConfirm) subgui)) return;
|
||||
} else if (pendingSaveAbility != null) {
|
||||
if (handlePendingSave()) return;
|
||||
}
|
||||
initGui();
|
||||
}
|
||||
|
||||
@@ -491,7 +500,9 @@ public class GuiNpcManageAbilities extends GuiAbilityInterface
|
||||
}
|
||||
}
|
||||
|
||||
/** @return true if a SubGui was opened (caller should return early, skipping initGui) */
|
||||
/**
|
||||
* @return true if a SubGui was opened (caller should return early, skipping initGui)
|
||||
*/
|
||||
private boolean handleVariantSelectClosed(SubGuiAbilityVariantSelect gui) {
|
||||
int idx = gui.getSelectedIndex();
|
||||
if (idx >= 0 && pendingTypeId != null) {
|
||||
@@ -514,7 +525,9 @@ public class GuiNpcManageAbilities extends GuiAbilityInterface
|
||||
return false;
|
||||
}
|
||||
|
||||
/** @return true if a SubGui was opened (caller should return early, skipping initGui) */
|
||||
/**
|
||||
* @return true if a SubGui was opened (caller should return early, skipping initGui)
|
||||
*/
|
||||
private boolean handleTypeSelectClosed(SubGuiAbilityTypeSelect gui) {
|
||||
String typeId = gui.getSelectedTypeId();
|
||||
if (typeId != null) {
|
||||
@@ -542,7 +555,9 @@ public class GuiNpcManageAbilities extends GuiAbilityInterface
|
||||
return false;
|
||||
}
|
||||
|
||||
/** @return true if a SubGui was opened (caller should return early, skipping initGui) */
|
||||
/**
|
||||
* @return true if a SubGui was opened (caller should return early, skipping initGui)
|
||||
*/
|
||||
private boolean handleDuplicateNameClosed(SubGuiDuplicateNameConfirm gui) {
|
||||
if (gui.isConfirmed() && pendingSaveAbility != null) {
|
||||
if (pendingNewCreation) {
|
||||
@@ -569,7 +584,9 @@ public class GuiNpcManageAbilities extends GuiAbilityInterface
|
||||
return false;
|
||||
}
|
||||
|
||||
/** @return true if a SubGui was opened (caller should return early, skipping initGui) */
|
||||
/**
|
||||
* @return true if a SubGui was opened (caller should return early, skipping initGui)
|
||||
*/
|
||||
private boolean handlePendingSave() {
|
||||
if (hasDuplicateName(pendingSaveAbility)) {
|
||||
pendingNewCreation = false;
|
||||
|
||||
@@ -12,20 +12,20 @@ import net.minecraft.util.StatCollector;
|
||||
import net.minecraftforge.event.entity.player.ItemTooltipEvent;
|
||||
import noppes.npcs.client.AuctionClientConfig;
|
||||
import noppes.npcs.constants.EnumClaimType;
|
||||
import noppes.npcs.util.AuctionFormatUtil;
|
||||
import noppes.npcs.containers.ContainerAuctionListing;
|
||||
import noppes.npcs.containers.ContainerAuctionSell;
|
||||
import noppes.npcs.containers.ContainerAuctionTrades;
|
||||
import noppes.npcs.containers.SlotAuctionDisplay;
|
||||
import noppes.npcs.controllers.data.AuctionClaim;
|
||||
import noppes.npcs.controllers.data.AuctionListing;
|
||||
import noppes.npcs.util.AuctionFormatUtil;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Handles adding auction information to item tooltips when viewing auction GUIs.
|
||||
* Called from ItemTooltipEvent in ClientEventHandler.
|
||||
*
|
||||
* <p>
|
||||
* Uses slot-based lookup (slot index) instead of ItemStack comparison to correctly
|
||||
* handle duplicate items with different auction data (e.g., two porkchops at different prices).
|
||||
*/
|
||||
|
||||
@@ -82,7 +82,9 @@ public class GuiAuctionBidding extends GuiAuctionInterface implements ISubGuiLis
|
||||
return -1;
|
||||
}
|
||||
|
||||
/** Update button visibility based on listing state */
|
||||
/**
|
||||
* Update button visibility based on listing state
|
||||
*/
|
||||
private void updateButtonState() {
|
||||
if (listing == null) {
|
||||
if (btnBid != null) btnBid.setVisible(false);
|
||||
@@ -185,7 +187,9 @@ public class GuiAuctionBidding extends GuiAuctionInterface implements ISubGuiLis
|
||||
drawAuctionInfo();
|
||||
}
|
||||
|
||||
/** Draw auction listing information on the right side */
|
||||
/**
|
||||
* Draw auction listing information on the right side
|
||||
*/
|
||||
private void drawAuctionInfo() {
|
||||
int x = guiLeft + infoX;
|
||||
int y = guiTop + infoY;
|
||||
@@ -226,7 +230,7 @@ public class GuiAuctionBidding extends GuiAuctionInterface implements ISubGuiLis
|
||||
|
||||
label = AuctionFormatUtil.formatCurrency(listing.startingPrice);
|
||||
length = fontRendererObj.getStringWidth(label);
|
||||
fontRendererObj.drawString(EnumChatFormatting.GOLD + label, xRight - length, y, 0xFFFFFF);
|
||||
fontRendererObj.drawString(EnumChatFormatting.GOLD + label, xRight - length, y, 0xFFFFFF);
|
||||
y += lineHeight + 4;
|
||||
}
|
||||
|
||||
@@ -237,7 +241,7 @@ public class GuiAuctionBidding extends GuiAuctionInterface implements ISubGuiLis
|
||||
|
||||
label = AuctionFormatUtil.formatCurrency(listing.buyoutPrice);
|
||||
length = fontRendererObj.getStringWidth(label);
|
||||
fontRendererObj.drawString(EnumChatFormatting.GREEN + label, xRight - length, y, 0xFFFFFF);
|
||||
fontRendererObj.drawString(EnumChatFormatting.GREEN + label, xRight - length, y, 0xFFFFFF);
|
||||
y += lineHeight + 4;
|
||||
}
|
||||
|
||||
@@ -306,5 +310,7 @@ public class GuiAuctionBidding extends GuiAuctionInterface implements ISubGuiLis
|
||||
// Block all slot interactions - view only
|
||||
}
|
||||
|
||||
public AuctionListing getListing() { return listing; }
|
||||
public AuctionListing getListing() {
|
||||
return listing;
|
||||
}
|
||||
}
|
||||
@@ -69,7 +69,9 @@ public abstract class GuiAuctionInterface extends GuiContainerNPCInterface {
|
||||
initNavigationButtons();
|
||||
}
|
||||
|
||||
/** Initialize navigation buttons */
|
||||
/**
|
||||
* Initialize navigation buttons
|
||||
*/
|
||||
protected void initNavigationButtons() {
|
||||
int page = getCurrentPage();
|
||||
|
||||
@@ -89,7 +91,9 @@ public abstract class GuiAuctionInterface extends GuiContainerNPCInterface {
|
||||
addButton(btnClaims);
|
||||
}
|
||||
|
||||
/** Returns current page constant - implement in subclass */
|
||||
/**
|
||||
* Returns current page constant - implement in subclass
|
||||
*/
|
||||
protected abstract int getCurrentPage();
|
||||
|
||||
@Override
|
||||
@@ -136,7 +140,9 @@ public abstract class GuiAuctionInterface extends GuiContainerNPCInterface {
|
||||
}
|
||||
}
|
||||
|
||||
/** Draw navigation button tooltips */
|
||||
/**
|
||||
* Draw navigation button tooltips
|
||||
*/
|
||||
protected void drawNavButtonTooltips(int mouseX, int mouseY) {
|
||||
List<String> tooltip = null;
|
||||
if (btnListings != null && btnListings.isHovered()) tooltip = btnListings.getTooltipLines();
|
||||
@@ -154,14 +160,18 @@ public abstract class GuiAuctionInterface extends GuiContainerNPCInterface {
|
||||
|
||||
// ========== Slot Drawing Utilities ==========
|
||||
|
||||
/** Draw auction slot background (18x18) */
|
||||
/**
|
||||
* Draw auction slot background (18x18)
|
||||
*/
|
||||
protected void drawAuctionSlot(int x, int y) {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
mc.renderEngine.bindTexture(AUCTION_SLOT);
|
||||
Gui.func_146110_a(x, y, 0, 0, 18, 18, 18, 18);
|
||||
}
|
||||
|
||||
/** Draw colored overlay on slot (ARGB format) */
|
||||
/**
|
||||
* Draw colored overlay on slot (ARGB format)
|
||||
*/
|
||||
protected void drawColoredOverlay(int x, int y, int color) {
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_DEPTH_TEST);
|
||||
@@ -173,12 +183,16 @@ public abstract class GuiAuctionInterface extends GuiContainerNPCInterface {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
/** Draw dark overlay for unavailable slots */
|
||||
/**
|
||||
* Draw dark overlay for unavailable slots
|
||||
*/
|
||||
protected void drawDarkenedOverlay(int x, int y) {
|
||||
drawColoredOverlay(x, y, OVERLAY_DARK);
|
||||
}
|
||||
|
||||
/** Draw icon texture on slot (16x16) */
|
||||
/**
|
||||
* Draw icon texture on slot (16x16)
|
||||
*/
|
||||
protected void drawIconOverlay(int x, int y, ResourceLocation icon) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
|
||||
@@ -192,7 +206,9 @@ public abstract class GuiAuctionInterface extends GuiContainerNPCInterface {
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
/** Subclasses implement this to draw specific content */
|
||||
/**
|
||||
* Subclasses implement this to draw specific content
|
||||
*/
|
||||
protected abstract void drawAuctionContent(float partialTicks, int mouseX, int mouseY);
|
||||
|
||||
@Override
|
||||
|
||||
@@ -98,12 +98,16 @@ public class GuiAuctionListing extends GuiAuctionInterface implements ISubGuiLis
|
||||
return PAGE_LISTINGS;
|
||||
}
|
||||
|
||||
/** Request listings from server */
|
||||
/**
|
||||
* Request listings from server
|
||||
*/
|
||||
private void requestListings() {
|
||||
AuctionActionPacket.requestListings(filter, currentPage);
|
||||
}
|
||||
|
||||
/** Update pagination button visibility based on current page state */
|
||||
/**
|
||||
* Update pagination button visibility based on current page state
|
||||
*/
|
||||
private void updatePaginationVisibility() {
|
||||
if (btnPageUp != null) {
|
||||
btnPageUp.setVisible(currentPage > 0);
|
||||
@@ -193,7 +197,8 @@ public class GuiAuctionListing extends GuiAuctionInterface implements ISubGuiLis
|
||||
}
|
||||
|
||||
@Override
|
||||
public void subGuiClosed(SubGuiInterface subgui) {}
|
||||
public void subGuiClosed(SubGuiInterface subgui) {
|
||||
}
|
||||
|
||||
// ========== Data Handling ==========
|
||||
|
||||
@@ -294,6 +299,11 @@ public class GuiAuctionListing extends GuiAuctionInterface implements ISubGuiLis
|
||||
// Block other slot interactions
|
||||
}
|
||||
|
||||
public AuctionFilter getFilter() { return filter; }
|
||||
public ContainerAuctionListing getListingContainer() { return listingContainer; }
|
||||
public AuctionFilter getFilter() {
|
||||
return filter;
|
||||
}
|
||||
|
||||
public ContainerAuctionListing getListingContainer() {
|
||||
return listingContainer;
|
||||
}
|
||||
}
|
||||
@@ -7,16 +7,16 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import noppes.npcs.client.AuctionClientConfig;
|
||||
import noppes.npcs.client.NoppesUtil;
|
||||
import noppes.npcs.client.gui.util.GuiAuctionNavButton;
|
||||
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.AuctionClientConfig;
|
||||
import noppes.npcs.containers.ContainerAuctionSell;
|
||||
import noppes.npcs.util.AuctionFormatUtil;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
import noppes.npcs.util.AuctionFormatUtil;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -105,7 +105,9 @@ public class GuiAuctionSell extends GuiAuctionInterface implements ITextfieldLis
|
||||
return PAGE_SELL;
|
||||
}
|
||||
|
||||
/** Update visibility of buyout price field based on toggle state */
|
||||
/**
|
||||
* Update visibility of buyout price field based on toggle state
|
||||
*/
|
||||
private void updateBuyoutVisibility() {
|
||||
if (lblBuyout != null) {
|
||||
lblBuyout.enabled = allowBuyout;
|
||||
@@ -119,7 +121,9 @@ public class GuiAuctionSell extends GuiAuctionInterface implements ITextfieldLis
|
||||
}
|
||||
}
|
||||
|
||||
/** Update the buyout toggle button tooltip */
|
||||
/**
|
||||
* Update the buyout toggle button tooltip
|
||||
*/
|
||||
private void updateBuyoutTooltip() {
|
||||
if (btnAllowBuyout == null) return;
|
||||
|
||||
@@ -252,7 +256,9 @@ public class GuiAuctionSell extends GuiAuctionInterface implements ITextfieldLis
|
||||
drawSellSlotIndicator(slotX, slotY);
|
||||
}
|
||||
|
||||
/** Draw indicator showing staged vs available items */
|
||||
/**
|
||||
* Draw indicator showing staged vs available items
|
||||
*/
|
||||
private void drawSellSlotIndicator(int slotX, int slotY) {
|
||||
ItemStack sellItem = sellContainer.getItemToSell();
|
||||
if (sellItem != null) {
|
||||
@@ -310,7 +316,9 @@ public class GuiAuctionSell extends GuiAuctionInterface implements ITextfieldLis
|
||||
drawSellPageTooltips(mouseX, mouseY);
|
||||
}
|
||||
|
||||
/** Draw tooltips for sell page buttons */
|
||||
/**
|
||||
* Draw tooltips for sell page buttons
|
||||
*/
|
||||
private void drawSellPageTooltips(int mouseX, int mouseY) {
|
||||
List<String> tooltip = null;
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ public class GuiAuctionTrades extends GuiAuctionInterface implements IGuiData {
|
||||
private int pendingSlot = -1;
|
||||
private PendingOp pendingOp = PendingOp.NONE;
|
||||
|
||||
private enum PendingOp { NONE, CANCEL, CLAIM }
|
||||
private enum PendingOp {NONE, CANCEL, CLAIM}
|
||||
|
||||
public GuiAuctionTrades(EntityNPCInterface npc, ContainerAuctionTrades container) {
|
||||
super(npc, container);
|
||||
@@ -117,7 +117,9 @@ public class GuiAuctionTrades extends GuiAuctionInterface implements IGuiData {
|
||||
}
|
||||
}
|
||||
|
||||
/** Handle click on pending operation slot */
|
||||
/**
|
||||
* Handle click on pending operation slot
|
||||
*/
|
||||
private void handlePendingClick(int mouseButton) {
|
||||
if (pendingOp == PendingOp.CANCEL && mouseButton == 1) {
|
||||
// Right-click confirms cancel
|
||||
@@ -159,14 +161,18 @@ public class GuiAuctionTrades extends GuiAuctionInterface implements IGuiData {
|
||||
}
|
||||
}
|
||||
|
||||
/** Set pending operation and hide slot item */
|
||||
/**
|
||||
* Set pending operation and hide slot item
|
||||
*/
|
||||
private void setPending(int slot, PendingOp op) {
|
||||
pendingSlot = slot;
|
||||
pendingOp = op;
|
||||
tradesContainer.setHiddenSlot(slot);
|
||||
}
|
||||
|
||||
/** Clear pending operation and restore slot */
|
||||
/**
|
||||
* Clear pending operation and restore slot
|
||||
*/
|
||||
private void clearPending() {
|
||||
if (pendingSlot >= 0) {
|
||||
tradesContainer.clearHiddenSlot();
|
||||
@@ -175,13 +181,17 @@ public class GuiAuctionTrades extends GuiAuctionInterface implements IGuiData {
|
||||
pendingOp = PendingOp.NONE;
|
||||
}
|
||||
|
||||
/** Play confirmation sound */
|
||||
/**
|
||||
* Play confirmation sound
|
||||
*/
|
||||
private void playConfirmSound() {
|
||||
mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(
|
||||
new ResourceLocation("random.orb"), 1.0F));
|
||||
}
|
||||
|
||||
/** Get slot index at mouse position */
|
||||
/**
|
||||
* Get slot index at mouse position
|
||||
*/
|
||||
private int getSlotAt(int mouseX, int mouseY) {
|
||||
int relX = mouseX - guiLeft - GRID_X;
|
||||
int relY = mouseY - guiTop - GRID_Y;
|
||||
@@ -239,7 +249,9 @@ public class GuiAuctionTrades extends GuiAuctionInterface implements IGuiData {
|
||||
}
|
||||
}
|
||||
|
||||
/** Get tint color for slot based on contents */
|
||||
/**
|
||||
* Get tint color for slot based on contents
|
||||
*/
|
||||
private int getSlotTint(int slot) {
|
||||
AuctionListing listing = tradesContainer.getListingAt(slot);
|
||||
AuctionClaim claim = tradesContainer.getClaimAt(slot);
|
||||
@@ -281,7 +293,9 @@ public class GuiAuctionTrades extends GuiAuctionInterface implements IGuiData {
|
||||
}
|
||||
}
|
||||
|
||||
/** Draw tooltip for a trade slot */
|
||||
/**
|
||||
* Draw tooltip for a trade slot
|
||||
*/
|
||||
private void drawTradeTooltip(int slot, int x, int y) {
|
||||
List<String> tooltip = new ArrayList<>();
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@ import kamkeel.npcs.network.packets.request.animation.AnimationsGetPacket;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import noppes.npcs.client.gui.util.GuiCustomScroll;
|
||||
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.ICustomScrollListener;
|
||||
import noppes.npcs.client.gui.util.IScrollData;
|
||||
|
||||
@@ -19,10 +19,10 @@ import java.util.List;
|
||||
|
||||
/**
|
||||
* Client-side executor for previewing abilities in the GUI.
|
||||
*
|
||||
* <p>
|
||||
* Uses unified execution: calls the REAL ability methods (onWindUpTick, onExecute, onActiveTick)
|
||||
* with previewMode=true. Abilities skip damage/effects/sounds when isPreview() returns true.
|
||||
*
|
||||
* <p>
|
||||
* Lifecycle:
|
||||
* 1. WINDUP phase - real onWindUpTick() called, telegraph shown, entities may spawn
|
||||
* 2. ACTIVE phase - real onExecute() then onActiveTick() called, physics simulated
|
||||
@@ -36,8 +36,11 @@ public class AbilityPreviewExecutor implements PreviewEntityHandler {
|
||||
private Ability previewAbility;
|
||||
private EntityNPCInterface previewNpc;
|
||||
|
||||
/** Executor's own phase tracking (separate from ability.getPhase()) */
|
||||
private enum ExecutorPhase { IDLE, WINDUP, ACTIVE, EXTENDED }
|
||||
/**
|
||||
* Executor's own phase tracking (separate from ability.getPhase())
|
||||
*/
|
||||
private enum ExecutorPhase {IDLE, WINDUP, ACTIVE, EXTENDED}
|
||||
|
||||
private ExecutorPhase executorPhase = ExecutorPhase.IDLE;
|
||||
|
||||
private int currentTick = 0;
|
||||
@@ -424,21 +427,48 @@ public class AbilityPreviewExecutor implements PreviewEntityHandler {
|
||||
|
||||
// ==================== GETTERS ====================
|
||||
|
||||
public boolean isPlaying() { return playing; }
|
||||
public boolean isPaused() { return paused; }
|
||||
public boolean isActive() { return playing || paused; }
|
||||
public boolean isPlaying() {
|
||||
return playing;
|
||||
}
|
||||
|
||||
public boolean isPaused() {
|
||||
return paused;
|
||||
}
|
||||
|
||||
public boolean isActive() {
|
||||
return playing || paused;
|
||||
}
|
||||
|
||||
public AbilityPhase getPhase() {
|
||||
switch (executorPhase) {
|
||||
case WINDUP: return AbilityPhase.WINDUP;
|
||||
case ACTIVE: return AbilityPhase.ACTIVE;
|
||||
default: return AbilityPhase.IDLE;
|
||||
case WINDUP:
|
||||
return AbilityPhase.WINDUP;
|
||||
case ACTIVE:
|
||||
return AbilityPhase.ACTIVE;
|
||||
default:
|
||||
return AbilityPhase.IDLE;
|
||||
}
|
||||
}
|
||||
public int getCurrentTick() { return currentTick; }
|
||||
public TelegraphInstance getTelegraph() { return previewTelegraph; }
|
||||
public List<Entity> getPreviewEntities() { return previewEntities; }
|
||||
public Ability getPreviewAbility() { return previewAbility; }
|
||||
public EntityNPCInterface getPreviewNpc() { return previewNpc; }
|
||||
|
||||
public int getCurrentTick() {
|
||||
return currentTick;
|
||||
}
|
||||
|
||||
public TelegraphInstance getTelegraph() {
|
||||
return previewTelegraph;
|
||||
}
|
||||
|
||||
public List<Entity> getPreviewEntities() {
|
||||
return previewEntities;
|
||||
}
|
||||
|
||||
public Ability getPreviewAbility() {
|
||||
return previewAbility;
|
||||
}
|
||||
|
||||
public EntityNPCInterface getPreviewNpc() {
|
||||
return previewNpc;
|
||||
}
|
||||
|
||||
public String getStatusString() {
|
||||
if (!playing && !paused) {
|
||||
|
||||
@@ -21,7 +21,7 @@ import java.util.List;
|
||||
|
||||
/**
|
||||
* Base GUI class for ability preview with fixed camera.
|
||||
*
|
||||
* <p>
|
||||
* Key concepts:
|
||||
* - NPC positioned on left side of preview area
|
||||
* - NPC faces a fixed direction (NPC_FACING_YAW)
|
||||
@@ -33,15 +33,23 @@ import java.util.List;
|
||||
public class GuiAbilityInterface extends GuiNPCInterface2 {
|
||||
|
||||
// ==================== FIXED CAMERA SETTINGS ====================
|
||||
/** Fixed camera zoom level (higher = more zoomed in) */
|
||||
/**
|
||||
* Fixed camera zoom level (higher = more zoomed in)
|
||||
*/
|
||||
protected static float CAMERA_ZOOM = 45.0f;
|
||||
/** NPC facing direction - affects anchor points and visual facing */
|
||||
/**
|
||||
* NPC facing direction - affects anchor points and visual facing
|
||||
*/
|
||||
protected static float NPC_FACING_YAW = 160.0f;
|
||||
/** Camera pitch (slight downward angle) */
|
||||
/**
|
||||
* Camera pitch (slight downward angle)
|
||||
*/
|
||||
protected static float CAMERA_PITCH = 10.0f;
|
||||
|
||||
// ==================== VIEWING ROTATION ====================
|
||||
/** Viewing direction rotation (rotates entire 3D space) */
|
||||
/**
|
||||
* Viewing direction rotation (rotates entire 3D space)
|
||||
*/
|
||||
protected static float viewRotation = 0.0f;
|
||||
|
||||
private GuiNpcButton btnLeft, btnRight;
|
||||
@@ -49,21 +57,33 @@ public class GuiAbilityInterface extends GuiNPCInterface2 {
|
||||
// ==================== NPC STATE ====================
|
||||
public EntityNPCInterface npc;
|
||||
|
||||
/** NPC starting position (saved when preview starts, used to track movement) */
|
||||
/**
|
||||
* NPC starting position (saved when preview starts, used to track movement)
|
||||
*/
|
||||
protected double npcStartX, npcStartY, npcStartZ;
|
||||
/** Whether we're tracking NPC movement */
|
||||
/**
|
||||
* Whether we're tracking NPC movement
|
||||
*/
|
||||
protected boolean trackingNpcMovement = false;
|
||||
|
||||
/** Entities to render in preview space */
|
||||
/**
|
||||
* Entities to render in preview space
|
||||
*/
|
||||
protected List<Entity> previewEntities = new ArrayList<>();
|
||||
|
||||
/** Current telegraph to render in preview */
|
||||
/**
|
||||
* Current telegraph to render in preview
|
||||
*/
|
||||
protected TelegraphInstance previewTelegraph;
|
||||
|
||||
// ==================== LAYOUT ====================
|
||||
/** Preview area bounds */
|
||||
/**
|
||||
* Preview area bounds
|
||||
*/
|
||||
protected int previewX, previewY, previewWidth, previewHeight;
|
||||
/** NPC render position on screen */
|
||||
/**
|
||||
* NPC render position on screen
|
||||
*/
|
||||
protected int npcScreenX, npcScreenY;
|
||||
|
||||
public int xOffset = 0;
|
||||
@@ -74,7 +94,7 @@ public class GuiAbilityInterface extends GuiNPCInterface2 {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param npc The NPC for preview rendering
|
||||
* @param npc The NPC for preview rendering
|
||||
* @param hasMenuNpc If false, the top menu tabs (Display, Stats, etc.) are hidden.
|
||||
* Use false when opened from the global menu without a real NPC.
|
||||
*/
|
||||
@@ -99,8 +119,8 @@ public class GuiAbilityInterface extends GuiNPCInterface2 {
|
||||
previewHeight = 180;
|
||||
|
||||
// NPC position: left side of preview, slightly below center
|
||||
npcScreenX = previewX + (int)(previewWidth * 0.33f) + xOffset;
|
||||
npcScreenY = previewY + (int)(previewHeight * 0.85f) + yOffset;
|
||||
npcScreenX = previewX + (int) (previewWidth * 0.33f) + xOffset;
|
||||
npcScreenY = previewY + (int) (previewHeight * 0.85f) + yOffset;
|
||||
|
||||
// Viewing rotation buttons (below preview area)
|
||||
int btnY = guiTop + 192;
|
||||
@@ -351,7 +371,7 @@ public class GuiAbilityInterface extends GuiNPCInterface2 {
|
||||
super.drawBackground();
|
||||
|
||||
drawGradientRect(previewX, previewY, previewX + previewWidth, previewY + previewHeight,
|
||||
0xc0101010, 0xd0101010);
|
||||
0xc0101010, 0xd0101010);
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
|
||||
@@ -64,14 +64,14 @@ public class GuiAuctionNavButton extends GuiNpcButton {
|
||||
/**
|
||||
* Create a fully customizable button.
|
||||
*
|
||||
* @param id Button ID
|
||||
* @param x X position
|
||||
* @param y Y position
|
||||
* @param buttonSize Size of the button background texture (e.g., 18 for 18x18, 10 for 10x10)
|
||||
* @param iconSize Size of the icon texture (e.g., 16 for 16x16, 8 for 8x8)
|
||||
* @param tooltipKey Lang key for tooltip
|
||||
* @param iconTexture Icon texture to draw inside the button
|
||||
* @param textureNormal Background texture for normal state
|
||||
* @param id Button ID
|
||||
* @param x X position
|
||||
* @param y Y position
|
||||
* @param buttonSize Size of the button background texture (e.g., 18 for 18x18, 10 for 10x10)
|
||||
* @param iconSize Size of the icon texture (e.g., 16 for 16x16, 8 for 8x8)
|
||||
* @param tooltipKey Lang key for tooltip
|
||||
* @param iconTexture Icon texture to draw inside the button
|
||||
* @param textureNormal Background texture for normal state
|
||||
* @param texturePressed Background texture for pressed/hover state
|
||||
*/
|
||||
public GuiAuctionNavButton(int id, int x, int y, int buttonSize, int iconSize, String tooltipKey,
|
||||
|
||||
@@ -4,29 +4,29 @@ package noppes.npcs.client.gui.util;
|
||||
* Abstract base class for fullscreen directory-browsing GUIs.
|
||||
* Provides a configurable three-panel layout (left nav, center content, right actions)
|
||||
* with percentage-based sizing, panel backgrounds/borders, and an optional resizable divider.
|
||||
*
|
||||
* <p>
|
||||
* Subclasses override abstract hooks to populate each panel region.
|
||||
* Designed for reuse across Cloner, Quest Manager, Dialog Manager, etc.
|
||||
*/
|
||||
public abstract class GuiDirectory extends GuiNPCInterface implements ICustomScrollListener, ISubGuiListener {
|
||||
|
||||
// ===== LAYOUT CONFIG (subclasses may override in constructor) =====
|
||||
protected float leftPanelPercent = 0.20f;
|
||||
protected float leftPanelPercent = 0.20f;
|
||||
protected float rightPanelPercent = 0.10f;
|
||||
protected int minLeftPanelW = 80;
|
||||
protected int minLeftPanelW = 80;
|
||||
protected int minRightPanelW = 40;
|
||||
protected int minCenterW = 100;
|
||||
protected int minCenterW = 100;
|
||||
|
||||
// ===== LAYOUT CONSTANTS =====
|
||||
protected int pad = 10;
|
||||
protected int pad = 10;
|
||||
protected int topBarH = 24;
|
||||
protected int gap = 4;
|
||||
protected int btnH = 20;
|
||||
protected int gap = 4;
|
||||
protected int btnH = 20;
|
||||
|
||||
// ===== PANEL COLORS =====
|
||||
protected int panelBg = 0xC0101010;
|
||||
protected int panelBg = 0xC0101010;
|
||||
protected int panelBorder = 0xFF333333;
|
||||
protected int topBarBg = 0xC0181818;
|
||||
protected int topBarBg = 0xC0181818;
|
||||
|
||||
// ===== COMPUTED LAYOUT (populated by computeLayout) =====
|
||||
protected int originX, originY, usableW, usableH;
|
||||
@@ -35,10 +35,10 @@ public abstract class GuiDirectory extends GuiNPCInterface implements ICustomScr
|
||||
protected int rightX;
|
||||
|
||||
// ===== OPTIONAL RESIZABLE DIVIDER (between left and center) =====
|
||||
protected boolean enableDivider = false;
|
||||
protected int dividerWidth = 5;
|
||||
protected int dividerLineHeight = 20;
|
||||
protected int minDividerPanelW = 50;
|
||||
protected boolean enableDivider = false;
|
||||
protected int dividerWidth = 5;
|
||||
protected int dividerLineHeight = 20;
|
||||
protected int minDividerPanelW = 50;
|
||||
private int dividerOffset;
|
||||
private boolean isDragging = false;
|
||||
private int dragStartX;
|
||||
@@ -57,8 +57,8 @@ public abstract class GuiDirectory extends GuiNPCInterface implements ICustomScr
|
||||
usableW = width - 2 * pad;
|
||||
usableH = height - 2 * pad;
|
||||
|
||||
leftPanelW = Math.max(minLeftPanelW, (int)(usableW * leftPanelPercent));
|
||||
rightPanelW = Math.max(minRightPanelW, (int)(usableW * rightPanelPercent));
|
||||
leftPanelW = Math.max(minLeftPanelW, (int) (usableW * leftPanelPercent));
|
||||
rightPanelW = Math.max(minRightPanelW, (int) (usableW * rightPanelPercent));
|
||||
|
||||
if (rightPanelPercent <= 0) {
|
||||
rightPanelW = 0;
|
||||
@@ -73,7 +73,7 @@ public abstract class GuiDirectory extends GuiNPCInterface implements ICustomScr
|
||||
contentX = originX + leftPanelW + gap;
|
||||
contentY = originY + topBarH + gap;
|
||||
contentH = usableH - topBarH - gap;
|
||||
rightX = contentX + contentW + gap;
|
||||
rightX = contentX + contentW + gap;
|
||||
|
||||
if (enableDivider && dividerOffset == 0) {
|
||||
dividerOffset = leftPanelW;
|
||||
@@ -128,7 +128,9 @@ public abstract class GuiDirectory extends GuiNPCInterface implements ICustomScr
|
||||
drawRect(divX + 1, handleTop, divX + dividerWidth - 1, handleTop + dividerLineHeight, 0xFF707070);
|
||||
}
|
||||
|
||||
/** Override for extra drawing after super.drawScreen (e.g. status text) */
|
||||
/**
|
||||
* Override for extra drawing after super.drawScreen (e.g. status text)
|
||||
*/
|
||||
protected void drawOverlay(int mouseX, int mouseY, float partialTicks) {
|
||||
}
|
||||
|
||||
@@ -177,7 +179,9 @@ public abstract class GuiDirectory extends GuiNPCInterface implements ICustomScr
|
||||
super.mouseMovedOrUp(mouseX, mouseY, state);
|
||||
}
|
||||
|
||||
/** Called when divider is dragged. Override to update scroll sizes. */
|
||||
/**
|
||||
* Called when divider is dragged. Override to update scroll sizes.
|
||||
*/
|
||||
protected void onDividerMoved(int newOffset) {
|
||||
}
|
||||
|
||||
@@ -192,15 +196,23 @@ public abstract class GuiDirectory extends GuiNPCInterface implements ICustomScr
|
||||
|
||||
// ===== ABSTRACT HOOKS (subclass must implement) =====
|
||||
|
||||
/** Populate top bar buttons. topBtnY is the y-coordinate for the button row. */
|
||||
/**
|
||||
* Populate top bar buttons. topBtnY is the y-coordinate for the button row.
|
||||
*/
|
||||
protected abstract void initTopBar(int topBtnY);
|
||||
|
||||
/** Populate the left navigation panel (scrolls, search fields, buttons). */
|
||||
/**
|
||||
* Populate the left navigation panel (scrolls, search fields, buttons).
|
||||
*/
|
||||
protected abstract void initLeftPanel();
|
||||
|
||||
/** Populate the center content panel (main scroll list). */
|
||||
/**
|
||||
* Populate the center content panel (main scroll list).
|
||||
*/
|
||||
protected abstract void initCenterPanel();
|
||||
|
||||
/** Populate the right action panel. startY is the first button y-coordinate. */
|
||||
/**
|
||||
* Populate the right action panel. startY is the first button y-coordinate.
|
||||
*/
|
||||
protected abstract void initRightPanel(int startY);
|
||||
}
|
||||
@@ -34,7 +34,7 @@ public class GuiModelInterface2 extends GuiNPCInterface2 {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param npc The NPC for preview rendering
|
||||
* @param npc The NPC for preview rendering
|
||||
* @param hasMenuNpc If false, the top menu tabs (Display, Stats, etc.) are hidden.
|
||||
* Use false when opened from the global menu without a real NPC.
|
||||
*/
|
||||
|
||||
@@ -60,12 +60,13 @@ public class GuiNpcLabel extends Gui {
|
||||
|
||||
/**
|
||||
* 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 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
|
||||
* @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;
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
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.GuiScreen;
|
||||
import net.minecraft.client.gui.GuiTextField;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import kamkeel.npcs.util.TextSplitter;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Iterator;
|
||||
|
||||
public class GuiNpcTextField extends GuiTextField {
|
||||
public boolean enabled = true;
|
||||
@@ -224,7 +224,7 @@ public class GuiNpcTextField extends GuiTextField {
|
||||
|
||||
public boolean isMouseOver(int mouseX, int mouseY) {
|
||||
return mouseX >= xPosition && mouseX < xPosition + width &&
|
||||
mouseY >= yPosition && mouseY < yPosition + height;
|
||||
mouseY >= yPosition && mouseY < yPosition + height;
|
||||
}
|
||||
|
||||
public void drawHover(int mouseX, int mouseY, boolean hasSubGui) {
|
||||
@@ -334,14 +334,14 @@ public class GuiNpcTextField extends GuiTextField {
|
||||
}
|
||||
|
||||
protected void drawGradientRect(int left, int top, int right, int bottom, int startColor, int endColor, int zLevel) {
|
||||
float f = (float)(startColor >> 24 & 255) / 255.0F;
|
||||
float f1 = (float)(startColor >> 16 & 255) / 255.0F;
|
||||
float f2 = (float)(startColor >> 8 & 255) / 255.0F;
|
||||
float f3 = (float)(startColor & 255) / 255.0F;
|
||||
float f4 = (float)(endColor >> 24 & 255) / 255.0F;
|
||||
float f5 = (float)(endColor >> 16 & 255) / 255.0F;
|
||||
float f6 = (float)(endColor >> 8 & 255) / 255.0F;
|
||||
float f7 = (float)(endColor & 255) / 255.0F;
|
||||
float f = (float) (startColor >> 24 & 255) / 255.0F;
|
||||
float f1 = (float) (startColor >> 16 & 255) / 255.0F;
|
||||
float f2 = (float) (startColor >> 8 & 255) / 255.0F;
|
||||
float f3 = (float) (startColor & 255) / 255.0F;
|
||||
float f4 = (float) (endColor >> 24 & 255) / 255.0F;
|
||||
float f5 = (float) (endColor >> 16 & 255) / 255.0F;
|
||||
float f6 = (float) (endColor >> 8 & 255) / 255.0F;
|
||||
float f7 = (float) (endColor & 255) / 255.0F;
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glDisable(GL11.GL_ALPHA_TEST);
|
||||
@@ -350,11 +350,11 @@ public class GuiNpcTextField extends GuiTextField {
|
||||
net.minecraft.client.renderer.Tessellator tessellator = net.minecraft.client.renderer.Tessellator.instance;
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setColorRGBA_F(f1, f2, f3, f);
|
||||
tessellator.addVertex((double)right, (double)top, (double)zLevel);
|
||||
tessellator.addVertex((double)left, (double)top, (double)zLevel);
|
||||
tessellator.addVertex((double) right, (double) top, (double) zLevel);
|
||||
tessellator.addVertex((double) left, (double) top, (double) zLevel);
|
||||
tessellator.setColorRGBA_F(f5, f6, f7, f4);
|
||||
tessellator.addVertex((double)left, (double)bottom, (double)zLevel);
|
||||
tessellator.addVertex((double)right, (double)bottom, (double)zLevel);
|
||||
tessellator.addVertex((double) left, (double) bottom, (double) zLevel);
|
||||
tessellator.addVertex((double) right, (double) bottom, (double) zLevel);
|
||||
tessellator.draw();
|
||||
GL11.glShadeModel(GL11.GL_FLAT);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
|
||||
@@ -8,6 +8,8 @@ import java.util.UUID;
|
||||
|
||||
public interface IClonerGui {
|
||||
int getShowingClones();
|
||||
|
||||
HashMap<UUID, Tag> getTags();
|
||||
|
||||
TagMap getTagMap();
|
||||
}
|
||||
@@ -135,11 +135,11 @@ public class ConfigMarket {
|
||||
// =========================================
|
||||
config.setCategoryComment(AUCTION_BLACKLIST,
|
||||
"Item Blacklist settings for the Auction House.\n" +
|
||||
"Prevents specific items, mods, or items with certain NBT tags from being listed.\n\n" +
|
||||
"ITEM FORMAT: Use 'modid:itemname' format (e.g., 'minecraft:bedrock', 'customnpcs:npcWand')\n" +
|
||||
"WILDCARDS: Use * for wildcards (e.g., 'customnpcs:npc*' blocks all items starting with 'npc')\n" +
|
||||
"MOD FORMAT: Use just the mod ID (e.g., 'projecte' blocks all items from that mod)\n" +
|
||||
"NBT FORMAT: Use the NBT tag key name (e.g., 'AdminOnly' blocks items with that tag)");
|
||||
"Prevents specific items, mods, or items with certain NBT tags from being listed.\n\n" +
|
||||
"ITEM FORMAT: Use 'modid:itemname' format (e.g., 'minecraft:bedrock', 'customnpcs:npcWand')\n" +
|
||||
"WILDCARDS: Use * for wildcards (e.g., 'customnpcs:npc*' blocks all items starting with 'npc')\n" +
|
||||
"MOD FORMAT: Use just the mod ID (e.g., 'projecte' blocks all items from that mod)\n" +
|
||||
"NBT FORMAT: Use the NBT tag key name (e.g., 'AdminOnly' blocks items with that tag)");
|
||||
|
||||
BlacklistEnabled = config.get(AUCTION_BLACKLIST, "Enable Blacklist", true,
|
||||
"Enable item blacklist checking when creating listings").getBoolean(true);
|
||||
@@ -157,17 +157,17 @@ public class ConfigMarket {
|
||||
"customnpcs:npcSoulstoneFilled"
|
||||
},
|
||||
"Items that cannot be listed on the Auction House.\n" +
|
||||
"Format: modid:itemname (supports * wildcards)\n" +
|
||||
"Example: 'minecraft:diamond_sword' or 'customnpcs:npc*'").getStringList();
|
||||
"Format: modid:itemname (supports * wildcards)\n" +
|
||||
"Example: 'minecraft:diamond_sword' or 'customnpcs:npc*'").getStringList();
|
||||
|
||||
BlacklistedMods = config.get(AUCTION_BLACKLIST, "Blacklisted Mods", new String[]{},
|
||||
"All items from these mods are blocked from the Auction House.\n" +
|
||||
"Format: modid (e.g., 'projecte', 'thaumcraft')").getStringList();
|
||||
"Format: modid (e.g., 'projecte', 'thaumcraft')").getStringList();
|
||||
|
||||
BlacklistedNBTTags = config.get(AUCTION_BLACKLIST, "Blacklisted NBT Tags", new String[]{},
|
||||
"Items containing any of these NBT tag keys are blocked.\n" +
|
||||
"Checks the root level of the item's NBT compound.\n" +
|
||||
"Example: 'AdminOnly', 'CreativeMode'").getStringList();
|
||||
"Checks the root level of the item's NBT compound.\n" +
|
||||
"Example: 'AdminOnly', 'CreativeMode'").getStringList();
|
||||
|
||||
// =========================================
|
||||
// Auction Logging Settings
|
||||
|
||||
@@ -16,19 +16,29 @@ public enum EnumAuctionLogAction {
|
||||
CLAIMED,
|
||||
CLAIM_EXPIRED;
|
||||
|
||||
/** Check if this action should be logged based on config settings */
|
||||
/**
|
||||
* Check if this action should be logged based on config settings
|
||||
*/
|
||||
public boolean shouldLog() {
|
||||
if (!ConfigMarket.AuctionLoggingEnabled) return false;
|
||||
switch (this) {
|
||||
case CREATED: return ConfigMarket.LogAuctionCreated;
|
||||
case BID: return ConfigMarket.LogAuctionBid;
|
||||
case BUYOUT: return ConfigMarket.LogAuctionBuyout;
|
||||
case SOLD: return ConfigMarket.LogAuctionSold;
|
||||
case EXPIRED: return ConfigMarket.LogAuctionExpired;
|
||||
case CANCELLED: return ConfigMarket.LogAuctionCancelled;
|
||||
case CREATED:
|
||||
return ConfigMarket.LogAuctionCreated;
|
||||
case BID:
|
||||
return ConfigMarket.LogAuctionBid;
|
||||
case BUYOUT:
|
||||
return ConfigMarket.LogAuctionBuyout;
|
||||
case SOLD:
|
||||
return ConfigMarket.LogAuctionSold;
|
||||
case EXPIRED:
|
||||
return ConfigMarket.LogAuctionExpired;
|
||||
case CANCELLED:
|
||||
return ConfigMarket.LogAuctionCancelled;
|
||||
case CLAIMED:
|
||||
case CLAIM_EXPIRED: return ConfigMarket.LogAuctionClaimed;
|
||||
default: return false;
|
||||
case CLAIM_EXPIRED:
|
||||
return ConfigMarket.LogAuctionClaimed;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,5 @@
|
||||
package noppes.npcs.constants;
|
||||
|
||||
import noppes.npcs.constants.EnumGuiType;
|
||||
|
||||
/**
|
||||
* Enum for auction GUI page navigation.
|
||||
* Maps page indices to GUI types for packet-based navigation.
|
||||
|
||||
@@ -71,6 +71,7 @@ public class ContainerAuction extends ContainerNpcInterface {
|
||||
|
||||
/**
|
||||
* Get the ItemStack in a player inventory slot.
|
||||
*
|
||||
* @param containerSlotIndex The container slot index (0-35 for player inv)
|
||||
*/
|
||||
public ItemStack getPlayerInventoryStack(int containerSlotIndex) {
|
||||
|
||||
@@ -28,9 +28,14 @@ public class ContainerAuctionBidding extends ContainerAuction {
|
||||
// Display slot (read-only)
|
||||
addSlotToContainer(new Slot(displayInventory, 0, ITEM_SLOT_X, ITEM_SLOT_Y) {
|
||||
@Override
|
||||
public boolean isItemValid(ItemStack stack) { return false; }
|
||||
public boolean isItemValid(ItemStack stack) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canTakeStack(EntityPlayer player) { return false; }
|
||||
public boolean canTakeStack(EntityPlayer player) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -27,9 +27,14 @@ public class ContainerAuctionSell extends ContainerAuction {
|
||||
// Sell slot blocks direct interaction
|
||||
addSlotToContainer(new Slot(sellInventory, 0, SELL_SLOT_X, SELL_SLOT_Y) {
|
||||
@Override
|
||||
public boolean isItemValid(ItemStack stack) { return false; }
|
||||
public boolean isItemValid(ItemStack stack) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canTakeStack(EntityPlayer player) { return false; }
|
||||
public boolean canTakeStack(EntityPlayer player) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -44,8 +49,9 @@ public class ContainerAuctionSell extends ContainerAuction {
|
||||
/**
|
||||
* Add items from inventory to sell slot.
|
||||
* Not limited by inventory - just stages items for sale. Validation on submit.
|
||||
*
|
||||
* @param sourceSlot Inventory slot index
|
||||
* @param fullStack True=full stack, False=1 item
|
||||
* @param fullStack True=full stack, False=1 item
|
||||
*/
|
||||
public void addToSellSlot(int sourceSlot, boolean fullStack) {
|
||||
if (!isPlayerInventorySlot(sourceSlot)) return;
|
||||
@@ -78,6 +84,7 @@ public class ContainerAuctionSell extends ContainerAuction {
|
||||
|
||||
/**
|
||||
* Remove items from sell slot.
|
||||
*
|
||||
* @param removeAll True=clear slot, False=remove 1 item
|
||||
*/
|
||||
public void removeFromSellSlot(boolean removeAll) {
|
||||
@@ -91,12 +98,16 @@ public class ContainerAuctionSell extends ContainerAuction {
|
||||
}
|
||||
}
|
||||
|
||||
/** Check if sell slot is this container slot index */
|
||||
/**
|
||||
* Check if sell slot is this container slot index
|
||||
*/
|
||||
public boolean isSellSlot(int slotIndex) {
|
||||
return slotIndex == SELL_SLOT_INDEX;
|
||||
}
|
||||
|
||||
/** Check if two stacks match using NoppesUtilPlayer.compareItems (same item, damage, and NBT) */
|
||||
/**
|
||||
* Check if two stacks match using NoppesUtilPlayer.compareItems (same item, damage, and NBT)
|
||||
*/
|
||||
private boolean itemsMatch(ItemStack a, ItemStack b) {
|
||||
return NoppesUtilPlayer.compareItems(a, b, false, false);
|
||||
}
|
||||
|
||||
@@ -5,8 +5,8 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import noppes.npcs.constants.EnumClaimType;
|
||||
import noppes.npcs.controllers.AuctionController;
|
||||
import noppes.npcs.constants.EnumTradeSlotType;
|
||||
import noppes.npcs.controllers.AuctionController;
|
||||
import noppes.npcs.controllers.data.AuctionClaim;
|
||||
import noppes.npcs.controllers.data.AuctionListing;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
@@ -55,7 +55,9 @@ public class ContainerAuctionTrades extends ContainerAuction {
|
||||
refreshData();
|
||||
}
|
||||
|
||||
/** Refresh data from controller (server-side only) */
|
||||
/**
|
||||
* Refresh data from controller (server-side only)
|
||||
*/
|
||||
public void refreshData() {
|
||||
// Clear existing data
|
||||
clearData();
|
||||
@@ -70,7 +72,9 @@ public class ContainerAuctionTrades extends ContainerAuction {
|
||||
populateDisplay(newListings, newBids, newClaims);
|
||||
}
|
||||
|
||||
/** Set data from NBT received from server (client-side) */
|
||||
/**
|
||||
* Set data from NBT received from server (client-side)
|
||||
*/
|
||||
public void setTradesData(NBTTagCompound compound) {
|
||||
// Clear existing data
|
||||
clearData();
|
||||
@@ -111,7 +115,9 @@ public class ContainerAuctionTrades extends ContainerAuction {
|
||||
populateDisplay(newListings, newBids, newClaims);
|
||||
}
|
||||
|
||||
/** Clear all data and reset display */
|
||||
/**
|
||||
* Clear all data and reset display
|
||||
*/
|
||||
private void clearData() {
|
||||
activeListings.clear();
|
||||
activeBids.clear();
|
||||
@@ -125,7 +131,9 @@ public class ContainerAuctionTrades extends ContainerAuction {
|
||||
}
|
||||
}
|
||||
|
||||
/** Populate display from provided data lists */
|
||||
/**
|
||||
* Populate display from provided data lists
|
||||
*/
|
||||
private void populateDisplay(List<AuctionListing> newListings, List<AuctionListing> newBids, List<AuctionClaim> allClaims) {
|
||||
activeListings = new ArrayList<>(newListings);
|
||||
activeBids = new ArrayList<>(newBids);
|
||||
@@ -218,7 +226,9 @@ public class ContainerAuctionTrades extends ContainerAuction {
|
||||
|
||||
// ========== Slot Data Accessors ==========
|
||||
|
||||
/** Get listing at slot (or null if claim/empty) */
|
||||
/**
|
||||
* Get listing at slot (or null if claim/empty)
|
||||
*/
|
||||
public AuctionListing getListingAt(int slot) {
|
||||
if (slot < 0 || slot >= SLOT_COUNT) return null;
|
||||
EnumTradeSlotType type = slotTypes[slot];
|
||||
@@ -233,7 +243,9 @@ public class ContainerAuctionTrades extends ContainerAuction {
|
||||
return null;
|
||||
}
|
||||
|
||||
/** Get claim at slot (or null if listing/empty) */
|
||||
/**
|
||||
* Get claim at slot (or null if listing/empty)
|
||||
*/
|
||||
public AuctionClaim getClaimAt(int slot) {
|
||||
if (slot < 0 || slot >= SLOT_COUNT) return null;
|
||||
if (slotTypes[slot] == EnumTradeSlotType.CLAIM) {
|
||||
@@ -245,17 +257,23 @@ public class ContainerAuctionTrades extends ContainerAuction {
|
||||
return null;
|
||||
}
|
||||
|
||||
/** Check if slot is player's active listing */
|
||||
/**
|
||||
* Check if slot is player's active listing
|
||||
*/
|
||||
public boolean isSellingAt(int slot) {
|
||||
return slot >= 0 && slot < SLOT_COUNT && slotTypes[slot] == EnumTradeSlotType.SELLING;
|
||||
}
|
||||
|
||||
/** Check if slot is player's active bid */
|
||||
/**
|
||||
* Check if slot is player's active bid
|
||||
*/
|
||||
public boolean isBiddingAt(int slot) {
|
||||
return slot >= 0 && slot < SLOT_COUNT && slotTypes[slot] == EnumTradeSlotType.BIDDING;
|
||||
}
|
||||
|
||||
/** Find listing matching item (searches both selling and bidding) */
|
||||
/**
|
||||
* Find listing matching item (searches both selling and bidding)
|
||||
*/
|
||||
public AuctionListing getListingForItem(ItemStack stack) {
|
||||
if (stack == null) return null;
|
||||
for (AuctionListing listing : activeListings) {
|
||||
@@ -267,7 +285,9 @@ public class ContainerAuctionTrades extends ContainerAuction {
|
||||
return null;
|
||||
}
|
||||
|
||||
/** Find listing in selling list */
|
||||
/**
|
||||
* Find listing in selling list
|
||||
*/
|
||||
public AuctionListing getSellingListingForItem(ItemStack stack) {
|
||||
if (stack == null) return null;
|
||||
for (AuctionListing listing : activeListings) {
|
||||
@@ -276,7 +296,9 @@ public class ContainerAuctionTrades extends ContainerAuction {
|
||||
return null;
|
||||
}
|
||||
|
||||
/** Find listing in bidding list */
|
||||
/**
|
||||
* Find listing in bidding list
|
||||
*/
|
||||
public AuctionListing getBiddingListingForItem(ItemStack stack) {
|
||||
if (stack == null) return null;
|
||||
for (AuctionListing bid : activeBids) {
|
||||
@@ -285,7 +307,9 @@ public class ContainerAuctionTrades extends ContainerAuction {
|
||||
return null;
|
||||
}
|
||||
|
||||
/** Find claim matching item */
|
||||
/**
|
||||
* Find claim matching item
|
||||
*/
|
||||
public AuctionClaim getClaimForItem(ItemStack stack) {
|
||||
if (stack == null) return null;
|
||||
for (AuctionClaim claim : claims) {
|
||||
@@ -296,14 +320,27 @@ public class ContainerAuctionTrades extends ContainerAuction {
|
||||
|
||||
// ========== List Getters ==========
|
||||
|
||||
public List<AuctionListing> getActiveListings() { return activeListings; }
|
||||
public List<AuctionListing> getActiveBids() { return activeBids; }
|
||||
public List<AuctionClaim> getClaims() { return claims; }
|
||||
public int getTotalTradeCount() { return activeListings.size() + activeBids.size() + claims.size(); }
|
||||
public List<AuctionListing> getActiveListings() {
|
||||
return activeListings;
|
||||
}
|
||||
|
||||
public List<AuctionListing> getActiveBids() {
|
||||
return activeBids;
|
||||
}
|
||||
|
||||
public List<AuctionClaim> getClaims() {
|
||||
return claims;
|
||||
}
|
||||
|
||||
public int getTotalTradeCount() {
|
||||
return activeListings.size() + activeBids.size() + claims.size();
|
||||
}
|
||||
|
||||
// ========== Slot Hiding (for pending operations) ==========
|
||||
|
||||
/** Hide slot for pending operation display */
|
||||
/**
|
||||
* Hide slot for pending operation display
|
||||
*/
|
||||
public void setHiddenSlot(int slot) {
|
||||
if (hiddenSlot >= 0 && hiddenSlot < SLOT_COUNT) {
|
||||
restoreSlotItem(hiddenSlot);
|
||||
@@ -314,7 +351,9 @@ public class ContainerAuctionTrades extends ContainerAuction {
|
||||
}
|
||||
}
|
||||
|
||||
/** Restore hidden slot */
|
||||
/**
|
||||
* Restore hidden slot
|
||||
*/
|
||||
public void clearHiddenSlot() {
|
||||
if (hiddenSlot >= 0 && hiddenSlot < SLOT_COUNT) {
|
||||
restoreSlotItem(hiddenSlot);
|
||||
@@ -322,7 +361,9 @@ public class ContainerAuctionTrades extends ContainerAuction {
|
||||
hiddenSlot = -1;
|
||||
}
|
||||
|
||||
/** Restore item at slot from data using slot tracking */
|
||||
/**
|
||||
* Restore item at slot from data using slot tracking
|
||||
*/
|
||||
private void restoreSlotItem(int slot) {
|
||||
if (slot < 0 || slot >= SLOT_COUNT) return;
|
||||
|
||||
@@ -348,8 +389,14 @@ public class ContainerAuctionTrades extends ContainerAuction {
|
||||
}
|
||||
}
|
||||
|
||||
public int getHiddenSlot() { return hiddenSlot; }
|
||||
public int getHiddenSlot() {
|
||||
return hiddenSlot;
|
||||
}
|
||||
|
||||
/** Get player's max trade slots (synced from server based on permissions) */
|
||||
public int getMaxTradeSlots() { return maxTradeSlots; }
|
||||
/**
|
||||
* Get player's max trade slots (synced from server based on permissions)
|
||||
*/
|
||||
public int getMaxTradeSlots() {
|
||||
return maxTradeSlots;
|
||||
}
|
||||
}
|
||||
@@ -22,14 +22,17 @@ import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.URL;
|
||||
import java.nio.file.FileSystem;
|
||||
import java.nio.file.FileSystems;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Stream;
|
||||
import java.util.zip.GZIPInputStream;
|
||||
|
||||
@@ -364,6 +367,7 @@ public class AnimationController implements IAnimationHandler {
|
||||
|
||||
/**
|
||||
* Get a built-in animation by name.
|
||||
*
|
||||
* @param name The animation name (case-insensitive)
|
||||
* @return The built-in animation, or null if not found
|
||||
*/
|
||||
@@ -395,6 +399,7 @@ public class AnimationController implements IAnimationHandler {
|
||||
|
||||
/**
|
||||
* Check if an animation name is a built-in animation.
|
||||
*
|
||||
* @param name The animation name to check
|
||||
* @return true if this is a built-in animation
|
||||
*/
|
||||
|
||||
@@ -7,7 +7,7 @@ import noppes.npcs.config.ConfigMarket;
|
||||
/**
|
||||
* Server-side utility for syncing auction configuration to clients.
|
||||
* Handles Vault integration for currency name resolution.
|
||||
*
|
||||
* <p>
|
||||
* This class is SERVER-SIDE ONLY. Client reads via AuctionClientConfig.
|
||||
*/
|
||||
public class AuctionConfigSync {
|
||||
@@ -15,7 +15,7 @@ public class AuctionConfigSync {
|
||||
/**
|
||||
* Write auction config to NBT for sending to client.
|
||||
* Called on server side when building login packet.
|
||||
*
|
||||
* <p>
|
||||
* Currency name is resolved from Vault if enabled and available,
|
||||
* otherwise falls back to ConfigMarket.CurrencyName.
|
||||
*/
|
||||
|
||||
@@ -6,7 +6,6 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompressedStreamTools;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import noppes.npcs.CustomNpcs;
|
||||
@@ -23,12 +22,12 @@ import noppes.npcs.constants.EnumAuctionSort;
|
||||
import noppes.npcs.constants.EnumAuctionStatus;
|
||||
import noppes.npcs.constants.EnumClaimType;
|
||||
import noppes.npcs.constants.EnumNotificationType;
|
||||
import noppes.npcs.controllers.data.PlayerDataScript;
|
||||
import noppes.npcs.controllers.data.AuctionBlacklist;
|
||||
import noppes.npcs.controllers.data.AuctionClaim;
|
||||
import noppes.npcs.controllers.data.AuctionFilter;
|
||||
import noppes.npcs.controllers.data.AuctionListing;
|
||||
import noppes.npcs.controllers.data.PlayerData;
|
||||
import noppes.npcs.controllers.data.PlayerDataScript;
|
||||
import noppes.npcs.controllers.data.PlayerTradeData;
|
||||
import noppes.npcs.scripted.NpcAPI;
|
||||
import noppes.npcs.scripted.event.player.AuctionEvent;
|
||||
@@ -37,18 +36,23 @@ import noppes.npcs.util.CustomNPCsThreader;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
/**
|
||||
* Main controller for the Auction system.
|
||||
*
|
||||
* <p>
|
||||
* Thread Safety:
|
||||
* - Uses ConcurrentHashMap for all data stores - no locking required
|
||||
* - Claims are stored in PlayerData, not here - reduces contention
|
||||
* - Saves are performed asynchronously on the CNPC+ thread
|
||||
*
|
||||
* <p>
|
||||
* Performance:
|
||||
* - Auction processing runs every 30 seconds (600 ticks)
|
||||
* - Save interval is every 30 seconds (600 ticks)
|
||||
@@ -65,29 +69,41 @@ public class AuctionController implements IAuctionHandler {
|
||||
// Player Indices for O(1) Lookups
|
||||
// =========================================
|
||||
|
||||
/** Listings by seller UUID - for quick "my listings" lookups */
|
||||
/**
|
||||
* Listings by seller UUID - for quick "my listings" lookups
|
||||
*/
|
||||
private final Map<UUID, Set<String>> playerListingIds = new ConcurrentHashMap<>();
|
||||
|
||||
/** Listings where player is current high bidder */
|
||||
/**
|
||||
* Listings where player is current high bidder
|
||||
*/
|
||||
private final Map<UUID, Set<String>> playerBidIds = new ConcurrentHashMap<>();
|
||||
|
||||
/** Cached max trade slots per player - computed on login, cleared on logout */
|
||||
/**
|
||||
* Cached max trade slots per player - computed on login, cleared on logout
|
||||
*/
|
||||
private final Map<UUID, Integer> playerMaxTradesCache = new ConcurrentHashMap<>();
|
||||
|
||||
// =========================================
|
||||
// Threading & State
|
||||
// =========================================
|
||||
|
||||
/** Flag indicating data needs to be saved */
|
||||
/**
|
||||
* Flag indicating data needs to be saved
|
||||
*/
|
||||
private final AtomicBoolean dirty = new AtomicBoolean(false);
|
||||
|
||||
/** Flag to prevent concurrent saves */
|
||||
/**
|
||||
* Flag to prevent concurrent saves
|
||||
*/
|
||||
private final AtomicBoolean saving = new AtomicBoolean(false);
|
||||
|
||||
private String filePath = "";
|
||||
private int tickCounter = 0;
|
||||
|
||||
/** Process auctions and save every 30 seconds (600 ticks) */
|
||||
/**
|
||||
* Process auctions and save every 30 seconds (600 ticks)
|
||||
*/
|
||||
private static final int TICK_INTERVAL = 600;
|
||||
|
||||
public AuctionController() {
|
||||
@@ -375,7 +391,7 @@ public class AuctionController implements IAuctionHandler {
|
||||
|
||||
logAuction(EnumAuctionLogAction.CANCELLED, listing.sellerName, listing.item.getDisplayName(), listing.currentBid,
|
||||
"Penalty: " + penalty + ", Bidder refunded: " + listing.highBidderName +
|
||||
(isAdmin ? ", Cancelled by admin: " + player.getCommandSenderName() : ""));
|
||||
(isAdmin ? ", Cancelled by admin: " + player.getCommandSenderName() : ""));
|
||||
} else {
|
||||
// No bids - just return item
|
||||
AuctionClaim itemClaim = AuctionClaim.createItemReturnedClaim(
|
||||
@@ -1126,12 +1142,16 @@ public class AuctionController implements IAuctionHandler {
|
||||
// Save / Load - Async on CNPC+ Thread
|
||||
// =========================================
|
||||
|
||||
/** Mark data as dirty - will be saved on next save cycle */
|
||||
/**
|
||||
* Mark data as dirty - will be saved on next save cycle
|
||||
*/
|
||||
private void markDirty() {
|
||||
dirty.set(true);
|
||||
}
|
||||
|
||||
/** Save synchronously - used for server shutdown */
|
||||
/**
|
||||
* Save synchronously - used for server shutdown
|
||||
*/
|
||||
public void save() {
|
||||
if (!dirty.compareAndSet(true, false)) {
|
||||
return; // Nothing to save
|
||||
@@ -1139,7 +1159,9 @@ public class AuctionController implements IAuctionHandler {
|
||||
saveInternal();
|
||||
}
|
||||
|
||||
/** Save asynchronously on CNPC+ thread */
|
||||
/**
|
||||
* Save asynchronously on CNPC+ thread
|
||||
*/
|
||||
public void saveAsync() {
|
||||
if (!dirty.compareAndSet(true, false)) {
|
||||
return; // Nothing to save
|
||||
@@ -1167,7 +1189,9 @@ public class AuctionController implements IAuctionHandler {
|
||||
});
|
||||
}
|
||||
|
||||
/** Internal synchronous save */
|
||||
/**
|
||||
* Internal synchronous save
|
||||
*/
|
||||
private void saveInternal() {
|
||||
try {
|
||||
NBTTagCompound compound = writeToNBT(new NBTTagCompound());
|
||||
@@ -1236,7 +1260,9 @@ public class AuctionController implements IAuctionHandler {
|
||||
}
|
||||
}
|
||||
|
||||
/** Rebuild all indices from loaded data */
|
||||
/**
|
||||
* Rebuild all indices from loaded data
|
||||
*/
|
||||
private void rebuildIndices() {
|
||||
playerListingIds.clear();
|
||||
playerBidIds.clear();
|
||||
@@ -1460,8 +1486,8 @@ public class AuctionController implements IAuctionHandler {
|
||||
// Remove ended/cancelled listings (claims are in PlayerData now)
|
||||
listings.entrySet().removeIf(entry ->
|
||||
entry.getValue().status == EnumAuctionStatus.CLAIMED ||
|
||||
entry.getValue().status == EnumAuctionStatus.ENDED ||
|
||||
entry.getValue().status == EnumAuctionStatus.CANCELLED);
|
||||
entry.getValue().status == EnumAuctionStatus.ENDED ||
|
||||
entry.getValue().status == EnumAuctionStatus.CANCELLED);
|
||||
|
||||
// Rebuild indices
|
||||
rebuildIndices();
|
||||
|
||||
@@ -5,7 +5,7 @@ import noppes.npcs.config.ConfigScript;
|
||||
|
||||
/**
|
||||
* Server-side utility for syncing script configuration to clients.
|
||||
*
|
||||
* <p>
|
||||
* This class is SERVER-SIDE ONLY. Client reads via ScriptClientConfig.
|
||||
*/
|
||||
public class ScriptConfigSync {
|
||||
|
||||
@@ -3,12 +3,11 @@ package noppes.npcs.controllers;
|
||||
import noppes.npcs.api.event.IAbilityEvent;
|
||||
import noppes.npcs.api.event.IAnimationEvent;
|
||||
import noppes.npcs.api.event.IAuctionEvent;
|
||||
import noppes.npcs.api.event.IEnergyBarrierEvent;
|
||||
import noppes.npcs.api.event.IPlayerAbilityEvent;
|
||||
import noppes.npcs.api.event.IBlockEvent;
|
||||
import noppes.npcs.api.event.ICustomGuiEvent;
|
||||
import noppes.npcs.api.event.ICustomNPCsEvent;
|
||||
import noppes.npcs.api.event.IDialogEvent;
|
||||
import noppes.npcs.api.event.IEnergyBarrierEvent;
|
||||
import noppes.npcs.api.event.IEnergyProjectileEvent;
|
||||
import noppes.npcs.api.event.IFactionEvent;
|
||||
import noppes.npcs.api.event.IForgeEvent;
|
||||
@@ -16,6 +15,7 @@ import noppes.npcs.api.event.IItemEvent;
|
||||
import noppes.npcs.api.event.ILinkedItemEvent;
|
||||
import noppes.npcs.api.event.INpcEvent;
|
||||
import noppes.npcs.api.event.IPartyEvent;
|
||||
import noppes.npcs.api.event.IPlayerAbilityEvent;
|
||||
import noppes.npcs.api.event.IPlayerEvent;
|
||||
import noppes.npcs.api.event.IProjectileEvent;
|
||||
import noppes.npcs.api.event.IQuestEvent;
|
||||
|
||||
@@ -10,10 +10,10 @@ import noppes.npcs.config.ConfigMarket;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.Iterator;
|
||||
|
||||
public class AuctionBlacklist {
|
||||
private static volatile Set<String> blacklistedItems = new HashSet<>();
|
||||
|
||||
@@ -33,7 +33,9 @@ public class AuctionClaim implements IAuctionClaim {
|
||||
this.otherPlayerName = "";
|
||||
}
|
||||
|
||||
/** Create claim for winning an item (buyer won auction or buyout) */
|
||||
/**
|
||||
* Create claim for winning an item (buyer won auction or buyout)
|
||||
*/
|
||||
public static AuctionClaim createItemWonClaim(UUID playerUUID, String playerName, String listingId, ItemStack item) {
|
||||
AuctionClaim claim = new AuctionClaim();
|
||||
claim.playerUUID = playerUUID;
|
||||
@@ -46,7 +48,9 @@ public class AuctionClaim implements IAuctionClaim {
|
||||
return claim;
|
||||
}
|
||||
|
||||
/** Create claim for returned item (seller's expired/cancelled listing) */
|
||||
/**
|
||||
* Create claim for returned item (seller's expired/cancelled listing)
|
||||
*/
|
||||
public static AuctionClaim createItemReturnedClaim(UUID playerUUID, String playerName, String listingId, ItemStack item) {
|
||||
AuctionClaim claim = new AuctionClaim();
|
||||
claim.playerUUID = playerUUID;
|
||||
@@ -59,7 +63,9 @@ public class AuctionClaim implements IAuctionClaim {
|
||||
return claim;
|
||||
}
|
||||
|
||||
/** Create claim for seller's proceeds (stores item name for tooltip, not full item) */
|
||||
/**
|
||||
* Create claim for seller's proceeds (stores item name for tooltip, not full item)
|
||||
*/
|
||||
public static AuctionClaim createCurrencyClaim(UUID playerUUID, String playerName, String listingId, long currency, String itemName, String buyerName) {
|
||||
AuctionClaim claim = new AuctionClaim();
|
||||
claim.playerUUID = playerUUID;
|
||||
@@ -74,7 +80,9 @@ public class AuctionClaim implements IAuctionClaim {
|
||||
return claim;
|
||||
}
|
||||
|
||||
/** Create claim for outbid refund (stores item for display and rebid option) */
|
||||
/**
|
||||
* Create claim for outbid refund (stores item for display and rebid option)
|
||||
*/
|
||||
public static AuctionClaim createRefundClaim(UUID playerUUID, String playerName, String listingId, long currency, String itemName, String outbidderName, ItemStack item) {
|
||||
AuctionClaim claim = new AuctionClaim();
|
||||
claim.playerUUID = playerUUID;
|
||||
|
||||
@@ -25,14 +25,18 @@ public class AuctionFilter {
|
||||
return searchText != null && !searchText.trim().isEmpty();
|
||||
}
|
||||
|
||||
/** Normalize string for search (strip colors, lowercase, trim) */
|
||||
/**
|
||||
* Normalize string for search (strip colors, lowercase, trim)
|
||||
*/
|
||||
public static String normalizeForSearch(String input) {
|
||||
if (input == null || input.isEmpty()) return "";
|
||||
String stripped = EnumChatFormatting.getTextWithoutFormattingCodes(input);
|
||||
return stripped != null ? stripped.toLowerCase().trim() : input.toLowerCase().trim();
|
||||
}
|
||||
|
||||
/** Check if item name or seller name matches search text */
|
||||
/**
|
||||
* Check if item name or seller name matches search text
|
||||
*/
|
||||
public boolean matchesSearch(String itemName, String sellerName) {
|
||||
if (!hasSearchText()) return true;
|
||||
String normalizedItem = normalizeForSearch(itemName);
|
||||
@@ -41,12 +45,16 @@ public class AuctionFilter {
|
||||
return normalizedItem.contains(normalizedSearch) || normalizedSeller.contains(normalizedSearch);
|
||||
}
|
||||
|
||||
/** Legacy method - only checks item name */
|
||||
/**
|
||||
* Legacy method - only checks item name
|
||||
*/
|
||||
public boolean matchesSearch(String itemName) {
|
||||
return matchesSearch(itemName, "");
|
||||
}
|
||||
|
||||
/** Advanced search - all words must be present in item name OR seller name */
|
||||
/**
|
||||
* Advanced search - all words must be present in item name OR seller name
|
||||
*/
|
||||
public boolean matchesSearchAdvanced(String itemName, String sellerName) {
|
||||
if (!hasSearchText()) return true;
|
||||
String normalizedItem = normalizeForSearch(itemName);
|
||||
@@ -63,7 +71,9 @@ public class AuctionFilter {
|
||||
return true;
|
||||
}
|
||||
|
||||
/** Legacy method - only checks item name */
|
||||
/**
|
||||
* Legacy method - only checks item name
|
||||
*/
|
||||
public boolean matchesSearchAdvanced(String itemName) {
|
||||
return matchesSearchAdvanced(itemName, "");
|
||||
}
|
||||
@@ -101,13 +111,20 @@ public class AuctionFilter {
|
||||
}
|
||||
|
||||
// Getters and setters
|
||||
public String getSearchText() { return searchText; }
|
||||
public String getSearchText() {
|
||||
return searchText;
|
||||
}
|
||||
|
||||
public void setSearchText(String searchText) {
|
||||
this.searchText = searchText;
|
||||
this.normalizedSearch = normalizeForSearch(searchText);
|
||||
}
|
||||
|
||||
public EnumAuctionSort getSortBy() { return sortBy; }
|
||||
public void setSortBy(EnumAuctionSort sortBy) { this.sortBy = sortBy; }
|
||||
public EnumAuctionSort getSortBy() {
|
||||
return sortBy;
|
||||
}
|
||||
|
||||
public void setSortBy(EnumAuctionSort sortBy) {
|
||||
this.sortBy = sortBy;
|
||||
}
|
||||
}
|
||||
@@ -23,6 +23,7 @@ public class BuiltInAnimation extends Animation {
|
||||
|
||||
/**
|
||||
* Built-in animations cannot be saved.
|
||||
*
|
||||
* @return this animation unchanged
|
||||
*/
|
||||
@Override
|
||||
@@ -33,6 +34,7 @@ public class BuiltInAnimation extends Animation {
|
||||
|
||||
/**
|
||||
* Built-in animations have no valid ID.
|
||||
*
|
||||
* @return always -1
|
||||
*/
|
||||
@Override
|
||||
@@ -50,6 +52,7 @@ public class BuiltInAnimation extends Animation {
|
||||
|
||||
/**
|
||||
* Check if this is a built-in animation.
|
||||
*
|
||||
* @return always true for BuiltInAnimation
|
||||
*/
|
||||
public boolean isBuiltIn() {
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
package noppes.npcs.controllers.data;
|
||||
|
||||
import kamkeel.npcs.controllers.data.ability.Ability;
|
||||
import kamkeel.npcs.controllers.AbilityController;
|
||||
import kamkeel.npcs.controllers.data.ability.Ability;
|
||||
import kamkeel.npcs.controllers.data.ability.AbilityPhase;
|
||||
import kamkeel.npcs.controllers.data.ability.ChainedAbility;
|
||||
import kamkeel.npcs.controllers.data.ability.IAbilityAction;
|
||||
import kamkeel.npcs.controllers.data.ability.type.AbilityGuard;
|
||||
import kamkeel.npcs.controllers.data.telegraph.TelegraphInstance;
|
||||
import kamkeel.npcs.network.packets.data.ability.PlayerAbilityStatePacket;
|
||||
import kamkeel.npcs.network.packets.data.ability.PlayerAbilitySyncPacket;
|
||||
import kamkeel.npcs.network.packets.data.telegraph.TelegraphRemovePacket;
|
||||
import kamkeel.npcs.network.packets.data.telegraph.TelegraphSpawnPacket;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
@@ -17,17 +19,14 @@ import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.nbt.NBTTagString;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import noppes.npcs.AbstractDataAbilities;
|
||||
import noppes.npcs.LogWriter;
|
||||
import noppes.npcs.EventHooks;
|
||||
import noppes.npcs.LogWriter;
|
||||
import noppes.npcs.api.ability.IPlayerAbilityData;
|
||||
import noppes.npcs.api.entity.IPlayer;
|
||||
import noppes.npcs.controllers.ScriptController;
|
||||
import noppes.npcs.scripted.NpcAPI;
|
||||
import noppes.npcs.scripted.event.player.PlayerAbilityEvent;
|
||||
|
||||
import kamkeel.npcs.network.packets.data.ability.PlayerAbilityStatePacket;
|
||||
import kamkeel.npcs.network.packets.data.ability.PlayerAbilitySyncPacket;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
@@ -152,7 +151,7 @@ public class PlayerAbilityData extends AbstractDataAbilities implements IPlayerA
|
||||
|
||||
@Override
|
||||
protected void fireInterruptEvent(Ability ability, EntityLivingBase target,
|
||||
DamageSource source, float damage) {
|
||||
DamageSource source, float damage) {
|
||||
EntityPlayer player = playerData.player;
|
||||
if (ScriptController.Instance == null || player == null) return;
|
||||
PlayerDataScript handler = ScriptController.Instance.getPlayerScripts(player);
|
||||
@@ -310,7 +309,9 @@ public class PlayerAbilityData extends AbstractDataAbilities implements IPlayerA
|
||||
return activateAbility(player, key);
|
||||
}
|
||||
|
||||
/** Prefix used to identify chained ability keys in the unlocked list. */
|
||||
/**
|
||||
* Prefix used to identify chained ability keys in the unlocked list.
|
||||
*/
|
||||
public static final String CHAIN_PREFIX = "chain:";
|
||||
|
||||
/**
|
||||
|
||||
@@ -18,13 +18,13 @@ import noppes.npcs.LogWriter;
|
||||
import noppes.npcs.api.ability.IPlayerAbilityData;
|
||||
import noppes.npcs.api.entity.ICustomNpc;
|
||||
import noppes.npcs.api.handler.IPlayerBankData;
|
||||
import noppes.npcs.api.handler.IPlayerTradeData;
|
||||
import noppes.npcs.api.handler.IPlayerData;
|
||||
import noppes.npcs.api.handler.IPlayerDialogData;
|
||||
import noppes.npcs.api.handler.IPlayerFactionData;
|
||||
import noppes.npcs.api.handler.IPlayerItemGiverData;
|
||||
import noppes.npcs.api.handler.IPlayerMailData;
|
||||
import noppes.npcs.api.handler.IPlayerQuestData;
|
||||
import noppes.npcs.api.handler.IPlayerTradeData;
|
||||
import noppes.npcs.api.handler.IPlayerTransportData;
|
||||
import noppes.npcs.config.ConfigMain;
|
||||
import noppes.npcs.constants.EnumRoleType;
|
||||
@@ -47,8 +47,6 @@ import java.io.FileOutputStream;
|
||||
import java.util.HashSet;
|
||||
import java.util.UUID;
|
||||
|
||||
import static noppes.npcs.util.CustomNPCsThreader.customNPCThread;
|
||||
|
||||
public class PlayerData implements IExtendedEntityProperties, IPlayerData {
|
||||
public PlayerDialogData dialogData = new PlayerDialogData(this);
|
||||
public PlayerBankData bankData = new PlayerBankData(this);
|
||||
|
||||
@@ -345,10 +345,10 @@ public class Action implements IAction {
|
||||
try {
|
||||
onStart.accept(this);
|
||||
} catch (Throwable t) {
|
||||
String err = "IAction" + getName() + " onStart threw an exception:";
|
||||
String err = "IAction" + getName() + " onStart threw an exception:";
|
||||
if (reportTo != null)
|
||||
reportTo.appendConsole(err + "\n" + ExceptionUtils.getStackTrace(t));
|
||||
|
||||
|
||||
manager.LOGGER.error("onStart Task of " + this + " threw an exception:", t);
|
||||
}
|
||||
|
||||
@@ -384,7 +384,7 @@ public class Action implements IAction {
|
||||
try {
|
||||
onDone.accept(this);
|
||||
} catch (Throwable t) {
|
||||
String err = "IAction" + getName() + " onDone threw an exception:";
|
||||
String err = "IAction" + getName() + " onDone threw an exception:";
|
||||
if (reportTo != null)
|
||||
reportTo.appendConsole(err + "\n" + ExceptionUtils.getStackTrace(t));
|
||||
|
||||
|
||||
@@ -134,7 +134,7 @@ public class ConditionalAction extends Action implements IConditionalAction {
|
||||
String err = "IConditionalAction '" + getName() + "' threw an exception:";
|
||||
if (reportTo != null)
|
||||
reportTo.appendConsole(err + "\n" + ExceptionUtils.getStackTrace(t));
|
||||
|
||||
|
||||
manager.LOGGER.error("Task of " + this + " threw an exception:", t);
|
||||
markDone();
|
||||
}
|
||||
@@ -151,7 +151,7 @@ public class ConditionalAction extends Action implements IConditionalAction {
|
||||
try {
|
||||
onTermination.accept(this);
|
||||
} catch (Throwable t) {
|
||||
String err = "IConditionalAction" + getName() + " onTermination threw an exception:";
|
||||
String err = "IConditionalAction" + getName() + " onTermination threw an exception:";
|
||||
if (reportTo != null)
|
||||
reportTo.appendConsole(err + "\n" + ExceptionUtils.getStackTrace(t));
|
||||
|
||||
|
||||
@@ -1,7 +1,13 @@
|
||||
package noppes.npcs.items;
|
||||
|
||||
import kamkeel.npcs.controllers.data.ability.AnchorPoint;
|
||||
import kamkeel.npcs.controllers.data.ability.data.*;
|
||||
import kamkeel.npcs.controllers.data.ability.data.EnergyAnchorData;
|
||||
import kamkeel.npcs.controllers.data.ability.data.EnergyCombatData;
|
||||
import kamkeel.npcs.controllers.data.ability.data.EnergyDisplayData;
|
||||
import kamkeel.npcs.controllers.data.ability.data.EnergyHomingData;
|
||||
import kamkeel.npcs.controllers.data.ability.data.EnergyLifespanData;
|
||||
import kamkeel.npcs.controllers.data.ability.data.EnergyLightningData;
|
||||
import kamkeel.npcs.controllers.data.ability.data.EnergyTrajectoryData;
|
||||
import kamkeel.npcs.entity.EntityAbilityOrb;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
@@ -22,7 +28,7 @@ import noppes.npcs.entity.EntityProjectile;
|
||||
import noppes.npcs.util.IProjectileCallback;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.Color;
|
||||
|
||||
public class ItemStaff extends ItemNpcInterface implements IProjectileCallback {
|
||||
|
||||
@@ -33,7 +39,8 @@ public class ItemStaff extends ItemNpcInterface implements IProjectileCallback {
|
||||
public ItemStaff(int par1, EnumNpcToolMaterial material) {
|
||||
super(par1);
|
||||
this.material = material;
|
||||
this.color = OrbColor.get(material.ordinal());;
|
||||
this.color = OrbColor.get(material.ordinal());
|
||||
;
|
||||
setCreativeTab(CustomItems.tabWeapon);
|
||||
}
|
||||
|
||||
|
||||
@@ -3,10 +3,10 @@ package noppes.npcs.scripted;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.eventhandler.EventBus;
|
||||
import foxz.command.ScriptedCommand;
|
||||
import kamkeel.npcs.controllers.AbilityController;
|
||||
import kamkeel.npcs.controllers.AttributeController;
|
||||
import kamkeel.npcs.controllers.ProfileController;
|
||||
import kamkeel.npcs.controllers.TelegraphController;
|
||||
import kamkeel.npcs.controllers.AbilityController;
|
||||
import kamkeel.npcs.entity.EntityAbilityBeam;
|
||||
import kamkeel.npcs.entity.EntityAbilityDisc;
|
||||
import kamkeel.npcs.entity.EntityAbilityLaser;
|
||||
@@ -58,9 +58,9 @@ import noppes.npcs.api.IContainer;
|
||||
import noppes.npcs.api.IDamageSource;
|
||||
import noppes.npcs.api.INbt;
|
||||
import noppes.npcs.api.IParticle;
|
||||
import noppes.npcs.api.ITelegraph;
|
||||
import noppes.npcs.api.IPos;
|
||||
import noppes.npcs.api.ISkinOverlay;
|
||||
import noppes.npcs.api.ITelegraph;
|
||||
import noppes.npcs.api.ITileEntity;
|
||||
import noppes.npcs.api.IWorld;
|
||||
import noppes.npcs.api.entity.ICustomNpc;
|
||||
@@ -70,8 +70,8 @@ import noppes.npcs.api.gui.ICustomGui;
|
||||
import noppes.npcs.api.handler.IAbilityHandler;
|
||||
import noppes.npcs.api.handler.IActionManager;
|
||||
import noppes.npcs.api.handler.IAnimationHandler;
|
||||
import noppes.npcs.api.handler.IAuctionHandler;
|
||||
import noppes.npcs.api.handler.IAttributeHandler;
|
||||
import noppes.npcs.api.handler.IAuctionHandler;
|
||||
import noppes.npcs.api.handler.ICloneHandler;
|
||||
import noppes.npcs.api.handler.ICustomEffectHandler;
|
||||
import noppes.npcs.api.handler.IDialogHandler;
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
package noppes.npcs.scripted;
|
||||
|
||||
import kamkeel.npcs.entity.EntityAbilityBeam;
|
||||
import kamkeel.npcs.entity.EntityAbilityDisc;
|
||||
import kamkeel.npcs.entity.EntityAbilityLaser;
|
||||
import kamkeel.npcs.entity.EntityAbilityOrb;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockAir;
|
||||
import net.minecraft.entity.Entity;
|
||||
@@ -21,10 +25,6 @@ import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.common.util.BlockSnapshot;
|
||||
import net.minecraftforge.common.util.FakePlayer;
|
||||
import net.minecraftforge.event.world.BlockEvent;
|
||||
import kamkeel.npcs.entity.EntityAbilityBeam;
|
||||
import kamkeel.npcs.entity.EntityAbilityDisc;
|
||||
import kamkeel.npcs.entity.EntityAbilityLaser;
|
||||
import kamkeel.npcs.entity.EntityAbilityOrb;
|
||||
import noppes.npcs.CustomNpcs;
|
||||
import noppes.npcs.NoppesUtilServer;
|
||||
import noppes.npcs.api.IBlock;
|
||||
|
||||
@@ -29,40 +29,95 @@ public abstract class ScriptEnergyAbility<T extends EntityEnergyAbility> extends
|
||||
|
||||
// ==================== DISPLAY ====================
|
||||
|
||||
public int getInnerColor() { return entity.getInnerColor(); }
|
||||
public void setInnerColor(int color) { entity.setInnerColor(color); }
|
||||
public int getInnerColor() {
|
||||
return entity.getInnerColor();
|
||||
}
|
||||
|
||||
public float getInnerAlpha() { return entity.getInnerAlpha(); }
|
||||
public void setInnerAlpha(float alpha) { entity.setInnerAlpha(alpha); }
|
||||
public void setInnerColor(int color) {
|
||||
entity.setInnerColor(color);
|
||||
}
|
||||
|
||||
public int getOuterColor() { return entity.getOuterColor(); }
|
||||
public void setOuterColor(int color) { entity.setOuterColor(color); }
|
||||
public float getInnerAlpha() {
|
||||
return entity.getInnerAlpha();
|
||||
}
|
||||
|
||||
public boolean isOuterColorEnabled() { return entity.isOuterColorEnabled(); }
|
||||
public void setOuterColorEnabled(boolean enabled) { entity.setOuterColorEnabled(enabled); }
|
||||
public void setInnerAlpha(float alpha) {
|
||||
entity.setInnerAlpha(alpha);
|
||||
}
|
||||
|
||||
public float getOuterColorWidth() { return entity.getOuterColorWidth(); }
|
||||
public void setOuterColorWidth(float width) { entity.setOuterColorWidth(width); }
|
||||
public int getOuterColor() {
|
||||
return entity.getOuterColor();
|
||||
}
|
||||
|
||||
public float getOuterColorAlpha() { return entity.getOuterColorAlpha(); }
|
||||
public void setOuterColorAlpha(float alpha) { entity.setOuterColorAlpha(alpha); }
|
||||
public void setOuterColor(int color) {
|
||||
entity.setOuterColor(color);
|
||||
}
|
||||
|
||||
public boolean isOuterColorEnabled() {
|
||||
return entity.isOuterColorEnabled();
|
||||
}
|
||||
|
||||
public void setOuterColorEnabled(boolean enabled) {
|
||||
entity.setOuterColorEnabled(enabled);
|
||||
}
|
||||
|
||||
public float getOuterColorWidth() {
|
||||
return entity.getOuterColorWidth();
|
||||
}
|
||||
|
||||
public void setOuterColorWidth(float width) {
|
||||
entity.setOuterColorWidth(width);
|
||||
}
|
||||
|
||||
public float getOuterColorAlpha() {
|
||||
return entity.getOuterColorAlpha();
|
||||
}
|
||||
|
||||
public void setOuterColorAlpha(float alpha) {
|
||||
entity.setOuterColorAlpha(alpha);
|
||||
}
|
||||
|
||||
// ==================== LIGHTNING ====================
|
||||
|
||||
public boolean hasLightningEffect() { return entity.hasLightningEffect(); }
|
||||
public void setLightningEffect(boolean enabled) { entity.setLightningEffect(enabled); }
|
||||
public boolean hasLightningEffect() {
|
||||
return entity.hasLightningEffect();
|
||||
}
|
||||
|
||||
public float getLightningDensity() { return entity.getLightningDensity(); }
|
||||
public void setLightningDensity(float density) { entity.setLightningDensity(density); }
|
||||
public void setLightningEffect(boolean enabled) {
|
||||
entity.setLightningEffect(enabled);
|
||||
}
|
||||
|
||||
public float getLightningRadius() { return entity.getLightningRadius(); }
|
||||
public void setLightningRadius(float radius) { entity.setLightningRadius(radius); }
|
||||
public float getLightningDensity() {
|
||||
return entity.getLightningDensity();
|
||||
}
|
||||
|
||||
public int getLightningFadeTime() { return entity.getLightningFadeTime(); }
|
||||
public void setLightningFadeTime(int ticks) { entity.setLightningFadeTime(ticks); }
|
||||
public void setLightningDensity(float density) {
|
||||
entity.setLightningDensity(density);
|
||||
}
|
||||
|
||||
public float getLightningRadius() {
|
||||
return entity.getLightningRadius();
|
||||
}
|
||||
|
||||
public void setLightningRadius(float radius) {
|
||||
entity.setLightningRadius(radius);
|
||||
}
|
||||
|
||||
public int getLightningFadeTime() {
|
||||
return entity.getLightningFadeTime();
|
||||
}
|
||||
|
||||
public void setLightningFadeTime(int ticks) {
|
||||
entity.setLightningFadeTime(ticks);
|
||||
}
|
||||
|
||||
// ==================== STATE ====================
|
||||
|
||||
public boolean isCharging() { return entity.isCharging(); }
|
||||
public float getChargeProgress() { return entity.getChargeProgress(); }
|
||||
public boolean isCharging() {
|
||||
return entity.isCharging();
|
||||
}
|
||||
|
||||
public float getChargeProgress() {
|
||||
return entity.getChargeProgress();
|
||||
}
|
||||
}
|
||||
@@ -81,17 +81,37 @@ public class ScriptEnergyBarrier<T extends EntityEnergyBarrier> extends ScriptEn
|
||||
|
||||
// ==================== BARRIER ====================
|
||||
|
||||
public float getDefaultMultiplier() { return entity.getBarrierData().defaultMultiplier; }
|
||||
public void setDefaultMultiplier(float multiplier) { entity.getBarrierData().defaultMultiplier = multiplier; }
|
||||
public float getDefaultMultiplier() {
|
||||
return entity.getBarrierData().defaultMultiplier;
|
||||
}
|
||||
|
||||
public boolean isKnockbackEnabled() { return entity.getBarrierData().knockbackEnabled; }
|
||||
public void setKnockbackEnabled(boolean enabled) { entity.getBarrierData().knockbackEnabled = enabled; }
|
||||
public void setDefaultMultiplier(float multiplier) {
|
||||
entity.getBarrierData().defaultMultiplier = multiplier;
|
||||
}
|
||||
|
||||
public float getKnockbackStrength() { return entity.getBarrierData().knockbackStrength; }
|
||||
public void setKnockbackStrength(float strength) { entity.getBarrierData().knockbackStrength = strength; }
|
||||
public boolean isKnockbackEnabled() {
|
||||
return entity.getBarrierData().knockbackEnabled;
|
||||
}
|
||||
|
||||
public int getKnockbackTarget() { return entity.getBarrierData().knockbackTarget; }
|
||||
public void setKnockbackTarget(int target) { entity.getBarrierData().knockbackTarget = target; }
|
||||
public void setKnockbackEnabled(boolean enabled) {
|
||||
entity.getBarrierData().knockbackEnabled = enabled;
|
||||
}
|
||||
|
||||
public float getKnockbackStrength() {
|
||||
return entity.getBarrierData().knockbackStrength;
|
||||
}
|
||||
|
||||
public void setKnockbackStrength(float strength) {
|
||||
entity.getBarrierData().knockbackStrength = strength;
|
||||
}
|
||||
|
||||
public int getKnockbackTarget() {
|
||||
return entity.getBarrierData().knockbackTarget;
|
||||
}
|
||||
|
||||
public void setKnockbackTarget(int target) {
|
||||
entity.getBarrierData().knockbackTarget = target;
|
||||
}
|
||||
|
||||
public int getBarrierType() {
|
||||
return entity instanceof EntityEnergyDome ? 0 : 1;
|
||||
|
||||
@@ -29,16 +29,33 @@ public class ScriptEnergyBeam<T extends EntityAbilityBeam> extends ScriptEnergyP
|
||||
|
||||
// ==================== BEAM-SPECIFIC ====================
|
||||
|
||||
public float getBeamWidth() { return entity.getBeamWidth(); }
|
||||
public void setBeamWidth(float width) { entity.setBeamWidth(width); }
|
||||
public float getBeamWidth() {
|
||||
return entity.getBeamWidth();
|
||||
}
|
||||
|
||||
public float getHeadSize() { return entity.getHeadSize(); }
|
||||
public void setHeadSize(float size) { entity.setHeadSize(size); }
|
||||
public void setBeamWidth(float width) {
|
||||
entity.setBeamWidth(width);
|
||||
}
|
||||
|
||||
public boolean isAttachedToOwner() { return entity.isAttachedToOwner(); }
|
||||
public void setAttachedToOwner(boolean attached) { entity.setAttachedToOwner(attached); }
|
||||
public float getHeadSize() {
|
||||
return entity.getHeadSize();
|
||||
}
|
||||
|
||||
public boolean shouldRenderTailOrb() { return entity.shouldRenderTailOrb(); }
|
||||
public void setHeadSize(float size) {
|
||||
entity.setHeadSize(size);
|
||||
}
|
||||
|
||||
public boolean isAttachedToOwner() {
|
||||
return entity.isAttachedToOwner();
|
||||
}
|
||||
|
||||
public void setAttachedToOwner(boolean attached) {
|
||||
entity.setAttachedToOwner(attached);
|
||||
}
|
||||
|
||||
public boolean shouldRenderTailOrb() {
|
||||
return entity.shouldRenderTailOrb();
|
||||
}
|
||||
|
||||
// ==================== FIRE ====================
|
||||
|
||||
|
||||
@@ -29,22 +29,49 @@ public class ScriptEnergyDisc<T extends EntityAbilityDisc> extends ScriptEnergyP
|
||||
|
||||
// ==================== DISC-SPECIFIC ====================
|
||||
|
||||
public float getDiscRadius() { return entity.getDiscRadius(); }
|
||||
public void setDiscRadius(float radius) { entity.setDiscRadius(radius); }
|
||||
public float getDiscRadius() {
|
||||
return entity.getDiscRadius();
|
||||
}
|
||||
|
||||
public float getDiscThickness() { return entity.getDiscThickness(); }
|
||||
public void setDiscThickness(float thickness) { entity.setDiscThickness(thickness); }
|
||||
public void setDiscRadius(float radius) {
|
||||
entity.setDiscRadius(radius);
|
||||
}
|
||||
|
||||
public boolean isVertical() { return entity.isVertical(); }
|
||||
public void setVertical(boolean vertical) { entity.setVertical(vertical); }
|
||||
public float getDiscThickness() {
|
||||
return entity.getDiscThickness();
|
||||
}
|
||||
|
||||
public boolean isBoomerang() { return entity.isBoomerang(); }
|
||||
public void setBoomerang(boolean boomerang) { entity.setBoomerang(boomerang); }
|
||||
public void setDiscThickness(float thickness) {
|
||||
entity.setDiscThickness(thickness);
|
||||
}
|
||||
|
||||
public int getBoomerangDelay() { return entity.getBoomerangDelay(); }
|
||||
public void setBoomerangDelay(int ticks) { entity.setBoomerangDelay(ticks); }
|
||||
public boolean isVertical() {
|
||||
return entity.isVertical();
|
||||
}
|
||||
|
||||
public boolean isReturning() { return entity.isReturning(); }
|
||||
public void setVertical(boolean vertical) {
|
||||
entity.setVertical(vertical);
|
||||
}
|
||||
|
||||
public boolean isBoomerang() {
|
||||
return entity.isBoomerang();
|
||||
}
|
||||
|
||||
public void setBoomerang(boolean boomerang) {
|
||||
entity.setBoomerang(boomerang);
|
||||
}
|
||||
|
||||
public int getBoomerangDelay() {
|
||||
return entity.getBoomerangDelay();
|
||||
}
|
||||
|
||||
public void setBoomerangDelay(int ticks) {
|
||||
entity.setBoomerangDelay(ticks);
|
||||
}
|
||||
|
||||
public boolean isReturning() {
|
||||
return entity.isReturning();
|
||||
}
|
||||
|
||||
// ==================== FIRE ====================
|
||||
|
||||
|
||||
@@ -27,6 +27,11 @@ public class ScriptEnergyDome<T extends EntityEnergyDome> extends ScriptEnergyBa
|
||||
|
||||
// ==================== DOME-SPECIFIC ====================
|
||||
|
||||
public float getDomeRadius() { return entity.getDomeRadius(); }
|
||||
public void setDomeRadius(float radius) { entity.setDomeRadius(radius); }
|
||||
public float getDomeRadius() {
|
||||
return entity.getDomeRadius();
|
||||
}
|
||||
|
||||
public void setDomeRadius(float radius) {
|
||||
entity.setDomeRadius(radius);
|
||||
}
|
||||
}
|
||||
@@ -29,31 +29,77 @@ public class ScriptEnergyLaser<T extends EntityAbilityLaser> extends ScriptEnerg
|
||||
|
||||
// ==================== LASER-SPECIFIC ====================
|
||||
|
||||
public float getLaserWidth() { return entity.getLaserWidth(); }
|
||||
public void setLaserWidth(float width) { entity.setLaserWidth(width); }
|
||||
public float getLaserWidth() {
|
||||
return entity.getLaserWidth();
|
||||
}
|
||||
|
||||
public float getExpansionSpeed() { return entity.getExpansionSpeed(); }
|
||||
public void setExpansionSpeed(float speed) { entity.setExpansionSpeed(speed); }
|
||||
public void setLaserWidth(float width) {
|
||||
entity.setLaserWidth(width);
|
||||
}
|
||||
|
||||
public int getLingerTicks() { return entity.getLingerTicks(); }
|
||||
public void setLingerTicks(int ticks) { entity.setLingerTicks(ticks); }
|
||||
public float getExpansionSpeed() {
|
||||
return entity.getExpansionSpeed();
|
||||
}
|
||||
|
||||
public float getCurrentLength() { return entity.getCurrentLength(); }
|
||||
public boolean isFullyExtended() { return entity.isFullyExtended(); }
|
||||
public void setExpansionSpeed(float speed) {
|
||||
entity.setExpansionSpeed(speed);
|
||||
}
|
||||
|
||||
public double getDirX() { return entity.getDirX(); }
|
||||
public double getDirY() { return entity.getDirY(); }
|
||||
public double getDirZ() { return entity.getDirZ(); }
|
||||
public void setDirection(double x, double y, double z) { entity.setDirection(x, y, z); }
|
||||
public int getLingerTicks() {
|
||||
return entity.getLingerTicks();
|
||||
}
|
||||
|
||||
public double getEndX() { return entity.getEndX(); }
|
||||
public double getEndY() { return entity.getEndY(); }
|
||||
public double getEndZ() { return entity.getEndZ(); }
|
||||
public void setLingerTicks(int ticks) {
|
||||
entity.setLingerTicks(ticks);
|
||||
}
|
||||
|
||||
public float getLingerAlpha() { return entity.getLingerAlpha(); }
|
||||
public float getCurrentLength() {
|
||||
return entity.getCurrentLength();
|
||||
}
|
||||
|
||||
public boolean isLockVerticalDirection() { return entity.isLockVerticalDirection(); }
|
||||
public void setLockVerticalDirection(boolean lock) { entity.setLockVerticalDirection(lock); }
|
||||
public boolean isFullyExtended() {
|
||||
return entity.isFullyExtended();
|
||||
}
|
||||
|
||||
public double getDirX() {
|
||||
return entity.getDirX();
|
||||
}
|
||||
|
||||
public double getDirY() {
|
||||
return entity.getDirY();
|
||||
}
|
||||
|
||||
public double getDirZ() {
|
||||
return entity.getDirZ();
|
||||
}
|
||||
|
||||
public void setDirection(double x, double y, double z) {
|
||||
entity.setDirection(x, y, z);
|
||||
}
|
||||
|
||||
public double getEndX() {
|
||||
return entity.getEndX();
|
||||
}
|
||||
|
||||
public double getEndY() {
|
||||
return entity.getEndY();
|
||||
}
|
||||
|
||||
public double getEndZ() {
|
||||
return entity.getEndZ();
|
||||
}
|
||||
|
||||
public float getLingerAlpha() {
|
||||
return entity.getLingerAlpha();
|
||||
}
|
||||
|
||||
public boolean isLockVerticalDirection() {
|
||||
return entity.isLockVerticalDirection();
|
||||
}
|
||||
|
||||
public void setLockVerticalDirection(boolean lock) {
|
||||
entity.setLockVerticalDirection(lock);
|
||||
}
|
||||
|
||||
// ==================== FIRE ====================
|
||||
|
||||
|
||||
@@ -27,15 +27,31 @@ public class ScriptEnergyPanel<T extends EntityEnergyPanel> extends ScriptEnergy
|
||||
|
||||
// ==================== PANEL-SPECIFIC ====================
|
||||
|
||||
public float getPanelWidth() { return entity.getPanelData().panelWidth; }
|
||||
public void setPanelWidth(float width) { entity.getPanelData().setPanelWidth(width); }
|
||||
public float getPanelWidth() {
|
||||
return entity.getPanelData().panelWidth;
|
||||
}
|
||||
|
||||
public float getPanelHeight() { return entity.getPanelData().panelHeight; }
|
||||
public void setPanelHeight(float height) { entity.getPanelData().setPanelHeight(height); }
|
||||
public void setPanelWidth(float width) {
|
||||
entity.getPanelData().setPanelWidth(width);
|
||||
}
|
||||
|
||||
public float getPanelYaw() { return entity.getPanelYaw(); }
|
||||
public float getPanelHeight() {
|
||||
return entity.getPanelData().panelHeight;
|
||||
}
|
||||
|
||||
public int getPanelMode() { return entity.getMode().ordinal(); }
|
||||
public void setPanelHeight(float height) {
|
||||
entity.getPanelData().setPanelHeight(height);
|
||||
}
|
||||
|
||||
public boolean isLaunched() { return entity.getMode() == EntityEnergyPanel.PanelMode.LAUNCHED; }
|
||||
public float getPanelYaw() {
|
||||
return entity.getPanelYaw();
|
||||
}
|
||||
|
||||
public int getPanelMode() {
|
||||
return entity.getMode().ordinal();
|
||||
}
|
||||
|
||||
public boolean isLaunched() {
|
||||
return entity.getMode() == EntityEnergyPanel.PanelMode.LAUNCHED;
|
||||
}
|
||||
}
|
||||
@@ -3,10 +3,10 @@ package noppes.npcs.scripted.entity;
|
||||
import kamkeel.npcs.entity.EntityEnergyProjectile;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import noppes.npcs.EventHooks;
|
||||
import noppes.npcs.api.entity.IEnergyProjectile;
|
||||
import noppes.npcs.api.entity.IEntity;
|
||||
import noppes.npcs.api.entity.IEntityLivingBase;
|
||||
import noppes.npcs.EventHooks;
|
||||
import noppes.npcs.scripted.constants.EntityType;
|
||||
|
||||
public class ScriptEnergyProjectile<T extends EntityEnergyProjectile> extends ScriptEnergyAbility<T> implements IEnergyProjectile {
|
||||
@@ -67,74 +67,171 @@ public class ScriptEnergyProjectile<T extends EntityEnergyProjectile> extends Sc
|
||||
|
||||
// ==================== DISPLAY (PROJECTILE-SPECIFIC) ====================
|
||||
|
||||
public float getRotationSpeed() { return entity.getRotationSpeed(); }
|
||||
public void setRotationSpeed(float speed) { entity.setRotationSpeed(speed); }
|
||||
public float getRotationSpeed() {
|
||||
return entity.getRotationSpeed();
|
||||
}
|
||||
|
||||
public void setRotationSpeed(float speed) {
|
||||
entity.setRotationSpeed(speed);
|
||||
}
|
||||
|
||||
// ==================== INTERPOLATION ====================
|
||||
|
||||
public float getInterpolatedRotationX(float partialTicks) { return entity.getInterpolatedRotationX(partialTicks); }
|
||||
public float getInterpolatedRotationY(float partialTicks) { return entity.getInterpolatedRotationY(partialTicks); }
|
||||
public float getInterpolatedRotationZ(float partialTicks) { return entity.getInterpolatedRotationZ(partialTicks); }
|
||||
public float getInterpolatedSize(float partialTicks) { return entity.getInterpolatedSize(partialTicks); }
|
||||
public float getInterpolatedRotationX(float partialTicks) {
|
||||
return entity.getInterpolatedRotationX(partialTicks);
|
||||
}
|
||||
|
||||
public float getInterpolatedRotationY(float partialTicks) {
|
||||
return entity.getInterpolatedRotationY(partialTicks);
|
||||
}
|
||||
|
||||
public float getInterpolatedRotationZ(float partialTicks) {
|
||||
return entity.getInterpolatedRotationZ(partialTicks);
|
||||
}
|
||||
|
||||
public float getInterpolatedSize(float partialTicks) {
|
||||
return entity.getInterpolatedSize(partialTicks);
|
||||
}
|
||||
|
||||
// ==================== LIFESPAN ====================
|
||||
|
||||
public float getMaxDistance() { return entity.getMaxDistance(); }
|
||||
public void setMaxDistance(float distance) { entity.setMaxDistance(distance); }
|
||||
public float getMaxDistance() {
|
||||
return entity.getMaxDistance();
|
||||
}
|
||||
|
||||
public int getMaxLifetime() { return entity.getMaxLifetime(); }
|
||||
public void setMaxLifetime(int ticks) { entity.setMaxLifetime(ticks); }
|
||||
public void setMaxDistance(float distance) {
|
||||
entity.setMaxDistance(distance);
|
||||
}
|
||||
|
||||
public int getMaxLifetime() {
|
||||
return entity.getMaxLifetime();
|
||||
}
|
||||
|
||||
public void setMaxLifetime(int ticks) {
|
||||
entity.setMaxLifetime(ticks);
|
||||
}
|
||||
|
||||
// ==================== COMBAT ====================
|
||||
|
||||
public float getDamage() { return entity.getDamage(); }
|
||||
public void setDamage(float damage) { entity.setCombatDamage(damage); }
|
||||
public float getDamage() {
|
||||
return entity.getDamage();
|
||||
}
|
||||
|
||||
public float getKnockback() { return entity.getKnockback(); }
|
||||
public void setKnockback(float knockback) { entity.setCombatKnockback(knockback); }
|
||||
public void setDamage(float damage) {
|
||||
entity.setCombatDamage(damage);
|
||||
}
|
||||
|
||||
public float getKnockbackUp() { return entity.getKnockbackUp(); }
|
||||
public void setKnockbackUp(float knockbackUp) { entity.setCombatKnockbackUp(knockbackUp); }
|
||||
public float getKnockback() {
|
||||
return entity.getKnockback();
|
||||
}
|
||||
|
||||
public boolean isExplosive() { return entity.isExplosive(); }
|
||||
public void setExplosive(boolean explosive) { entity.setExplosive(explosive); }
|
||||
public void setKnockback(float knockback) {
|
||||
entity.setCombatKnockback(knockback);
|
||||
}
|
||||
|
||||
public float getExplosionRadius() { return entity.getExplosionRadius(); }
|
||||
public void setExplosionRadius(float radius) { entity.setExplosionRadius(radius); }
|
||||
public float getKnockbackUp() {
|
||||
return entity.getKnockbackUp();
|
||||
}
|
||||
|
||||
public float getExplosionDamageFalloff() { return entity.getExplosionDamageFalloff(); }
|
||||
public void setExplosionDamageFalloff(float falloff) { entity.setExplosionDamageFalloff(falloff); }
|
||||
public void setKnockbackUp(float knockbackUp) {
|
||||
entity.setCombatKnockbackUp(knockbackUp);
|
||||
}
|
||||
|
||||
public boolean isExplosive() {
|
||||
return entity.isExplosive();
|
||||
}
|
||||
|
||||
public void setExplosive(boolean explosive) {
|
||||
entity.setExplosive(explosive);
|
||||
}
|
||||
|
||||
public float getExplosionRadius() {
|
||||
return entity.getExplosionRadius();
|
||||
}
|
||||
|
||||
public void setExplosionRadius(float radius) {
|
||||
entity.setExplosionRadius(radius);
|
||||
}
|
||||
|
||||
public float getExplosionDamageFalloff() {
|
||||
return entity.getExplosionDamageFalloff();
|
||||
}
|
||||
|
||||
public void setExplosionDamageFalloff(float falloff) {
|
||||
entity.setExplosionDamageFalloff(falloff);
|
||||
}
|
||||
|
||||
// ==================== MOVEMENT ====================
|
||||
|
||||
public float getSpeed() { return entity.getSpeed(); }
|
||||
public void setSpeed(float speed) { entity.setSpeed(speed); }
|
||||
public float getSpeed() {
|
||||
return entity.getSpeed();
|
||||
}
|
||||
|
||||
public boolean isHoming() { return entity.isHoming(); }
|
||||
public void setHoming(boolean homing) { entity.setHomingEnabled(homing); }
|
||||
public void setSpeed(float speed) {
|
||||
entity.setSpeed(speed);
|
||||
}
|
||||
|
||||
public float getHomingStrength() { return entity.getHomingStrength(); }
|
||||
public void setHomingStrength(float strength) { entity.setHomingStrength(strength); }
|
||||
public boolean isHoming() {
|
||||
return entity.isHoming();
|
||||
}
|
||||
|
||||
public float getHomingRange() { return entity.getHomingRange(); }
|
||||
public void setHomingRange(float range) { entity.setHomingRange(range); }
|
||||
public void setHoming(boolean homing) {
|
||||
entity.setHomingEnabled(homing);
|
||||
}
|
||||
|
||||
public float getHomingStrength() {
|
||||
return entity.getHomingStrength();
|
||||
}
|
||||
|
||||
public void setHomingStrength(float strength) {
|
||||
entity.setHomingStrength(strength);
|
||||
}
|
||||
|
||||
public float getHomingRange() {
|
||||
return entity.getHomingRange();
|
||||
}
|
||||
|
||||
public void setHomingRange(float range) {
|
||||
entity.setHomingRange(range);
|
||||
}
|
||||
|
||||
// ==================== ANCHOR ====================
|
||||
|
||||
public int getAnchor() { return entity.getAnchor(); }
|
||||
public float getAnchorOffsetX() { return entity.getAnchorOffsetX(); }
|
||||
public float getAnchorOffsetY() { return entity.getAnchorOffsetY(); }
|
||||
public float getAnchorOffsetZ() { return entity.getAnchorOffsetZ(); }
|
||||
public int getAnchor() {
|
||||
return entity.getAnchor();
|
||||
}
|
||||
|
||||
public float getAnchorOffsetX() {
|
||||
return entity.getAnchorOffsetX();
|
||||
}
|
||||
|
||||
public float getAnchorOffsetY() {
|
||||
return entity.getAnchorOffsetY();
|
||||
}
|
||||
|
||||
public float getAnchorOffsetZ() {
|
||||
return entity.getAnchorOffsetZ();
|
||||
}
|
||||
|
||||
// ==================== POSITION ====================
|
||||
|
||||
public double getStartX() { return entity.getStartX(); }
|
||||
public double getStartY() { return entity.getStartY(); }
|
||||
public double getStartZ() { return entity.getStartZ(); }
|
||||
public double getStartX() {
|
||||
return entity.getStartX();
|
||||
}
|
||||
|
||||
public double getStartY() {
|
||||
return entity.getStartY();
|
||||
}
|
||||
|
||||
public double getStartZ() {
|
||||
return entity.getStartZ();
|
||||
}
|
||||
|
||||
// ==================== STATE ====================
|
||||
|
||||
public boolean hasHit() { return entity.getHasHit(); }
|
||||
public boolean hasHit() {
|
||||
return entity.getHasHit();
|
||||
}
|
||||
|
||||
// ==================== FIRE ====================
|
||||
|
||||
|
||||
@@ -29,14 +29,29 @@ public class ScriptEnergySlicer<T extends EntityEnergySlicer> extends ScriptEner
|
||||
|
||||
// ==================== SLICER-SPECIFIC ====================
|
||||
|
||||
public float getSliceWidth() { return entity.getSliceWidth(); }
|
||||
public void setSliceWidth(float width) { entity.setSliceWidth(width); }
|
||||
public float getSliceWidth() {
|
||||
return entity.getSliceWidth();
|
||||
}
|
||||
|
||||
public float getSliceThickness() { return entity.getSliceThickness(); }
|
||||
public void setSliceThickness(float thickness) { entity.setSliceThickness(thickness); }
|
||||
public void setSliceWidth(float width) {
|
||||
entity.setSliceWidth(width);
|
||||
}
|
||||
|
||||
public boolean isPiercing() { return entity.isPiercing(); }
|
||||
public void setPiercing(boolean piercing) { entity.setPiercing(piercing); }
|
||||
public float getSliceThickness() {
|
||||
return entity.getSliceThickness();
|
||||
}
|
||||
|
||||
public void setSliceThickness(float thickness) {
|
||||
entity.setSliceThickness(thickness);
|
||||
}
|
||||
|
||||
public boolean isPiercing() {
|
||||
return entity.isPiercing();
|
||||
}
|
||||
|
||||
public void setPiercing(boolean piercing) {
|
||||
entity.setPiercing(piercing);
|
||||
}
|
||||
|
||||
// ==================== FIRE ====================
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package noppes.npcs.scripted.entity;
|
||||
|
||||
import kamkeel.npcs.entity.EntityEnergyProjectile;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import noppes.npcs.NoppesUtilServer;
|
||||
@@ -29,7 +30,6 @@ import noppes.npcs.constants.EnumMovingType;
|
||||
import noppes.npcs.constants.EnumNavType;
|
||||
import noppes.npcs.constants.EnumRoleType;
|
||||
import noppes.npcs.constants.EnumStandingType;
|
||||
import kamkeel.npcs.entity.EntityEnergyProjectile;
|
||||
import noppes.npcs.controllers.FactionController;
|
||||
import noppes.npcs.controllers.data.DialogOption;
|
||||
import noppes.npcs.controllers.data.Line;
|
||||
|
||||
@@ -38,13 +38,19 @@ public class AuctionEvent extends PlayerEvent implements IAuctionEvent {
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemStack getItem() { return item; }
|
||||
public IItemStack getItem() {
|
||||
return item;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getStartingPrice() { return startingPrice; }
|
||||
public long getStartingPrice() {
|
||||
return startingPrice;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getBuyoutPrice() { return buyoutPrice; }
|
||||
public long getBuyoutPrice() {
|
||||
return buyoutPrice;
|
||||
}
|
||||
}
|
||||
|
||||
@Cancelable
|
||||
@@ -64,10 +70,14 @@ public class AuctionEvent extends PlayerEvent implements IAuctionEvent {
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAuctionListing getListing() { return listing; }
|
||||
public IAuctionListing getListing() {
|
||||
return listing;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getBidAmount() { return bidAmount; }
|
||||
public long getBidAmount() {
|
||||
return bidAmount;
|
||||
}
|
||||
}
|
||||
|
||||
@Cancelable
|
||||
@@ -85,7 +95,9 @@ public class AuctionEvent extends PlayerEvent implements IAuctionEvent {
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAuctionListing getListing() { return listing; }
|
||||
public IAuctionListing getListing() {
|
||||
return listing;
|
||||
}
|
||||
}
|
||||
|
||||
@Cancelable
|
||||
@@ -105,10 +117,14 @@ public class AuctionEvent extends PlayerEvent implements IAuctionEvent {
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAuctionListing getListing() { return listing; }
|
||||
public IAuctionListing getListing() {
|
||||
return listing;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAdmin() { return admin; }
|
||||
public boolean isAdmin() {
|
||||
return admin;
|
||||
}
|
||||
}
|
||||
|
||||
@Cancelable
|
||||
@@ -126,6 +142,8 @@ public class AuctionEvent extends PlayerEvent implements IAuctionEvent {
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAuctionClaim getClaim() { return claim; }
|
||||
public IAuctionClaim getClaim() {
|
||||
return claim;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
package noppes.npcs.scripted.wrapper;
|
||||
|
||||
import kamkeel.npcs.controllers.data.ability.Ability;
|
||||
import kamkeel.npcs.controllers.AbilityController;
|
||||
import kamkeel.npcs.controllers.data.ability.Ability;
|
||||
import kamkeel.npcs.controllers.data.ability.AbilityAction;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import noppes.npcs.DataAbilities;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package noppes.npcs.scripted.wrapper;
|
||||
|
||||
import kamkeel.npcs.controllers.data.ability.Ability;
|
||||
import kamkeel.npcs.controllers.AbilityController;
|
||||
import kamkeel.npcs.controllers.data.ability.Ability;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import noppes.npcs.api.ability.IAbility;
|
||||
import noppes.npcs.api.ability.IPlayerAbilityData;
|
||||
|
||||
Reference in new issue
Block a user