From f969b9f5403836489c815cef025d0a55b821eaf3 Mon Sep 17 00:00:00 2001 From: Kam Date: Sun, 1 Mar 2026 04:27:11 -0500 Subject: [PATCH] Bunch of API Additions - ITintData - IHitboxData - Sound Management APIS - Tactical Chance - Swimming - Fire Reactions - Sprint - Door Interact - Walking Range --- java/noppes/npcs/api/entity/ICustomNpc.java | 528 ++++++++++++++++++ .../npcs/api/entity/data/IHitboxData.java | 54 ++ .../npcs/api/entity/data/ITintData.java | 94 ++++ 3 files changed, 676 insertions(+) create mode 100644 java/noppes/npcs/api/entity/data/IHitboxData.java create mode 100644 java/noppes/npcs/api/entity/data/ITintData.java diff --git a/java/noppes/npcs/api/entity/ICustomNpc.java b/java/noppes/npcs/api/entity/ICustomNpc.java index 1ca5c48..4ec34b3 100644 --- a/java/noppes/npcs/api/entity/ICustomNpc.java +++ b/java/noppes/npcs/api/entity/ICustomNpc.java @@ -4,7 +4,9 @@ import net.minecraft.entity.EntityCreature; import noppes.npcs.api.IPos; import noppes.npcs.api.ITimers; import noppes.npcs.api.ability.IDataAbilities; +import noppes.npcs.api.entity.data.IHitboxData; import noppes.npcs.api.entity.data.IModelData; +import noppes.npcs.api.entity.data.ITintData; import noppes.npcs.api.handler.IActionManager; import noppes.npcs.api.handler.IOverlayHandler; import noppes.npcs.api.handler.data.IAnimationData; @@ -296,6 +298,20 @@ public interface ICustomNpc extends IEntityLiving, */ boolean getProjectilesKeepTerrain(); + /** + * Sets whether the NPC has projectile invincibility frames. + * + * @param invincible true to enable projectile invincibility, false to disable. + */ + void setProjectileInvincibility(boolean invincible); + + /** + * Returns whether the NPC has projectile invincibility frames. + * + * @return true if projectile invincibility is enabled, false otherwise. + */ + boolean getProjectileInvincibility(); + /** * Makes the NPC broadcast a message. * @@ -378,6 +394,104 @@ public interface ICustomNpc extends IEntityLiving, */ ILines getKillLines(); + /** + * Returns whether NPC dialog lines are played in order. + * + * @return true if lines are ordered, false if random. + */ + boolean getOrderedLines(); + + /** + * Sets whether NPC dialog lines are played in order. + * + * @param ordered true for ordered, false for random. + */ + void setOrderedLines(boolean ordered); + + /** + * Returns the NPC's idle sound resource path. + * + * @return the idle sound path, or empty string if none. + */ + String getIdleSound(); + + /** + * Sets the NPC's idle sound resource path. + * + * @param sound the idle sound path. + */ + void setIdleSound(String sound); + + /** + * Returns the NPC's angry/aggro sound resource path. + * + * @return the angry sound path, or empty string if none. + */ + String getAngrySound(); + + /** + * Sets the NPC's angry/aggro sound resource path. + * + * @param sound the angry sound path. + */ + void setAngrySound(String sound); + + /** + * Returns the NPC's hurt sound resource path. + * + * @return the hurt sound path. + */ + String getHurtSound(); + + /** + * Sets the NPC's hurt sound resource path. + * + * @param sound the hurt sound path. + */ + void setHurtSound(String sound); + + /** + * Returns the NPC's death sound resource path. + * + * @return the death sound path. + */ + String getDeathSound(); + + /** + * Sets the NPC's death sound resource path. + * + * @param sound the death sound path. + */ + void setDeathSound(String sound); + + /** + * Returns the NPC's step/footstep sound resource path. + * + * @return the step sound path, or empty string if none. + */ + String getStepSound(); + + /** + * Sets the NPC's step/footstep sound resource path. + * + * @param sound the step sound path. + */ + void setStepSound(String sound); + + /** + * Returns whether pitch variation is disabled for NPC sounds. + * + * @return true if pitch is disabled (fixed pitch), false otherwise. + */ + boolean getDisablePitch(); + + /** + * Sets whether pitch variation is disabled for NPC sounds. + * + * @param disablePitch true to disable pitch variation, false to allow. + */ + void setDisablePitch(boolean disablePitch); + /** * Kills the NPC without despawning it. */ @@ -712,6 +826,14 @@ public interface ICustomNpc extends IEntityLiving, */ boolean getCanDrown(); + /** + * Sets whether the NPC can drown. + * Shorthand: sets drowning type to 1 (drowns in water) if true, 0 (never drowns) if false. + * + * @param canDrown true to allow drowning, false to prevent. + */ + void setCanDrown(boolean canDrown); + /** * Sets the drowning behavior of the NPC. * @@ -803,6 +925,286 @@ public interface ICustomNpc extends IEntityLiving, */ int getTacticalRadius(); + /** + * Returns the tactical behavior chance (1 in N). + * + * @return the tactical chance. + */ + int getTacticalChance(); + + /** + * Sets the tactical behavior chance (1 in N). + * + * @param chance the tactical chance. + */ + void setTacticalChance(int chance); + + /** + * Returns whether the NPC can swim. + * + * @return true if the NPC can swim, false otherwise. + */ + boolean getCanSwim(); + + /** + * Sets whether the NPC can swim. + * + * @param canSwim true to enable swimming, false to disable. + */ + void setCanSwim(boolean canSwim); + + /** + * Returns whether the NPC reacts to fire. + * + * @return true if the NPC reacts to fire, false otherwise. + */ + boolean getReactsToFire(); + + /** + * Sets whether the NPC reacts to fire. + * + * @param reactsToFire true to react, false otherwise. + */ + void setReactsToFire(boolean reactsToFire); + + /** + * Returns whether the NPC avoids water. + * + * @return true if the NPC avoids water, false otherwise. + */ + boolean getAvoidsWater(); + + /** + * Sets whether the NPC avoids water. + * + * @param avoidsWater true to avoid water, false otherwise. + */ + void setAvoidsWater(boolean avoidsWater); + + /** + * Returns whether the NPC avoids sunlight. + * + * @return true if the NPC avoids the sun, false otherwise. + */ + boolean getAvoidsSun(); + + /** + * Sets whether the NPC avoids sunlight. + * + * @param avoidsSun true to avoid sunlight, false otherwise. + */ + void setAvoidsSun(boolean avoidsSun); + + /** + * Returns whether the NPC requires direct line-of-sight to attack. + * + * @return true if direct LOS is required, false otherwise. + */ + boolean getDirectLOS(); + + /** + * Sets whether the NPC requires direct line-of-sight to attack. + * + * @param directLOS true to require LOS, false otherwise. + */ + void setDirectLOS(boolean directLOS); + + /** + * Returns the NPC's leap attack type. + * + * @return the leap type. + */ + int getLeapType(); + + /** + * Sets the NPC's leap attack type. + * + * @param leapType the leap type. + */ + void setLeapType(int leapType); + + /** + * Returns whether the NPC can sprint. + * + * @return true if sprinting is enabled, false otherwise. + */ + boolean getCanSprint(); + + /** + * Sets whether the NPC can sprint. + * + * @param canSprint true to enable sprinting, false to disable. + */ + void setCanSprint(boolean canSprint); + + /** + * Returns whether the NPC stops moving to interact with players. + * + * @return true if the NPC stops to interact, false otherwise. + */ + boolean getStopAndInteract(); + + /** + * Sets whether the NPC stops moving to interact with players. + * + * @param stopAndInteract true to stop and interact, false otherwise. + */ + void setStopAndInteract(boolean stopAndInteract); + + /** + * Returns the NPC's door interaction behavior. + * + * @return the door interaction mode (0: Break, 1: Open, 2: Disabled). + */ + int getDoorInteract(); + + /** + * Sets the NPC's door interaction behavior. + * + * @param doorInteract the door interaction mode (0: Break, 1: Open, 2: Disabled). + */ + void setDoorInteract(int doorInteract); + + /** + * Returns the NPC's walking range (wander radius). + * + * @return the walking range. + */ + int getWalkingRange(); + + /** + * Sets the NPC's walking range (wander radius). + * + * @param range the walking range. + */ + void setWalkingRange(int range); + + /** + * Returns whether the NPC interacts with other NPCs. + * + * @return true if NPC interaction is enabled, false otherwise. + */ + boolean getNpcInteracting(); + + /** + * Sets whether the NPC interacts with other NPCs. + * + * @param npcInteracting true to enable, false to disable. + */ + void setNpcInteracting(boolean npcInteracting); + + /** + * Returns whether the NPC pauses at path points. + * + * @return true if the NPC pauses at path points, false otherwise. + */ + boolean getMovingPause(); + + /** + * Sets whether the NPC pauses at path points. + * + * @param movingPause true to pause, false otherwise. + */ + void setMovingPause(boolean movingPause); + + /** + * Returns the NPC's path movement pattern. + * + * @return the moving pattern (0: Looping, 1: Backtracking). + */ + int getMovingPattern(); + + /** + * Sets the NPC's path movement pattern. + * + * @param pattern the moving pattern (0: Looping, 1: Backtracking). + */ + void setMovingPattern(int pattern); + + /** + * Returns whether the NPC fires indirect (arcing) projectiles. + * + * @return the indirect fire mode. + */ + int getCanFireIndirect(); + + /** + * Sets whether the NPC fires indirect (arcing) projectiles. + * + * @param canFireIndirect the indirect fire mode. + */ + void setCanFireIndirect(int canFireIndirect); + + /** + * Returns the NPC's use-range-melee mode. + * + * @return the use-range-melee mode. + */ + int getUseRangeMelee(); + + /** + * Sets the NPC's use-range-melee mode. + * + * @param useRangeMelee the use-range-melee mode. + */ + void setUseRangeMelee(int useRangeMelee); + + /** + * Returns the distance at which the NPC switches from ranged to melee. + * + * @return the distance to melee. + */ + int getDistanceToMelee(); + + /** + * Sets the distance at which the NPC switches from ranged to melee. + * + * @param distance the distance to melee. + */ + void setDistanceToMelee(int distance); + + /** + * Returns the NPC's body X offset. + * + * @return the body X offset. + */ + float getBodyOffsetX(); + + /** + * Sets the NPC's body X offset. + * + * @param offsetX the body X offset. + */ + void setBodyOffsetX(float offsetX); + + /** + * Returns the NPC's body Y offset. + * + * @return the body Y offset. + */ + float getBodyOffsetY(); + + /** + * Sets the NPC's body Y offset. + * + * @param offsetY the body Y offset. + */ + void setBodyOffsetY(float offsetY); + + /** + * Returns the NPC's body Z offset. + * + * @return the body Z offset. + */ + float getBodyOffsetZ(); + + /** + * Sets the NPC's body Z offset. + * + * @param offsetZ the body Z offset. + */ + void setBodyOffsetZ(float offsetZ); + /** * Sets whether the NPC ignores cobwebs. * @@ -1173,6 +1575,20 @@ public interface ICustomNpc extends IEntityLiving, */ IModelData getModelData(); + /** + * Returns the hitbox data associated with the NPC. + * + * @return the hitbox data. + */ + IHitboxData getHitboxData(); + + /** + * Returns the tint data associated with the NPC. + * + * @return the tint data. + */ + ITintData getTintData(); + /** * (Deprecated) Sets the head scale of the NPC. * @@ -1269,6 +1685,104 @@ public interface ICustomNpc extends IEntityLiving, */ double getKnockbackResistance(); + /** + * Returns whether all damage to this NPC is disabled. + * + * @return true if damage is disabled, false otherwise. + */ + boolean getDamageDisabled(); + + /** + * Sets whether all damage to this NPC is disabled. + * + * @param disabled true to disable all damage, false otherwise. + */ + void setDamageDisabled(boolean disabled); + + /** + * Returns whether the NPC takes no fall damage. + * + * @return true if fall damage is disabled, false otherwise. + */ + boolean getNoFallDamage(); + + /** + * Sets whether the NPC takes no fall damage. + * + * @param noFallDamage true to disable fall damage, false to enable. + */ + void setNoFallDamage(boolean noFallDamage); + + /** + * Returns whether the NPC is immune to fire. + * + * @return true if immune to fire, false otherwise. + */ + boolean getImmuneToFire(); + + /** + * Sets whether the NPC is immune to fire. + * + * @param immuneToFire true to make immune, false otherwise. + */ + void setImmuneToFire(boolean immuneToFire); + + /** + * Returns whether the NPC is immune to potion effects. + * + * @return true if potion immune, false otherwise. + */ + boolean getPotionImmune(); + + /** + * Sets whether the NPC is immune to potion effects. + * + * @param potionImmune true to make immune, false otherwise. + */ + void setPotionImmune(boolean potionImmune); + + /** + * Returns whether the NPC burns in sunlight. + * + * @return true if the NPC burns in the sun, false otherwise. + */ + boolean getBurnInSun(); + + /** + * Sets whether the NPC burns in sunlight. + * + * @param burnInSun true to burn in sunlight, false otherwise. + */ + void setBurnInSun(boolean burnInSun); + + /** + * Returns whether the NPC can attack invisible targets. + * + * @return true if the NPC attacks invisible entities, false otherwise. + */ + boolean getAttackInvisible(); + + /** + * Sets whether the NPC can attack invisible targets. + * + * @param attackInvisible true to allow attacking invisible entities, false otherwise. + */ + void setAttackInvisible(boolean attackInvisible); + + /** + * Returns the NPC's creature type. + * + * @return the creature type ordinal (0: Undefined, 1: Undead, 2: Arthropod). + */ + int getCreatureType(); + + /** + * Sets the NPC's creature type. + * + * @param type the creature type ordinal (0: Undefined, 1: Undead, 2: Arthropod). + */ + void setCreatureType(int type); + /** * Sets the NPC's retaliation type. * @@ -1462,6 +1976,20 @@ public interface ICustomNpc extends IEntityLiving, */ String getOverlayTexture(); + /** + * Returns the NPC's glow texture path. + * + * @return the glow texture path, or empty string if none. + */ + String getGlowTexture(); + + /** + * Sets the NPC's glow texture path. + * + * @param texture the glow texture path. + */ + void setGlowTexture(String texture); + /** * Returns the NPC's overlay handler. * diff --git a/java/noppes/npcs/api/entity/data/IHitboxData.java b/java/noppes/npcs/api/entity/data/IHitboxData.java new file mode 100644 index 0000000..eb5a244 --- /dev/null +++ b/java/noppes/npcs/api/entity/data/IHitboxData.java @@ -0,0 +1,54 @@ +package noppes.npcs.api.entity.data; + +/** + * Provides configuration data for an NPC's custom hitbox dimensions. + *

+ * When enabled, allows independent scaling of the NPC's collision box + * width and height beyond the default model-based sizing. + */ +public interface IHitboxData { + + /** + * Returns whether the custom hitbox is enabled. + * + * @return true if the custom hitbox is enabled, false otherwise. + */ + boolean isHitboxEnabled(); + + /** + * Sets whether the custom hitbox is enabled. + * + * @param enabled true to enable, false to disable. + */ + void setHitboxEnabled(boolean enabled); + + /** + * Returns the width scale factor for the hitbox. + * + * @return the width scale factor (1.0 = default). + */ + float getWidthScale(); + + /** + * Sets the width scale factor for the hitbox. + * Clamped to the server-configured maximum. + * + * @param widthScale the width scale factor. + */ + void setWidthScale(float widthScale); + + /** + * Returns the height scale factor for the hitbox. + * + * @return the height scale factor (1.0 = default). + */ + float getHeightScale(); + + /** + * Sets the height scale factor for the hitbox. + * Clamped to the server-configured maximum. + * + * @param heightScale the height scale factor. + */ + void setHeightScale(float heightScale); +} diff --git a/java/noppes/npcs/api/entity/data/ITintData.java b/java/noppes/npcs/api/entity/data/ITintData.java new file mode 100644 index 0000000..1787b18 --- /dev/null +++ b/java/noppes/npcs/api/entity/data/ITintData.java @@ -0,0 +1,94 @@ +package noppes.npcs.api.entity.data; + +/** + * Provides configuration data for an NPC's color tinting effects. + *

+ * Controls both the hurt tint (flash color when damaged) and a persistent + * general tint overlay applied to the NPC's model. + */ +public interface ITintData { + + /** + * Returns whether the tint system is enabled. + * + * @return true if tinting is enabled, false otherwise. + */ + boolean isTintEnabled(); + + /** + * Sets whether the tint system is enabled. + * + * @param enabled true to enable, false to disable. + */ + void setTintEnabled(boolean enabled); + + /** + * Returns whether the hurt tint effect is enabled. + * + * @return true if hurt tint is enabled, false otherwise. + */ + boolean isHurtTintEnabled(); + + /** + * Sets whether the hurt tint effect is enabled. + * + * @param enabled true to enable, false to disable. + */ + void setHurtTintEnabled(boolean enabled); + + /** + * Returns whether the general (persistent) tint is enabled. + * + * @return true if general tint is enabled, false otherwise. + */ + boolean isGeneralTintEnabled(); + + /** + * Sets whether the general (persistent) tint is enabled. + * + * @param enabled true to enable, false to disable. + */ + void setGeneralTintEnabled(boolean enabled); + + /** + * Returns the hurt tint color as an RGB integer (e.g. 0xff0000 for red). + * + * @return the hurt tint color. + */ + int getHurtTint(); + + /** + * Sets the hurt tint color as an RGB integer. + * + * @param color the hurt tint color (e.g. 0xff0000 for red). + */ + void setHurtTint(int color); + + /** + * Returns the general tint color as an RGB integer. + * + * @return the general tint color. + */ + int getGeneralTint(); + + /** + * Sets the general tint color as an RGB integer. + * + * @param color the general tint color. + */ + void setGeneralTint(int color); + + /** + * Returns the alpha (opacity) of the general tint overlay (0-255). + * + * @return the general tint alpha value. + */ + int getGeneralAlpha(); + + /** + * Sets the alpha (opacity) of the general tint overlay (0-255). + * + * @param alpha the general tint alpha value. + */ + void setGeneralAlpha(int alpha); +}