diff --git a/java/noppes/npcs/api/entity/IAnimal.java b/java/noppes/npcs/api/entity/IAnimal.java index dc3343c..d89cff0 100644 --- a/java/noppes/npcs/api/entity/IAnimal.java +++ b/java/noppes/npcs/api/entity/IAnimal.java @@ -1,27 +1,66 @@ -package noppes.npcs.api.entity; - -import net.minecraft.entity.passive.EntityAnimal; -import noppes.npcs.api.item.IItemStack; - -public interface IAnimal extends IEntityLiving { - /** - * Checks if the parameter is an item which this animal can be fed to breed it (wheat, carrots or seeds depending on - * the animal type) - */ - boolean isBreedingItem(IItemStack itemStack); - - /** - * Called when a player interacts with a mob. e.g. gets milk from a cow, gets into the saddle on a pig - */ - boolean interact(IPlayer player); - - void setFollowPlayer(IPlayer player); - - IPlayer followingPlayer(); - - boolean isInLove(); - - void resetInLove(); - - boolean canMateWith(IAnimal animal); -} +package noppes.npcs.api.entity; + +import net.minecraft.entity.passive.EntityAnimal; +import noppes.npcs.api.item.IItemStack; + +/** + * Represents an animal entity with additional behavior such as breeding, + * following, and mating. + * + * @param the underlying Minecraft EntityAnimal type. + */ +public interface IAnimal extends IEntityLiving { + + /** + * Checks whether the specified item can be used to breed this animal. + * (e.g. wheat, carrots or seeds depending on the animal type) + * + * @param itemStack the item to test. + * @return true if the item is a breeding item; false otherwise. + */ + boolean isBreedingItem(IItemStack itemStack); + + /** + * Called when a player interacts with the animal. + * For example, this might return true if the player milks a cow or saddles a pig. + * + * @param player the interacting player. + * @return true if the interaction was handled; false otherwise. + */ + boolean interact(IPlayer player); + + /** + * Sets the specified player as the one to follow. + * + * @param player the player to follow. + */ + void setFollowPlayer(IPlayer player); + + /** + * Returns the player that this animal is currently following. + * + * @return the following player, or null if not following anyone. + */ + IPlayer followingPlayer(); + + /** + * Checks if the animal is currently in a "love" state, + * indicating readiness to mate. + * + * @return true if the animal is in love; false otherwise. + */ + boolean isInLove(); + + /** + * Resets the animal's love state. + */ + void resetInLove(); + + /** + * Checks if this animal can mate with another animal. + * + * @param animal the other animal. + * @return true if mating is possible; false otherwise. + */ + boolean canMateWith(IAnimal animal); +} diff --git a/java/noppes/npcs/api/entity/IAnimatable.java b/java/noppes/npcs/api/entity/IAnimatable.java index 9d7fbc9..73ac636 100644 --- a/java/noppes/npcs/api/entity/IAnimatable.java +++ b/java/noppes/npcs/api/entity/IAnimatable.java @@ -2,7 +2,16 @@ package noppes.npcs.api.entity; import noppes.npcs.api.handler.data.IAnimationData; +/** + * Represents an entity capable of playing animations. + * Provides access to its animation data. + */ public interface IAnimatable { + /** + * Returns the animation data associated with this entity. + * + * @return the animation data. + */ IAnimationData getAnimationData(); } diff --git a/java/noppes/npcs/api/entity/ICustomNpc.java b/java/noppes/npcs/api/entity/ICustomNpc.java index 89d370e..40e2a12 100644 --- a/java/noppes/npcs/api/entity/ICustomNpc.java +++ b/java/noppes/npcs/api/entity/ICustomNpc.java @@ -1479,5 +1479,10 @@ public interface ICustomNpc extends IEntityLiving, */ IActionManager getActionManager(); + /** + * Returns the Magic Data of an NPC + * + * @return Magic data + */ IMagicData getMagicData(); } diff --git a/java/noppes/npcs/api/entity/IDBCPlayer.java b/java/noppes/npcs/api/entity/IDBCPlayer.java index cfb9c70..80c1a8b 100644 --- a/java/noppes/npcs/api/entity/IDBCPlayer.java +++ b/java/noppes/npcs/api/entity/IDBCPlayer.java @@ -1,110 +1,489 @@ -package noppes.npcs.api.entity; - -import noppes.npcs.api.item.IItemStack; - -public interface IDBCPlayer extends IPlayer { - - void setStat(String stat, int value); - int getStat(String stat); - - void addBonusAttribute(String stat, String bonusID, String operation, double attributeValue); - void addBonusAttribute(String stat, String bonusID, String operation, double attributeValue, boolean endOfTheList); - void addToBonusAttribute(String stat, String bonusID, String operation, double attributeValue); - void setBonusAttribute(String stat, String bonusID, String operation, double attributeValue); - void getBonusAttribute(String stat, String bonusID); - void removeBonusAttribute(String stat, String bonusID); - void clearBonusAttribute(String stat); - - String bonusAttribute(String action, String stat, String bonusID); - - String bonusAttribute(String action, String stat, String bonusID, String operation, double attributeValue, boolean endOfTheList); - - void setRelease(byte release); - byte getRelease(); - - void setBody(int body); - int getBody(); - - void setHP(int hp); - int getHP(); - - void setStamina(int stamina); - int getStamina(); - - void setKi(int ki); - int getKi(); - - void setTP(int tp); - int getTP(); - - void setGravity(float gravity); - float getGravity(); - - boolean isBlocking(); - - void setHairCode(String hairCode); - String getHairCode(); - - void setExtraCode(String extraCode); - String getExtraCode(); - - /** - * @param slot The DBC extra inventory slot the item stack parameter will go into: - * 0 - Weight - * 1 - Body - * 2 - Head - * 3 - 4th Vanity Slot Down to the left - * 4 - 3rd Vanity Slot Down to the left - * 5 - 2nd Vanity Slot Down to the left - * 6 - 1st Vanity Slot Down to the left - * 7 - 4th Vanity Slot Down to the right - * 8 - 3rd Vanity Slot Down to the right - * 9 - 2nd Vanity Slot Down to the right - * 10 - 1st Vanity Slot Down to the right - * @param itemStack The item stack to be set into the slot. Set to null to remove the stack in that slot. - */ - void setItem(IItemStack itemStack, byte slot, boolean vanity); - IItemStack getItem(byte slot, boolean vanity); - IItemStack[] getInventory(); - - void setForm(byte form); - byte getForm(); - void setForm2(byte form2); - byte getForm2(); - - double getRacialFormMastery(byte form); - void setRacialFormMastery(byte form, double value); - void addRacialFormMastery(byte form, double value); - - double getOtherFormMastery(String formName); - void setOtherFormMastery(String formName, double value); - void addOtherFormMastery(String formName, double value); - - void setPowerPoints(int points); - int getPowerPoints(); - - void setAuraColor(int color); - int getAuraColor(); - - void setFormLevel(int level); - int getFormLevel(); - - void setSkills(String skills); - String getSkills(); - - void setJRMCSE(String statusEffects); - String getJRMCSE(); - - void setRace(byte race); - int getRace(); - - void setDBCClass(byte dbcClass); - byte getDBCClass(); - - void setPowerType(byte powerType); - int getPowerType(); - - int getKillCount(String type); - - String getFusionString(); -} +package noppes.npcs.api.entity; + +import noppes.npcs.api.item.IItemStack; + +/** + * Extends IPlayer with additional methods specific to DBC (Dragon Ball C) players. + * These methods manage stats, bonus attributes, form configurations, inventory, and more. + */ +public interface IDBCPlayer extends IPlayer { + + /** + * Sets the specified stat to the given value. + * + * @param stat the stat name (e.g. "str", "dex", "con", "wil", "mnd", "spi"). + * @param value the new value. + */ + void setStat(String stat, int value); + + /** + * Retrieves the value of the specified stat. + * + * @param stat the stat name. + * @return the stat value. + */ + int getStat(String stat); + + /** + * Adds a bonus attribute for the specified stat. + * + * @param stat the stat name. + * @param bonusID the identifier for the bonus. + * @param operation the arithmetic operation to apply. + * @param attributeValue the attribute value. + */ + void addBonusAttribute(String stat, String bonusID, String operation, double attributeValue); + + /** + * Adds a bonus attribute for the specified stat. + * + * @param stat the stat name. + * @param bonusID the identifier for the bonus. + * @param operation the arithmetic operation to apply. + * @param attributeValue the attribute value. + * @param endOfTheList whether to add the bonus at the end of the list. + */ + void addBonusAttribute(String stat, String bonusID, String operation, double attributeValue, boolean endOfTheList); + + /** + * Increases an existing bonus attribute for the specified stat. + * + * @param stat the stat name. + * @param bonusID the identifier for the bonus. + * @param operation the arithmetic operation. + * @param attributeValue the value to add. + */ + void addToBonusAttribute(String stat, String bonusID, String operation, double attributeValue); + + /** + * Sets a bonus attribute for the specified stat. + * + * @param stat the stat name. + * @param bonusID the identifier for the bonus. + * @param operation the arithmetic operation. + * @param attributeValue the value to set. + */ + void setBonusAttribute(String stat, String bonusID, String operation, double attributeValue); + + /** + * Retrieves a bonus attribute for the specified stat. + * + * @param stat the stat name. + * @param bonusID the identifier for the bonus. + */ + void getBonusAttribute(String stat, String bonusID); + + /** + * Removes the bonus attribute with the given identifier for the specified stat. + * + * @param stat the stat name. + * @param bonusID the bonus identifier. + */ + void removeBonusAttribute(String stat, String bonusID); + + /** + * Clears all bonus attributes for the specified stat. + * + * @param stat the stat name. + */ + void clearBonusAttribute(String stat); + + /** + * Retrieves a bonus attribute string based on an action. + * + * @param action the action (get, remove, or clear). + * @param stat the stat name. + * @param bonusID the bonus identifier. + * @return the bonus attribute string. + */ + String bonusAttribute(String action, String stat, String bonusID); + + /** + * Retrieves a bonus attribute string with full parameters. + * + * @param action the action (add, addto, set, get, remove, or clear). + * @param stat the stat name. + * @param bonusID the bonus identifier. + * @param operation the arithmetic operation. + * @param attributeValue the attribute value. + * @param endOfTheList whether to add at the end of the list. + * @return the bonus attribute string. + */ + String bonusAttribute(String action, String stat, String bonusID, String operation, double attributeValue, boolean endOfTheList); + + /** + * Sets the release state. + * + * @param release the release value. + */ + void setRelease(byte release); + + /** + * Returns the current release state. + * + * @return the release value. + */ + byte getRelease(); + + /** + * Sets the body value. Also HP. + * + * @param body the body value. + */ + void setBody(int body); + + /** + * Returns the body value. Also HP. + * + * @return the body. + */ + int getBody(); + + /** + * Sets the HP value. + * + * @param hp the HP value. + */ + void setHP(int hp); + + /** + * Returns the HP value. + * + * @return the HP. + */ + int getHP(); + + /** + * Sets the stamina value. + * + * @param stamina the stamina value. + */ + void setStamina(int stamina); + + /** + * Returns the stamina value. + * + * @return the stamina. + */ + int getStamina(); + + /** + * Sets the Ki value. + * + * @param ki Ki value. + */ + void setKi(int ki); + + /** + * Returns the Ki value. + * + * @return Ki of Player. + */ + int getKi(); + + /** + * Sets the TP value. + * + * @param tp Set TP Amount + */ + void setTP(int tp); + + /** + * Returns the TP value. + * + * @return Player TP Amount + */ + int getTP(); + + /** + * Sets the gravity for the player. + * + * @param gravity the gravity value. + */ + void setGravity(float gravity); + + /** + * Returns the current gravity value. + * + * @return the gravity. + */ + float getGravity(); + + /** + * Checks if the player is blocking. + * + * @return true if blocking; false otherwise. + */ + boolean isBlocking(); + + /** + * Sets the hair code used to define the player's hairstyle. + * + * @param hairCode the hair code string. + */ + void setHairCode(String hairCode); + + /** + * Returns the player's hair code. + * + * @return the hair code string. + */ + String getHairCode(); + + /** + * Sets the extra code used for additional customization. + * + * @param extraCode the extra code string. + */ + void setExtraCode(String extraCode); + + /** + * Returns the player's extra code. + * + * @return the extra code string. + */ + String getExtraCode(); + + /** + * Sets an item in the DBC extra inventory slot. + *

+ * Slot definitions: + *

    + *
  • 0 - Weight
  • + *
  • 1 - Body
  • + *
  • 2 - Head
  • + *
  • 3 - 4th Vanity Slot Down to the left
  • + *
  • 4 - 3rd Vanity Slot Down to the left
  • + *
  • 5 - 2nd Vanity Slot Down to the left
  • + *
  • 6 - 1st Vanity Slot Down to the left
  • + *
  • 7 - 4th Vanity Slot Down to the right
  • + *
  • 8 - 3rd Vanity Slot Down to the right
  • + *
  • 9 - 2nd Vanity Slot Down to the right
  • + *
  • 10 - 1st Vanity Slot Down to the right
  • + *
+ * + * @param itemStack the item to set (or null to remove). + * @param slot the slot index. + * @param vanity whether the slot is in the vanity inventory. + */ + void setItem(IItemStack itemStack, byte slot, boolean vanity); + + /** + * Retrieves the item from the specified DBC inventory slot. + * + * @param slot the slot index. + * @param vanity whether the slot is in the vanity inventory. + * @return the item stack, or null if empty. + */ + IItemStack getItem(byte slot, boolean vanity); + + /** + * Returns the entire DBC extra inventory. + * + * @return an array of item stacks. + */ + IItemStack[] getInventory(); + + /** + * Sets the player's form. + * + * @param form the form value. + */ + void setForm(byte form); + + /** + * Returns the player's current form. + * + * @return the form value. + */ + byte getForm(); + + /** + * Sets the player's secondary form. + * + * @param form2 the secondary form value. + */ + void setForm2(byte form2); + + /** + * Returns the player's secondary form. + * + * @return the secondary form value. + */ + byte getForm2(); + + /** + * Returns the mastery value for a specific racial form. + * + * @param form the form index. + * @return the mastery value. + */ + double getRacialFormMastery(byte form); + + /** + * Sets the mastery value for a specific racial form. + * + * @param form the form index. + * @param value the new mastery value. + */ + void setRacialFormMastery(byte form, double value); + + /** + * Adds to the mastery value for a specific racial form. + * + * @param form the form index. + * @param value the value to add. + */ + void addRacialFormMastery(byte form, double value); + + /** + * Returns the mastery value for a non-racial (other) form. + * + * @param formName the name of the form. + * @return the mastery value. + */ + double getOtherFormMastery(String formName); + + /** + * Sets the mastery value for a non-racial (other) form. + * + * @param formName the name of the form. + * @param value the new mastery value. + */ + void setOtherFormMastery(String formName, double value); + + /** + * Adds to the mastery value for a non-racial (other) form. + * + * @param formName the name of the form. + * @param value the value to add. + */ + void addOtherFormMastery(String formName, double value); + + /** + * Sets the player's power points. + * + * @param points the power points. + */ + void setPowerPoints(int points); + + /** + * Returns the player's power points. + * + * @return the power points. + */ + int getPowerPoints(); + + /** + * Sets the player's aura color. + * + * @param color the aura color. + */ + void setAuraColor(int color); + + /** + * Returns the player's aura color. + * + * @return the aura color. + */ + int getAuraColor(); + + /** + * Sets the player's form level. + * + * @param level the form level. + */ + void setFormLevel(int level); + + /** + * Returns the player's form level. + * + * @return the form level. + */ + int getFormLevel(); + + /** + * Sets the player's skills. + * + * @param skills a string representing the player's skills. + */ + void setSkills(String skills); + + /** + * Returns the player's skills. + * + * @return a string representing the player's skills. + */ + String getSkills(); + + /** + * Sets the player's status effects. + * + * @param statusEffects a string representing status effects. + */ + void setJRMCSE(String statusEffects); + + /** + * Returns the player's status effects. + * + * @return a string representing the player's status effects. + */ + String getJRMCSE(); + + /** + * Sets the player's race. + * + * @param race the race value. + */ + void setRace(byte race); + + /** + * Returns the player's race. + * + * @return the race value. + */ + int getRace(); + + /** + * Sets the player's DBC class. + * + * @param dbcClass the DBC class value. + */ + void setDBCClass(byte dbcClass); + + /** + * Returns the player's DBC class. + * + * @return the DBC class. + */ + byte getDBCClass(); + + /** + * Sets the player's power type. + * + * @param powerType the power type. + */ + void setPowerType(byte powerType); + + /** + * Returns the player's power type. + * + * @return the power type. + */ + int getPowerType(); + + /** + * Returns the player's kill count for a given type. + * + * @param type the kill count type ("evil", "good", "neutral", or "all"). + * @return the kill count. + */ + int getKillCount(String type); + + /** + * Returns the fusion string for the player. + * + * @return the fusion string. + */ + String getFusionString(); +} diff --git a/java/noppes/npcs/api/entity/IEntity.java b/java/noppes/npcs/api/entity/IEntity.java index 052e035..406da65 100644 --- a/java/noppes/npcs/api/entity/IEntity.java +++ b/java/noppes/npcs/api/entity/IEntity.java @@ -1,370 +1,601 @@ -package noppes.npcs.api.entity; - -import net.minecraft.entity.Entity; -import noppes.npcs.api.INbt; -import noppes.npcs.api.IParticle; -import noppes.npcs.api.IPos; -import noppes.npcs.api.IWorld; -import noppes.npcs.api.item.IItemStack; - -public interface IEntity { - - void spawnParticle(IParticle entityParticle); - - int getEntityId(); - - String getUniqueID(); - - double getYOffset(); - - /** - * @return The entities width - */ - double getWidth(); - - /** - * @return The entities height - */ - double getHeight(); - - /** - * @return The entities x position - */ - double getX(); - - /** - * @param x The entities x position - */ - void setX(double x); - - /** - * @return The entities y position - */ - double getY(); - - /** - * @param y The entities y position - */ - void setY(double y); - - /** - * @return The entities x position - */ - double getZ(); - - /** - * @param z The entities x position - */ - void setZ(double z); - - /** - * @return The entities z motion - */ - double getMotionX(); - - /** - * @param x The entities x motion - */ - void setMotionX(double x); - - /** - * @return The entities x motion - */ - double getMotionY(); - - /** - * @param y The entities y motion - */ - void setMotionY(double y); - - /** - * @return The entities y motion - */ - double getMotionZ(); - - /** - * @param z The entities z motion - */ - void setMotionZ(double z); - - void setMotion(double x, double y, double z); - - void setMotion(IPos pos); - - IPos getMotion(); - - boolean isAirborne(); - - /** - * @return The block x position - */ - int getBlockX(); - - /** - * @return The block y position - */ - int getBlockY(); - - /** - * @return The block z position - */ - int getBlockZ(); - - /** - * @param x The x position - * @param y The y position - * @param z The z position - */ - void setPosition(double x, double y, double z); - - void setPosition(IPos pos); - - IPos getPosition(); - - int getDimension(); - - void setDimension(int dimensionId); - - /** - * @param range The search range for entities around this entity - * @return Array of entities within range - */ - IEntity[] getSurroundingEntities(int range); - - /** - * @param range The search range for entities around this entity - * @param type The EntityType you want to find - * @return Array of entities within range - */ - IEntity[] getSurroundingEntities(int range, int type); - - /** - * @return Whether the entity is alive or not - */ - boolean isAlive(); - - /** - * @param key Get temp data for this key - * @return Returns the stored temp data - */ - Object getTempData(String key); - - /** - * Tempdata gets cleared when the entity gets unloaded or the world restarts - * @param key The key for the data stored - * @param value The data stored - */ - void setTempData(String key, Object value); - - /** - * @param key The key thats going to be tested against the temp data - * @return Whether or not temp data containes the key - */ - boolean hasTempData(String key); - - /** - * @param key The key for the temp data to be removed - */ - void removeTempData(String key); - - /** - * Remove all tempdata - */ - void clearTempData(); - - String[] getTempDataKeys(); - - /** - * @param key The key of the data to be returned - * @return Returns the stored data - */ - Object getStoredData(String key); - - /** - * Stored data persists through world restart. Unlike tempdata only Strings and Numbers can be saved - * @param key The key for the data stored - * @param value The data stored. This data can be either a Number or a String. Other data is not stored - */ - void setStoredData(String key, Object value); - - /** - * @param key The key of the data to be checked - * @return Returns whether or not the stored data contains the key - */ - boolean hasStoredData(String key); - - /** - * @param key The key of the data to be removed - */ - void removeStoredData(String key); - - /** - * Remove all stored data - */ - void clearStoredData(); - - String[] getStoredDataKeys(); - - /** - * @return The age of this entity in ticks - */ - long getAge(); - - /** - * Despawns this entity. Removes it permanently - */ - void despawn(); - - /** - * @return Return whether or not this entity is standing in water - */ - boolean inWater(); - - /** - * @return Return whether or not this entity is standing in lava - */ - boolean inLava(); - - /** - * @return Return whether or not this entity is standing in fire - */ - boolean inFire(); - - /** - * @return Return whether or not this entity is on fire - */ - boolean isBurning(); - - /** - * @param ticks Amount of world ticks this entity will burn. 20 ticks equals 1 second - */ - void setBurning(int ticks); - - /** - * Removes fire from this entity - */ - void extinguish(); - - /** - * @return Name as which it's registered in minecraft - */ - String getTypeName(); - - /** - * @param item Item to be dropped - */ - void dropItem(IItemStack item); - - /** - * @return Return the rider - */ - IEntity getRider(); - - /** - * @param entity The entity to ride this entity - */ - void setRider(IEntity entity); - - /** - * @return Return the entity, this entity is riding - */ - IEntity getMount(); - - /** - * @param entity The entity this entity will mount - */ - void setMount(IEntity entity); - - /** - * @see noppes.npcs.scripted.constants.EntityType - * @return Returns the EntityType of this entity - */ - int getType(); - - /** - * @since 1.7.10c - * @param type @EntityType to check - * @return Returns whether the entity is type of the given @EntityType - */ - boolean typeOf(int type); - - /** - * @param rotation The rotation to be set (0-360) - */ - void setRotation(float rotation); - - void setRotation(float rotationYaw, float rotationPitch); - - /** - * @return Current rotation of the npc - */ - float getRotation(); - - public void setPitch(float pitch); - - public float getPitch(); - - /** - * @param power How strong the knockback is - * @param direction The direction in which he flies back (0-360). Usually based on getRotation() - */ - void knockback(int power, float direction); - - void knockback(double xpower, double ypower, double zpower, float direction); - void knockback(IPos pos, float direction); - - void setImmune(int ticks); - - public void setInvisible(boolean invisible); - - public void setSneaking(boolean sneaking); - - public void setSprinting(boolean sprinting); - - boolean hasCollided(); - - boolean hasCollidedVertically(); - - boolean hasCollidedHorizontally(); - - boolean capturesDrops(); - - void setCapturesDrops(boolean capture); - - void setCapturedDrops(IEntity[] capturedDrops); - - IEntity[] getCapturedDrops(); - - /** - * @since 1.7.10c - * @return Returns whether or not this entity is sneaking - */ - boolean isSneaking(); - - /** - * @since 1.7.10c - * @return Returns whether or not this entity is sprinting - */ - boolean isSprinting(); - - /** - * @since 1.7.10c - * Expert users only - * @return Returns minecrafts entity - */ - T getMCEntity(); - - public INbt getNbt(); - - public INbt getAllNbt(); - - public void setNbt(INbt nbt); - - INbt getNbtOptional(); - - void storeAsClone(int tab, String name); - - IWorld getWorld(); - - void updateEntity(); -} +package noppes.npcs.api.entity; + +import net.minecraft.entity.Entity; +import noppes.npcs.api.INbt; +import noppes.npcs.api.IParticle; +import noppes.npcs.api.IPos; +import noppes.npcs.api.IWorld; +import noppes.npcs.api.item.IItemStack; + +/** + * Represents a generic entity in the world. + * Provides methods to access or modify the entity's position, motion, temporary and persistent data, + * and to perform various actions (such as spawning particles, dropping items, or changing dimensions). + * + * @param The underlying Minecraft entity type. + */ +public interface IEntity { + + /** + * Spawns the given particle effect associated with this entity. + * + * @param entityParticle The particle effect to spawn. + */ + void spawnParticle(IParticle entityParticle); + + /** + * Returns the unique entity ID. + * + * @return the entity ID. + */ + int getEntityId(); + + /** + * Returns the unique UUID string of the entity. + * + * @return the unique ID. + */ + String getUniqueID(); + + /** + * Returns the vertical offset for rendering. + * + * @return the Y offset. + */ + double getYOffset(); + + /** + * @return The entity's width. + */ + double getWidth(); + + /** + * @return The entity's height. + */ + double getHeight(); + + /** + * @return The entity's x position. + */ + double getX(); + + /** + * Sets the entity's x position. + * + * @param x the new x position. + */ + void setX(double x); + + /** + * @return The entity's y position. + */ + double getY(); + + /** + * Sets the entity's y position. + * + * @param y the new y position. + */ + void setY(double y); + + /** + * @return The entity's z position. + */ + double getZ(); + + /** + * Sets the entity's z position. + * + * @param z the new z position. + */ + void setZ(double z); + + /** + * @return The entity's x motion. + */ + double getMotionX(); + + /** + * Sets the entity's x motion. + * + * @param x the new x motion. + */ + void setMotionX(double x); + + /** + * @return The entity's y motion. + */ + double getMotionY(); + + /** + * Sets the entity's y motion. + * + * @param y the new y motion. + */ + void setMotionY(double y); + + /** + * @return The entity's z motion. + */ + double getMotionZ(); + + /** + * Sets the entity's z motion. + * + * @param z the new z motion. + */ + void setMotionZ(double z); + + /** + * Convenience method to set the entity's motion in all three axes. + * + * @param x the x motion. + * @param y the y motion. + * @param z the z motion. + */ + void setMotion(double x, double y, double z); + + /** + * Sets the entity's motion based on the given position. + * + * @param pos the position containing motion components. + */ + void setMotion(IPos pos); + + /** + * Returns the entity's current motion as an IPos object. + * + * @return the motion vector. + */ + IPos getMotion(); + + /** + * @return Whether the entity is airborne. + */ + boolean isAirborne(); + + /** + * @return The block (integer) x position. + */ + int getBlockX(); + + /** + * @return The block (integer) y position. + */ + int getBlockY(); + + /** + * @return The block (integer) z position. + */ + int getBlockZ(); + + /** + * Sets the entity's position to the specified coordinates. + * + * @param x the x coordinate. + * @param y the y coordinate. + * @param z the z coordinate. + */ + void setPosition(double x, double y, double z); + + /** + * Sets the entity's position using an IPos object. + * + * @param pos the position object. + */ + void setPosition(IPos pos); + + /** + * Returns the entity's current position as an IPos object. + * + * @return the position. + */ + IPos getPosition(); + + /** + * @return The dimension ID the entity is in. + */ + int getDimension(); + + /** + * Moves the entity to the specified dimension. + * + * @param dimensionId the dimension ID. + */ + void setDimension(int dimensionId); + + /** + * Returns an array of entities within the specified range. + * + * @param range the search range. + * @return an array of surrounding entities. + */ + IEntity[] getSurroundingEntities(int range); + + /** + * Returns an array of entities of a specified type within the given range. + * + * @param range the search range. + * @param type the EntityType to find. + * @return an array of surrounding entities. + */ + IEntity[] getSurroundingEntities(int range, int type); + + /** + * @return Whether the entity is alive. + */ + boolean isAlive(); + + /** + * Returns temporary data stored under the given key. + * + * @param key the key. + * @return the temporary data. + */ + Object getTempData(String key); + + /** + * Stores temporary data that is cleared when the entity is unloaded. + * + * @param key the key. + * @param value the value. + */ + void setTempData(String key, Object value); + + /** + * Checks if temporary data for the given key exists. + * + * @param key the key. + * @return true if it exists; false otherwise. + */ + boolean hasTempData(String key); + + /** + * Removes the temporary data for the given key. + * + * @param key the key. + */ + void removeTempData(String key); + + /** + * Clears all temporary data. + */ + void clearTempData(); + + /** + * Returns an array of keys for temporary data. + * + * @return the keys. + */ + String[] getTempDataKeys(); + + /** + * Returns stored (persistent) data for the given key. + * + * @param key the key. + * @return the stored data. + */ + Object getStoredData(String key); + + /** + * Stores persistent data under the given key. + * Only Numbers and Strings are supported. + * + * @param key the key. + * @param value the value. + */ + void setStoredData(String key, Object value); + + /** + * Checks if stored data for the given key exists. + * + * @param key the key. + * @return true if it exists; false otherwise. + */ + boolean hasStoredData(String key); + + /** + * Removes the stored data for the given key. + * + * @param key the key. + */ + void removeStoredData(String key); + + /** + * Clears all stored data. + */ + void clearStoredData(); + + /** + * Returns an array of keys for stored data. + * + * @return the keys. + */ + String[] getStoredDataKeys(); + + /** + * @return The age of the entity in ticks. + */ + long getAge(); + + /** + * Permanently despawns the entity. + */ + void despawn(); + + /** + * @return Whether the entity is standing in water. + */ + boolean inWater(); + + /** + * @return Whether the entity is standing in lava. + */ + boolean inLava(); + + /** + * @return Whether the entity is standing in fire. + */ + boolean inFire(); + + /** + * @return Whether the entity is on fire. + */ + boolean isBurning(); + + /** + * Sets the entity on fire for the given number of ticks (20 ticks = 1 second). + * + * @param ticks the burn duration. + */ + void setBurning(int ticks); + + /** + * Extinguishes any fire on the entity. + */ + void extinguish(); + + /** + * @return The entity type name as registered in Minecraft. + */ + String getTypeName(); + + /** + * Causes the entity to drop the given item. + * + * @param item the item to drop. + */ + void dropItem(IItemStack item); + + /** + * @return The entity riding this entity. + */ + IEntity getRider(); + + /** + * Sets the given entity as the rider of this entity. + * + * @param entity the rider. + */ + void setRider(IEntity entity); + + /** + * @return The entity this entity is riding. + */ + IEntity getMount(); + + /** + * Sets the entity to be mounted by this entity. + * + * @param entity the mount. + */ + void setMount(IEntity entity); + + /** + * Returns the EntityType as defined in the scripting constants. + * + * @return the EntityType. + */ + int getType(); + + /** + * Checks whether the entity is of the specified EntityType. + * + * @param type the type to check. + * @return true if the entity is of that type; false otherwise. + */ + boolean typeOf(int type); + + /** + * Sets the entity's rotation (yaw) in degrees (0-360). + * + * @param rotation the rotation angle. + */ + void setRotation(float rotation); + + /** + * Sets both the rotation (yaw) and pitch of the entity. + * + * @param rotationYaw the yaw angle. + * @param rotationPitch the pitch angle. + */ + void setRotation(float rotationYaw, float rotationPitch); + + /** + * @return The current rotation (yaw) of the entity. + */ + float getRotation(); + + /** + * Sets the entity's pitch. + * + * @param pitch the pitch angle. + */ + void setPitch(float pitch); + + /** + * Returns the entity's pitch. + * + * @return the pitch angle. + */ + float getPitch(); + + /** + * Applies a knockback effect to the entity. + * + * @param power the strength of the knockback. + * @param direction the direction in degrees (usually based on getRotation()). + */ + void knockback(int power, float direction); + + /** + * Applies knockback using individual power components. + * + * @param xpower the x-axis power. + * @param ypower the y-axis power. + * @param zpower the z-axis power. + * @param direction the direction in degrees. + */ + void knockback(double xpower, double ypower, double zpower, float direction); + + /** + * Applies knockback using a position vector. + * + * @param pos the position vector. + * @param direction the direction in degrees. + */ + void knockback(IPos pos, float direction); + + /** + * Sets the entity's immunity time (hurt resistance). + * + * @param ticks the number of ticks. + */ + void setImmune(int ticks); + + /** + * Sets the entity's invisibility. + * + * @param invisible true to make invisible. + */ + void setInvisible(boolean invisible); + + /** + * Sets whether the entity is sneaking. + * + * @param sneaking true to enable sneaking. + */ + void setSneaking(boolean sneaking); + + /** + * Sets whether the entity is sprinting. + * + * @param sprinting true to enable sprinting. + */ + void setSprinting(boolean sprinting); + + /** + * @return Whether the entity has collided with something. + */ + boolean hasCollided(); + + /** + * @return Whether the entity has collided vertically. + */ + boolean hasCollidedVertically(); + + /** + * @return Whether the entity has collided horizontally. + */ + boolean hasCollidedHorizontally(); + + /** + * @return Whether the entity is capturing drops. + */ + boolean capturesDrops(); + + /** + * Sets whether the entity captures drops. + * + * @param capture true to capture drops. + */ + void setCapturesDrops(boolean capture); + + /** + * Sets the captured drops for this entity. + * + * @param capturedDrops an array of captured drops. + */ + void setCapturedDrops(IEntity[] capturedDrops); + + /** + * Returns the captured drops. + * + * @return an array of captured drops. + */ + IEntity[] getCapturedDrops(); + + /** + * @since 1.7.10c + * @return Whether the entity is sneaking. + */ + boolean isSneaking(); + + /** + * @since 1.7.10c + * @return Whether the entity is sprinting. + */ + boolean isSprinting(); + + /** + * Expert users only. + * @return The underlying Minecraft entity. + */ + T getMCEntity(); + + /** + * Returns the entity's NBT data. + * + * @return the NBT data. + */ + INbt getNbt(); + + /** + * Returns all NBT data for the entity. + * + * @return the complete NBT data. + */ + INbt getAllNbt(); + + /** + * Applies the given NBT data to the entity. + * + * @param nbt the NBT data. + */ + void setNbt(INbt nbt); + + /** + * Returns optional NBT data if available. + * + * @return the optional NBT data, or null if none. + */ + INbt getNbtOptional(); + + /** + * Stores the entity as a clone with the given tab and name. + * + * @param tab the tab index. + * @param name the name for the clone. + */ + void storeAsClone(int tab, String name); + + /** + * @return The world this entity exists in. + */ + IWorld getWorld(); + + /** + * Updates the entity's state. + */ + void updateEntity(); +} diff --git a/java/noppes/npcs/api/entity/IEntityItem.java b/java/noppes/npcs/api/entity/IEntityItem.java index fbbc417..17d6235 100644 --- a/java/noppes/npcs/api/entity/IEntityItem.java +++ b/java/noppes/npcs/api/entity/IEntityItem.java @@ -1,56 +1,91 @@ -package noppes.npcs.api.entity; - -import net.minecraft.entity.item.EntityItem; -import noppes.npcs.api.item.IItemStack; - -public interface IEntityItem extends IEntity { - - /** - * @return The owner of the item, only the owner can pick the item up - */ - public String getOwner(); - - /** - * @param name The owner of the item, only the owner can pick up the item - * (note that the item can also be picked up if the lifetime - age is equal or smaller than 200) - */ - public void setOwner(String name); - - public String getThrower(); - - public void setThrower(String name); - - /** - * @return Ticks remaining before it can be picked up (32767 is infinite) - */ - public int getPickupDelay(); - - /** - * @param delay Delay before the item can be picked up (32767 is infinite delay) - */ - public void setPickupDelay(int delay); - - /** - * @return Returns the age of the item - */ - public long getAge(); - - /** - * @param age Age of the item (-32767 is infinite age) - */ - public void setAge(long age); - - /** - * @return When the age reaches this the item despawns - */ - public int getLifeSpawn(); - - /** - * @param age Age at which the item despawns - */ - public void setLifeSpawn(int age); - - public IItemStack getItem(); - - public void setItem(IItemStack item); -} +package noppes.npcs.api.entity; + +import net.minecraft.entity.item.EntityItem; +import noppes.npcs.api.item.IItemStack; + +/** + * Represents an item entity in the world. + * Provides methods to manage pickup delay, age, ownership, and the contained item. + * + * @param The underlying Minecraft EntityItem type. + */ +public interface IEntityItem extends IEntity { + + /** + * Returns the owner name of the item. + * Only the owner can pick the item up (unless the age is very low). + * + * @return the owner's name. + */ + String getOwner(); + + /** + * Sets the owner name of the item. + * + * @param name the owner's name. + */ + void setOwner(String name); + + /** + * Returns the thrower (entity that threw the item). + * + * @return the thrower's name. + */ + String getThrower(); + + /** + * Sets the thrower (entity that threw the item). + * + * @param name the thrower's name. + */ + void setThrower(String name); + + /** + * @return Ticks remaining before the item can be picked up. + * (32767 indicates an infinite delay.) + */ + int getPickupDelay(); + + /** + * Sets the delay before the item can be picked up. + * + * @param delay the pickup delay in ticks (32767 for infinite delay). + */ + void setPickupDelay(int delay); + + /** + * @return The age of the item in ticks. + */ + long getAge(); + + /** + * Sets the age of the item. + * + * @param age the new age (−32767 indicates infinite age). + */ + void setAge(long age); + + /** + * @return The lifespan threshold; when the age reaches this, the item despawns. + */ + int getLifeSpawn(); + + /** + * Sets the age threshold at which the item will despawn. + * + * @param age the lifespan in ticks. + */ + void setLifeSpawn(int age); + + /** + * @return The item contained in this entity. + */ + IItemStack getItem(); + + /** + * Sets the item contained in this entity. + * + * @param item the item to set. + */ + void setItem(IItemStack item); +} diff --git a/java/noppes/npcs/api/entity/IEntityLiving.java b/java/noppes/npcs/api/entity/IEntityLiving.java index 4fd92f8..86afb01 100644 --- a/java/noppes/npcs/api/entity/IEntityLiving.java +++ b/java/noppes/npcs/api/entity/IEntityLiving.java @@ -1,51 +1,157 @@ -package noppes.npcs.api.entity; - -import net.minecraft.entity.EntityLiving; - -public interface IEntityLiving extends IEntityLivingBase { - boolean isNavigating(); - - void clearNavigation(); - - void navigateTo(double var1, double var3, double var5, double var7); - - T getMCEntity(); - - void playLivingSound(); - - void spawnExplosionParticle(); - - void setMoveForward(float speed); - - void faceEntity(IEntity entity, float pitch, float yaw); - - boolean canPickUpLoot(); - - void setCanPickUpLoot(boolean pickUp); - - boolean isPersistent(); - - void enablePersistence(); - - void setCustomNameTag(String text); - - String getCustomNameTag(); - - boolean hasCustomNameTag(); - - void setAlwaysRenderNameTag(boolean alwaysRender); - - boolean getAlwaysRenderNameTag(); - - void clearLeashed(boolean sendPacket, boolean dropLeash); - - boolean allowLeashing(); - - boolean getLeashed(); - - IEntity getLeashedTo(); - - void setLeashedTo(IEntity entity, boolean sendPacket); - - boolean canBeSteered(); -} +package noppes.npcs.api.entity; + +import net.minecraft.entity.EntityLiving; +import noppes.npcs.api.entity.IEntityLivingBase; + +/** + * Represents a living entity (mob, NPC, etc.) that extends the base living functionality. + * Provides additional methods for navigation, sound, custom name, leashing, and more. + * + * @param The underlying Minecraft EntityLiving type. + */ +public interface IEntityLiving extends IEntityLivingBase { + + /** + * Checks if the entity is currently navigating (pathfinding). + * + * @return true if navigating; false otherwise. + */ + boolean isNavigating(); + + /** + * Clears the current navigation path. + */ + void clearNavigation(); + + /** + * Commands the entity to navigate toward the specified destination. + * + * @param x Destination x coordinate. + * @param y Destination y coordinate. + * @param z Destination z coordinate. + * @param speed Movement speed (0.7 is default). + */ + void navigateTo(double x, double y, double z, double speed); + + /** + * Returns the underlying Minecraft entity. + * + * @return the Minecraft entity. + */ + T getMCEntity(); + + /** + * Plays the entity's living sound. + */ + void playLivingSound(); + + /** + * Spawns explosion particles for this entity. + */ + void spawnExplosionParticle(); + + /** + * Sets the forward movement speed for the entity. + * + * @param speed the forward speed. + */ + void setMoveForward(float speed); + + /** + * Rotates the entity to face the given entity. + * + * @param entity the target entity. + * @param pitch the pitch angle. + * @param yaw the yaw angle. + */ + void faceEntity(IEntity entity, float pitch, float yaw); + + /** + * @return Whether the entity can pick up loot. + */ + boolean canPickUpLoot(); + + /** + * Sets whether the entity can pick up loot. + * + * @param pickUp true to allow picking up loot. + */ + void setCanPickUpLoot(boolean pickUp); + + /** + * @return Whether the entity is persistent (won't despawn). + */ + boolean isPersistent(); + + /** + * Enables persistence so that the entity does not despawn. + */ + void enablePersistence(); + + /** + * Sets a custom name tag for the entity. + * + * @param text the custom name. + */ + void setCustomNameTag(String text); + + /** + * Returns the entity's custom name tag. + * + * @return the custom name. + */ + String getCustomNameTag(); + + /** + * @return Whether the entity has a custom name tag. + */ + boolean hasCustomNameTag(); + + /** + * Sets whether the entity's name tag is always rendered. + * + * @param alwaysRender true to always render the name tag. + */ + void setAlwaysRenderNameTag(boolean alwaysRender); + + /** + * @return Whether the name tag is always rendered. + */ + boolean getAlwaysRenderNameTag(); + + /** + * Clears the entity's leash. + * + * @param sendPacket whether to send a packet update. + * @param dropLeash whether to drop the leash item. + */ + void clearLeashed(boolean sendPacket, boolean dropLeash); + + /** + * @return Whether the entity allows leashing. + */ + boolean allowLeashing(); + + /** + * @return Whether the entity is currently leashed. + */ + boolean getLeashed(); + + /** + * @return The entity to which this entity is leashed. + */ + IEntity getLeashedTo(); + + /** + * Leashes this entity to the specified entity. + * + * @param entity the entity to leash to. + * @param sendPacket whether to send a packet update. + */ + void setLeashedTo(IEntity entity, boolean sendPacket); + + /** + * @return Whether the entity can be steered. + */ + boolean canBeSteered(); +} diff --git a/java/noppes/npcs/api/entity/IEntityLivingBase.java b/java/noppes/npcs/api/entity/IEntityLivingBase.java index bcde460..4c91b5e 100644 --- a/java/noppes/npcs/api/entity/IEntityLivingBase.java +++ b/java/noppes/npcs/api/entity/IEntityLivingBase.java @@ -1,210 +1,439 @@ -package noppes.npcs.api.entity; - -import net.minecraft.entity.EntityLivingBase; -import noppes.npcs.api.IBlock; -import noppes.npcs.api.IDamageSource; -import noppes.npcs.api.IPos; -import noppes.npcs.api.item.IItemStack; - -public interface IEntityLivingBase extends IEntity { - /** - * @return The entity's current health - */ - float getHealth(); - - /** - * @param health The new health of this entity - */ - void setHealth(float health); - - void hurt(float damage); - - void hurt(float damage, IEntity source); - - void hurt(float damage, IDamageSource damageSource); - - void setMaxHurtTime(int time); - - int setMaxHurtTime(); - - /** - * @return Entity's max health - */ - double getMaxHealth(); - - double getFollowRange(); - - double getKnockbackResistance(); - - double getSpeed(); - - double getMeleeStrength(); - - void setMaxHealth(double health); - - void setFollowRange(double range); - - void setKnockbackResistance(double knockbackResistance); - - void setSpeed(double speed); - - void setMeleeStrength(double attackDamage); - - /** - * @return Whether or not this entity is attacking something - */ - boolean isAttacking(); - - /** - * @param living Entity which this entity will attack - */ - void setAttackTarget(IEntityLivingBase living); - - /** - * @return The entity which this entity is attacking - */ - IEntityLivingBase getAttackTarget(); - - int getAttackTargetTime(); - - void setLastAttacker(IEntity p_130011_1_); - - IEntity getLastAttacker(); - - int getLastAttackerTime(); - - boolean canBreatheUnderwater(); - - int getType(); - - boolean typeOf(int type); - - /** - * @param entity Entity to check - * @return Whether or not this entity can see the given entity - */ - boolean canSeeEntity(IEntity entity); - - /** - * - * @return Returns the look vector of this entity as an IPos object. - */ - IPos getLookVector(); - - IBlock getLookingAtBlock(int maxDistance, boolean stopOnBlock, boolean stopOnLiquid, boolean stopOnCollision); - - /** - * - * @param maxDistance The max distance to perform checks before stopping - * @return The first block found by following along the entity's look vector. - */ - IBlock getLookingAtBlock(int maxDistance); - - IPos getLookingAtPos(int maxDistance, boolean stopOnBlock, boolean stopOnLiquid, boolean stopOnCollision); - - /** - * Returns an IPos object corresponding to the final obstructed point following along the - * entity's look vector. If no obstructions are found (entity is looking in a straight path of - * air with no blocks in the way), the final position is returned. - * - * @param maxDistance The max distance to perform checks before stopping - * @return The position the entity is looking at. - */ - IPos getLookingAtPos(int maxDistance); - - /** - * - * @param maxDistance The max distance to perform checks before stopping - * @param range The radius to check for surrounding entities at every point on the vector - * @return A list of entities, sorted first by closest to the entity along the look vector, then by which - * entities are closest to the vector. - */ - IEntity[] getLookingAtEntities(IEntity[] ignoreEntities, int maxDistance, double offset, double range, boolean stopOnBlock, boolean stopOnLiquid, boolean stopOnCollision); - - IEntity[] getLookingAtEntities(int maxDistance, double offset, double range, boolean stopOnBlock, boolean stopOnLiquid, boolean stopOnCollision); - - IEntity[] getLookingAtEntities(int maxDistance, double offset, double range); - - /** - * Expert use only - * @return Returns the minecraft entity object - */ - T getMCEntity(); - - /** - * Makes the entity swing its hand - */ - void swingHand(); - - /** - * Works the same as the /effect command - * @param effect - * @param duration The duration in seconds - * @param strength The amplifier of the potion effect - * @param hideParticles Whether or not you want to hide potion particles - */ - void addPotionEffect(int effect, int duration, int strength, boolean hideParticles); - - /** - * Clears all potion effects - */ - void clearPotionEffects(); - - /** - * @since 1.7.10c - * @param effect Potion effect to check - * @return Returns -1 if its not active. Otherwise returns the strenght of the potion - */ - int getPotionEffect(int effect); - - /** - * Note not all Living Entities support this - * @since 1.7.10c - * @return The item the entity is holding - */ - IItemStack getHeldItem(); - - /** - * Note not all Living Entities support this - * @since 1.7.10c - * @param item The item to be set - */ - void setHeldItem(IItemStack item); - - /** - * Note not all Living Entities support this - * @param slot Slot of what armor piece to get, 0:boots, 1:pants, 2:body, 3:head - * @return The item in the given slot - */ - IItemStack getArmor(int slot); - - /** - * Note not all Living Entities support this - * @since 1.7.10c - * @param slot Slot of what armor piece to set, 0:boots, 1:pants, 2:body, 3:head - * @param item Item to be set - */ - void setArmor(int slot, IItemStack item); - - boolean isChild(); - - void renderBrokenItemStack(IItemStack itemStack); - - boolean isOnLadder(); - - int getTotalArmorValue(); - - int getArrowCountInEntity(); - - void setArrowCountInEntity(int count); - - void dismountEntity(IEntity entity); - - void setAIMoveSpeed(float speed); - - float getAIMoveSpeed(); - - void setAbsorptionAmount(float amount); - - float getAbsorptionAmount(); -} +package noppes.npcs.api.entity; + +import net.minecraft.entity.EntityLivingBase; +import noppes.npcs.api.IBlock; +import noppes.npcs.api.IDamageSource; +import noppes.npcs.api.IPos; +import noppes.npcs.api.item.IItemStack; + +/** + * Represents a living entity (mob, NPC, etc.) with additional methods to manage health, + * damage, targeting, vision, potion effects, equipment, and various attributes. + *

+ * This interface extends {@link IEntity} and provides functionality specific to living entities. + * + * @param the underlying Minecraft EntityLivingBase type. + */ +public interface IEntityLivingBase extends IEntity { + + /** + * Returns the entity's current health. + * + * @return the health value. + */ + float getHealth(); + + /** + * Sets the entity's health to the specified value. + * + * @param health the new health value. + */ + void setHealth(float health); + + /** + * Applies damage to this entity using a generic damage source. + * + * @param damage the damage amount. + */ + void hurt(float damage); + + /** + * Applies damage to this entity with the given source entity. + * + * @param damage the damage amount. + * @param source the source entity. + */ + void hurt(float damage, IEntity source); + + /** + * Applies damage to this entity using a custom damage source. + * + * @param damage the damage amount. + * @param damageSource the damage source. + */ + void hurt(float damage, IDamageSource damageSource); + + /** + * Sets the maximum hurt time (hurt resistance time) for this entity. + * + * @param time the time in ticks. + */ + void setMaxHurtTime(int time); + + /** + * Returns the maximum hurt time (hurt resistance time) for this entity. + * + * @return the time in ticks. + */ + int setMaxHurtTime(); + + /** + * Returns the entity's maximum health. + * + * @return the maximum health. + */ + double getMaxHealth(); + + /** + * Returns the follow range attribute of the entity. + * + * @return the follow range. + */ + double getFollowRange(); + + /** + * Returns the knockback resistance of the entity. + * + * @return the knockback resistance. + */ + double getKnockbackResistance(); + + /** + * Returns the movement speed of the entity. + * + * @return the speed. + */ + double getSpeed(); + + /** + * Returns the melee strength (attack damage) of the entity. + * + * @return the melee strength. + */ + double getMeleeStrength(); + + /** + * Sets the entity's maximum health. + * + * @param health the new maximum health. + */ + void setMaxHealth(double health); + + /** + * Sets the follow range of the entity. + * + * @param range the new follow range. + */ + void setFollowRange(double range); + + /** + * Sets the knockback resistance of the entity. + * + * @param knockbackResistance the new knockback resistance. + */ + void setKnockbackResistance(double knockbackResistance); + + /** + * Sets the movement speed of the entity. + * + * @param speed the new movement speed. + */ + void setSpeed(double speed); + + /** + * Sets the melee strength (attack damage) of the entity. + * + * @param attackDamage the new attack damage. + */ + void setMeleeStrength(double attackDamage); + + /** + * @return true if this entity is currently attacking a target; false otherwise. + */ + boolean isAttacking(); + + /** + * Sets the attack target for this entity. + * + * @param living the target entity. + */ + void setAttackTarget(IEntityLivingBase living); + + /** + * Returns the current attack target. + * + * @return the target entity. + */ + IEntityLivingBase getAttackTarget(); + + /** + * Returns the time (in ticks) for which the current attack target has been active. + * + * @return the attack target time. + */ + int getAttackTargetTime(); + + /** + * Sets the last attacker for this entity. + * + * @param p_130011_1_ the last attacker. + */ + void setLastAttacker(IEntity p_130011_1_); + + /** + * Returns the last attacker of this entity. + * + * @return the last attacker. + */ + IEntity getLastAttacker(); + + /** + * Returns the time (in ticks) since the entity was last attacked. + * + * @return the last attacker time. + */ + int getLastAttackerTime(); + + /** + * Checks whether the entity can breathe underwater. + * + * @return true if it can breathe underwater; false otherwise. + */ + boolean canBreatheUnderwater(); + + /** + * Returns the EntityType (as defined in scripting constants) for this entity. + * + * @return the entity type. + */ + int getType(); + + /** + * Checks if this entity is of the specified type. + * + * @param type the type to check. + * @return true if this entity is of that type; false otherwise. + */ + boolean typeOf(int type); + + /** + * Returns the look vector of this entity as an IPos object. + * + * @return the look vector. + */ + IPos getLookVector(); + + /** + * Returns the block that the entity is looking at, with detailed stopping conditions. + * + * @param maxDistance the maximum distance to check. + * @param stopOnBlock whether to stop on any block. + * @param stopOnLiquid whether to stop on liquids. + * @param stopOnCollision whether to stop on collisions. + * @return the block being looked at. + */ + IBlock getLookingAtBlock(int maxDistance, boolean stopOnBlock, boolean stopOnLiquid, boolean stopOnCollision); + + /** + * Returns the first block found by following the entity's look vector, + * using default parameters (stop on block). + * + * @param maxDistance the maximum distance to check. + * @return the block being looked at. + */ + IBlock getLookingAtBlock(int maxDistance); + + /** + * Returns the position (IPos) corresponding to the final obstructed point along the entity's look vector, + * with detailed stopping conditions. + * + * @param maxDistance the maximum distance to check. + * @param stopOnBlock whether to stop on blocks. + * @param stopOnLiquid whether to stop on liquids. + * @param stopOnCollision whether to stop on collisions. + * @return the obstructed position, or the final position if unobstructed. + */ + IPos getLookingAtPos(int maxDistance, boolean stopOnBlock, boolean stopOnLiquid, boolean stopOnCollision); + + /** + * Returns the position (IPos) corresponding to the final obstructed point along the entity's look vector, + * using default parameters (stop on block). + * + * @param maxDistance the maximum distance to check. + * @return the position being looked at. + */ + IPos getLookingAtPos(int maxDistance); + + /** + * Returns an array of entities intersecting with the entity's look vector. + * Entities are sorted first by proximity along the vector, then by closeness to the vector. + * + * @param ignoreEntities an array of entities to ignore. + * @param maxDistance the maximum distance to check. + * @param offset the offset along the vector. + * @param range the search radius around the vector. + * @param stopOnBlock whether to stop on blocks. + * @param stopOnLiquid whether to stop on liquids. + * @param stopOnCollision whether to stop on collisions. + * @return an array of entities. + */ + IEntity[] getLookingAtEntities(IEntity[] ignoreEntities, int maxDistance, double offset, double range, boolean stopOnBlock, boolean stopOnLiquid, boolean stopOnCollision); + + /** + * Returns an array of entities intersecting with the entity's look vector with detailed stop conditions. + * + * @param maxDistance the maximum distance. + * @param offset the offset. + * @param range the search radius. + * @param stopOnBlock whether to stop on blocks. + * @param stopOnLiquid whether to stop on liquids. + * @param stopOnCollision whether to stop on collisions. + * @return an array of entities. + */ + IEntity[] getLookingAtEntities(int maxDistance, double offset, double range, boolean stopOnBlock, boolean stopOnLiquid, boolean stopOnCollision); + + /** + * Returns an array of entities intersecting with the entity's look vector using default stop conditions. + * + * @param maxDistance the maximum distance. + * @param offset the offset. + * @param range the search radius. + * @return an array of entities. + */ + IEntity[] getLookingAtEntities(int maxDistance, double offset, double range); + + /** + * Expert use only. + * Returns the underlying Minecraft EntityLivingBase object. + * + * @return the Minecraft entity. + */ + T getMCEntity(); + + /** + * Makes the entity swing its hand. + */ + void swingHand(); + + /** + * Applies a potion effect to the entity. + * Works similarly to the /effect command. + * + * @param effect the potion effect ID. + * @param duration the duration in seconds. + * @param strength the amplifier of the effect. + * @param hideParticles whether to hide potion particles. + */ + void addPotionEffect(int effect, int duration, int strength, boolean hideParticles); + + /** + * Clears all active potion effects from the entity. + */ + void clearPotionEffects(); + + /** + * Returns the amplifier of the specified potion effect. + * If the effect is not active, returns -1. + * + * @param effect the potion effect ID. + * @return the amplifier, or -1 if not active. + */ + int getPotionEffect(int effect); + + /** + * Returns the item the entity is currently holding. + * Note that not all living entities support this. + * + * @return the held item. + */ + IItemStack getHeldItem(); + + /** + * Sets the item the entity is holding. + * Note that not all living entities support this. + * + * @param item the item to set. + */ + void setHeldItem(IItemStack item); + + /** + * Returns the armor piece in the given slot. + * Slots: 0 - boots, 1 - pants, 2 - body, 3 - head. + * + * @param slot the armor slot. + * @return the armor item. + */ + IItemStack getArmor(int slot); + + /** + * Sets the armor piece in the given slot. + * Slots: 0 - boots, 1 - pants, 2 - body, 3 - head. + * + * @param slot the armor slot. + * @param item the item to set. + */ + void setArmor(int slot, IItemStack item); + + /** + * @return true if this entity is a child. + */ + boolean isChild(); + + /** + * Renders a broken item stack effect for the given item. + * + * @param itemStack the item stack. + */ + void renderBrokenItemStack(IItemStack itemStack); + + /** + * @return true if the entity is on a ladder. + */ + boolean isOnLadder(); + + /** + * Returns the total armor value of the entity. + * + * @return the armor value. + */ + int getTotalArmorValue(); + + /** + * Returns the number of arrows currently embedded in the entity. + * + * @return the arrow count. + */ + int getArrowCountInEntity(); + + /** + * Sets the number of arrows embedded in the entity. + * + * @param count the new arrow count. + */ + void setArrowCountInEntity(int count); + + /** + * Dismounts the specified entity from this entity. + * + * @param entity the entity to dismount. + */ + void dismountEntity(IEntity entity); + + /** + * Sets the AI move speed for the entity. + * + * @param speed the speed value. + */ + void setAIMoveSpeed(float speed); + + /** + * Returns the AI move speed of the entity. + * + * @return the speed. + */ + float getAIMoveSpeed(); + + /** + * Sets the absorption (extra health) amount. + * + * @param amount the absorption amount. + */ + void setAbsorptionAmount(float amount); + + /** + * Returns the absorption (extra health) amount. + * + * @return the absorption amount. + */ + float getAbsorptionAmount(); +} diff --git a/java/noppes/npcs/api/entity/IMonster.java b/java/noppes/npcs/api/entity/IMonster.java index bc3e74d..eab9e33 100644 --- a/java/noppes/npcs/api/entity/IMonster.java +++ b/java/noppes/npcs/api/entity/IMonster.java @@ -1,6 +1,13 @@ -package noppes.npcs.api.entity; - -import net.minecraft.entity.monster.EntityMob; - -public interface IMonster extends IEntityLiving { -} +package noppes.npcs.api.entity; + +import net.minecraft.entity.monster.EntityMob; + +/** + * Represents a monster entity. + * This interface does not add new methods, but allows type checking + * against the EntityType.MONSTER. + * + * @param The underlying Minecraft EntityMob type. + */ +public interface IMonster extends IEntityLiving { +} diff --git a/java/noppes/npcs/api/entity/IPixelmon.java b/java/noppes/npcs/api/entity/IPixelmon.java index 6b758da..085a280 100644 --- a/java/noppes/npcs/api/entity/IPixelmon.java +++ b/java/noppes/npcs/api/entity/IPixelmon.java @@ -1,96 +1,167 @@ -package noppes.npcs.api.entity; - -import net.minecraft.entity.passive.EntityTameable; - -public interface IPixelmon extends IAnimal { - boolean getIsShiny(); - - void setIsShiny(boolean bo); - - int getLevel(); - - void setLevel(int level); - - /** - * @param type 0:HP, 1:Attack, 2:Defense, 3:SpAttack, 4:SpDefense, 5:Speed - */ - int getIV(int type); - - - /** - * @param type 0:HP, 1:Attack, 2:Defense, 3:SpAttack, 4:SpDefense, 5:Speed - */ - void setIV(int type, int value); - - /** - * @param type 0:HP, 1:Attack, 2:Defense, 3:SpAttack, 4:SpDefense, 5:Speed - */ - int getEV(int type); - - - /** - * @param type 0:HP, 1:Attack, 2:Defense, 3:SpAttack, 4:SpDefense, 5:Speed - */ - void setEV(int type, int value); - - /** - * @param type 0:HP, 1:Attack, 2:Defense, 3:SpAttack, 4:SpDefense, 5:Speed - */ - int getStat(int type); - - - /** - * @param type 0:HP, 1:Attack, 2:Defense, 3:SpAttack, 4:SpDefense, 5:Speed - */ - void setStat(int type, int value); - - /** - * @return type 0:Pygmy, 1:Runt, 2:Small, 3:Normal, 4:Huge, 5:Giant, 6:Enormous, 7:Ginormous, 8:Microscopic - */ - int getSize(); - - /** - * @param type 0:Pygmy, 1:Runt, 2:Small, 3:Normal, 4:Huge, 5:Giant, 6:Enormous, 7:Ginormous, 8:Microscopic - */ - void setSize(int type); - - /** - * @return 0-255 - */ - int getHapiness(); - - /** - * @param value 0-255 - */ - void setHapiness(int value); - - /** - * @return 0:Hardy, 1:Serious, 2:Docile, 3:Bashful, 4:Quirky, 5:Lonely, 6:Brave, 7:Adamant, 8:Naughty, 9:Bold, 10:Relaxed, 11:Impish, 12:Lax, 13:Timid, 14:Hasty, 15:Jolly, 16:Naive, 17:Modest, 18:Mild, 19:Quiet, 20:Rash, 21:Calm, 22:Gentle, 23:Sassy, 24:Careful - */ - int getNature(); - - /** - * @param type 0:Hardy, 1:Serious, 2:Docile, 3:Bashful, 4:Quirky, 5:Lonely, 6:Brave, 7:Adamant, 8:Naughty, 9:Bold, 10:Relaxed, 11:Impish, 12:Lax, 13:Timid, 14:Hasty, 15:Jolly, 16:Naive, 17:Modest, 18:Mild, 19:Quiet, 20:Rash, 21:Calm, 22:Gentle, 23:Sassy, 24:Careful - */ - void setNature(int type); - - /** - * @return -1:Uncaught, 0:Pokeball, 1:GreatBall, 2:UltraBall, 3:MasterBall, 4:LevelBall, 5:MoonBall, 6:FriendBall, 7:LoveBall, 8:SafariBall, 9:HeavyBall, 10:FastBall, 11:RepeatBall, 12:TimerBall, 13:NestBall, 14:NetBall, 15:DiveBall, 16:LuxuryBall, 17:HealBall, 18:DuskBall, 19:PremierBall, 20:SportBall, 21:QuickBall, 22:ParkBall, 23:LureBall, 24:CherishBall, 25:GSBall - */ - int getPokeball(); - - /** - * @param type -1:Uncaught, 0:Pokeball, 1:GreatBall, 2:UltraBall, 3:MasterBall, 4:LevelBall, 5:MoonBall, 6:FriendBall, 7:LoveBall, 8:SafariBall, 9:HeavyBall, 10:FastBall, 11:RepeatBall, 12:TimerBall, 13:NestBall, 14:NetBall, 15:DiveBall, 16:LuxuryBall, 17:HealBall, 18:DuskBall, 19:PremierBall, 20:SportBall, 21:QuickBall, 22:ParkBall, 23:LureBall, 24:CherishBall, 25:GSBall - */ - void setPokeball(int type); - - String getNickname(); - - boolean hasNickname(); - - void setNickname(String name); - - String getMove(int slot); - - void setMove(int slot, String move); -} +package noppes.npcs.api.entity; + +import net.minecraft.entity.passive.EntityTameable; +import noppes.npcs.api.item.IItemStack; + +/** + * Represents a Pixelmon (a tameable creature) with additional attributes + * such as shiny state, level, IV/EV values, nature, moves, and more. + * + * @param The underlying Minecraft EntityTameable type. + */ +public interface IPixelmon extends IAnimal { + + /** + * @return true if the Pixelmon is shiny. + */ + boolean getIsShiny(); + + /** + * Sets whether the Pixelmon is shiny. + * + * @param bo true for shiny. + */ + void setIsShiny(boolean bo); + + /** + * @return The Pixelmon's level. + */ + int getLevel(); + + /** + * Sets the Pixelmon's level. + * + * @param level the new level. + */ + void setLevel(int level); + + /** + * Gets the Individual Value (IV) for the specified stat. + * @param type 0: HP, 1: Attack, 2: Defense, 3: SpAttack, 4: SpDefense, 5: Speed + * @return the IV value, or -1 if invalid. + */ + int getIV(int type); + + /** + * Sets the Individual Value (IV) for the specified stat. + * + * @param type 0: HP, 1: Attack, 2: Defense, 3: SpAttack, 4: SpDefense, 5: Speed + * @param value the new IV value. + */ + void setIV(int type, int value); + + /** + * Gets the Effort Value (EV) for the specified stat. + * + * @param type 0: HP, 1: Attack, 2: Defense, 3: SpAttack, 4: SpDefense, 5: Speed + * @return the EV value, or -1 if invalid. + */ + int getEV(int type); + + /** + * Sets the Effort Value (EV) for the specified stat. + * + * @param type 0: HP, 1: Attack, 2: Defense, 3: SpAttack, 4: SpDefense, 5: Speed + * @param value the new EV value. + */ + void setEV(int type, int value); + + /** + * Gets the calculated stat for the specified stat type. + * + * @param type 0: HP, 1: Attack, 2: Defense, 3: SpAttack, 4: SpDefense, 5: Speed + * @return the stat value, or -1 if invalid. + */ + int getStat(int type); + + /** + * Sets the calculated stat for the specified stat type. + * + * @param type 0: HP, 1: Attack, 2: Defense, 3: SpAttack, 4: SpDefense, 5: Speed + * @param value the new stat value. + */ + void setStat(int type, int value); + + /** + * @return The Pixelmon's size type (0: Pygmy, 1: Runt, 2: Small, 3: Normal, 4: Huge, 5: Giant, + * 6: Enormous, 7: Ginormous, 8: Microscopic). + */ + int getSize(); + + /** + * Sets the Pixelmon's size type. + * + * @param type the size type. + */ + void setSize(int type); + + /** + * @return The Pixelmon's happiness (0-255). + */ + int getHapiness(); + + /** + * Sets the Pixelmon's happiness. + * + * @param value a value between 0 and 255. + */ + void setHapiness(int value); + + /** + * @return The Pixelmon's nature as an integer (see nature definitions). + */ + int getNature(); + + /** + * Sets the Pixelmon's nature. + * + * @param type the nature value. + */ + void setNature(int type); + + /** + * @return The type of Poké Ball in which the Pixelmon is contained + * (-1: Uncaught, 0: Pokéball, 1: Great Ball, etc.). + */ + int getPokeball(); + + /** + * Sets the type of Poké Ball for this Pixelmon. + * + * @param type -1 for Uncaught, 0 for Pokéball, etc. + */ + void setPokeball(int type); + + /** + * @return The Pixelmon's nickname. + */ + String getNickname(); + + /** + * @return true if the Pixelmon has a nickname. + */ + boolean hasNickname(); + + /** + * Sets the Pixelmon's nickname. + * + * @param name the new nickname. + */ + void setNickname(String name); + + /** + * Returns the name of the move in the specified slot. + * + * @param slot the move slot. + * @return the move name. + */ + String getMove(int slot); + + /** + * Sets the move in the specified slot. + * + * @param slot the move slot. + * @param move the move name. + */ + void setMove(int slot, String move); +} diff --git a/java/noppes/npcs/api/entity/IProjectile.java b/java/noppes/npcs/api/entity/IProjectile.java index 8758741..eb63a16 100644 --- a/java/noppes/npcs/api/entity/IProjectile.java +++ b/java/noppes/npcs/api/entity/IProjectile.java @@ -1,51 +1,90 @@ -package noppes.npcs.api.entity; - -import noppes.npcs.api.item.IItemStack; - -public interface IProjectile { - - public IItemStack getItem(); - - public void setItem(IItemStack item); - - /** - * @return Returns whether the arrow flies in a straight line or not - */ - public boolean getHasGravity(); - - /** - * @param bo Whether the arrow flies in a straight line or not - */ - public void setHasGravity(boolean bo); - - public int getAccuracy(); - - public void setAccuracy(int accuracy); - - /** - * Entity where the projectile heads towards - * The position for the projectile needs to have been set for this - */ - public void setHeading(IEntity entity); - - /** - * Position where the projectile heads towards. - * The position for the projectile needs to have been set for this - */ - public void setHeading(double x, double y, double z); - - /** - * @param yaw Rotation yaw - * @param pitch Rotation pitch - */ - public void setHeading(float yaw, float pitch); - - - public IEntity getThrower(); - - - /** - * For scripters to enable projectile events in their current scripting container - */ - public void enableEvents(); -} +package noppes.npcs.api.entity; + +import noppes.npcs.api.item.IItemStack; + +/** + * Represents a projectile entity. + * Provides methods to access and modify the projectile's item, gravity, accuracy, heading, + * and to enable scripting events. + */ +public interface IProjectile { + + /** + * Returns the item associated with the projectile (e.g. arrow, fireball). + * + * @return the item as an IItemStack. + */ + IItemStack getItem(); + + /** + * Sets the item for the projectile. + * + * @param item the item to set. + */ + void setItem(IItemStack item); + + /** + * @return true if the projectile is affected by gravity; false if it flies straight. + */ + boolean getHasGravity(); + + /** + * Sets whether the projectile is affected by gravity. + * + * @param bo true to enable gravity; false otherwise. + */ + void setHasGravity(boolean bo); + + /** + * Returns the accuracy value for the projectile. + * + * @return the accuracy. + */ + int getAccuracy(); + + /** + * Sets the accuracy value for the projectile. + * + * @param accuracy the accuracy value. + */ + void setAccuracy(int accuracy); + + /** + * Sets the heading (target destination) for the projectile based on the target entity. + * The projectile's position should already be set. + * + * @param entity the target entity. + */ + void setHeading(IEntity entity); + + /** + * Sets the heading for the projectile to the specified coordinates. + * The projectile's position should already be set. + * + * @param x the target x coordinate. + * @param y the target y coordinate. + * @param z the target z coordinate. + */ + void setHeading(double x, double y, double z); + + /** + * Sets the heading using yaw and pitch values. + * + * @param yaw the yaw angle. + * @param pitch the pitch angle. + */ + void setHeading(float yaw, float pitch); + + /** + * Returns the thrower (the entity that launched the projectile). + * + * @return the thrower as an IEntity. + */ + IEntity getThrower(); + + /** + * Enables projectile events for the current scripting container. + * Must be called during a script. + **/ + void enableEvents(); +} diff --git a/java/noppes/npcs/api/entity/IVillager.java b/java/noppes/npcs/api/entity/IVillager.java index 7b98248..a7eb5e3 100644 --- a/java/noppes/npcs/api/entity/IVillager.java +++ b/java/noppes/npcs/api/entity/IVillager.java @@ -1,12 +1,29 @@ -package noppes.npcs.api.entity; - -import net.minecraft.entity.monster.EntityMob; - -public interface IVillager extends IEntityLiving{ - - int getProfession(); - - boolean getIsTrading(); - - IEntityLivingBase getCustomer(); -} +package noppes.npcs.api.entity; + +import net.minecraft.entity.passive.EntityVillager; +import noppes.npcs.api.entity.IEntityLivingBase; + +/** + * Represents a villager entity with additional trading-related methods. + * + * @param The underlying Minecraft EntityVillager type. + */ +public interface IVillager extends IEntityLiving { + + /** + * @return The profession of the villager. + */ + int getProfession(); + + /** + * @return true if the villager is currently trading. + */ + boolean getIsTrading(); + + /** + * Returns the customer (player) who is currently trading with the villager. + * + * @return the customer as an IEntityLivingBase. + */ + IEntityLivingBase getCustomer(); +} diff --git a/java/noppes/npcs/api/entity/data/IMark.java b/java/noppes/npcs/api/entity/data/IMark.java index 14823d1..f13cc02 100644 --- a/java/noppes/npcs/api/entity/data/IMark.java +++ b/java/noppes/npcs/api/entity/data/IMark.java @@ -1,21 +1,50 @@ -package noppes.npcs.api.entity.data; - -import noppes.npcs.api.handler.data.IAvailability; - -public interface IMark { - - public IAvailability getAvailability(); - - public int getColor(); - - public void setColor(int color); - - public int getType(); - - public void setType(int type); - - /** - * Calling this will send the changes you've made to the clients - */ - public void update(); -} +package noppes.npcs.api.entity.data; + +import noppes.npcs.api.handler.data.IAvailability; + +/** + * Represents a mark that can be applied to an entity. + * A mark holds a type, a color, and availability conditions. + */ +public interface IMark { + + /** + * Returns the availability conditions associated with this mark. + * + * @return the availability. + */ + IAvailability getAvailability(); + + /** + * Returns the color value of this mark. + * + * @return the color as an integer. + */ + int getColor(); + + /** + * Sets the color value of this mark. + * + * @param color the new color. + */ + void setColor(int color); + + /** + * Returns the type of this mark. + * + * @return the mark type as an integer. + */ + int getType(); + + /** + * Sets the type of this mark. + * + * @param type the new type. + */ + void setType(int type); + + /** + * Calling this will send the changes you've made to the clients. + */ + void update(); +} diff --git a/java/noppes/npcs/api/entity/data/IModelData.java b/java/noppes/npcs/api/entity/data/IModelData.java index 71b86c0..ad31d0b 100644 --- a/java/noppes/npcs/api/entity/data/IModelData.java +++ b/java/noppes/npcs/api/entity/data/IModelData.java @@ -1,49 +1,163 @@ -package noppes.npcs.api.entity.data; - -public interface IModelData { - - void headWear(byte config); - - byte headWear(); - - void bodyWear(byte config); - - byte bodyWear(); - - void rightArmWear(byte config); - - byte rightArmWear(); - - void leftArmWear(byte config); - - byte leftArmWear(); - - void rightLegWear(byte config); - - byte rightLegWear(); - - void leftLegWear(byte config); - - byte leftLegWear(); - - /** - * Hide Body Parts - * part: [0: Head, 1: Body, 2: Arms, 3: Legs] - * hide: [0: None, 1: Both, 2: Right, 3: Left], only values 0 and 1 used for head & body. - */ - void hidePart(int part, byte hide); - - int hidden(int part); - - void enableRotation(boolean enableRotation); - - boolean enableRotation(); - - IModelRotate getRotation(); - - IModelScale getScale(); - - void setEntity(String string); - - String getEntity(); -} +package noppes.npcs.api.entity.data; + +/** + * Provides configuration data for a model including wearable settings, + * hidden parts, rotation, and scale. + *

+ * This interface allows controlling the appearance of an entity's model + * such as headwear, bodywear, arm and leg configurations, and the ability + * to hide parts. It also manages model rotation and scaling settings as well + * as the association with an entity type. + */ +public interface IModelData { + + /** + * Sets the headwear configuration. + * Valid values: 0 (hidden), 1 (2D), 2 (3D). + * + * @param config the headwear configuration. + */ + void headWear(byte config); + + /** + * Gets the current headwear configuration. + * + * @return the headwear configuration. + */ + byte headWear(); + + /** + * Sets the bodywear configuration. + * Valid values: 0 (hidden), 1 (2D), 2 (3D). + * + * @param config the bodywear configuration. + */ + void bodyWear(byte config); + + /** + * Gets the current bodywear configuration. + * + * @return the bodywear configuration. + */ + byte bodyWear(); + + /** + * Sets the right arm wear configuration. + * Valid values: 0 (hidden), 1 (2D), 2 (3D). + * + * @param config the right arm configuration. + */ + void rightArmWear(byte config); + + /** + * Gets the current right arm wear configuration. + * + * @return the right arm configuration. + */ + byte rightArmWear(); + + /** + * Sets the left arm wear configuration. + * Valid values: 0 (hidden), 1 (2D), 2 (3D). + * + * @param config the left arm configuration. + */ + void leftArmWear(byte config); + + /** + * Gets the current left arm wear configuration. + * + * @return the left arm configuration. + */ + byte leftArmWear(); + + /** + * Sets the right leg wear configuration. + * Valid values: 0 (hidden), 1 (2D), 2 (3D). + * + * @param config the right leg configuration. + */ + void rightLegWear(byte config); + + /** + * Gets the current right leg wear configuration. + * + * @return the right leg configuration. + */ + byte rightLegWear(); + + /** + * Sets the left leg wear configuration. + * Valid values: 0 (hidden), 1 (2D), 2 (3D). + * + * @param config the left leg configuration. + */ + void leftLegWear(byte config); + + /** + * Gets the current left leg wear configuration. + * + * @return the left leg configuration. + */ + byte leftLegWear(); + + /** + * Hide Body Parts + * part: [0: Head, 1: Body, 2: Arms, 3: Legs] + * hide: [0: None, 1: Both, 2: Right, 3: Left], only values 0 and 1 used for head & body. + * + * @param part the part index. + * @param hide the hide configuration. + */ + void hidePart(int part, byte hide); + + /** + * Returns the hide configuration for the specified part. + * + * @param part the part index. + * @return the current hide configuration. + */ + int hidden(int part); + + /** + * Enables or disables rotation for the model. + * + * @param enableRotation true to enable rotation; false to disable. + */ + void enableRotation(boolean enableRotation); + + /** + * Checks whether rotation is enabled for the model. + * + * @return true if rotation is enabled; false otherwise. + */ + boolean enableRotation(); + + /** + * Returns the model rotation configuration. + * + * @return the rotation settings. + */ + IModelRotate getRotation(); + + /** + * Returns the model scaling configuration. + * + * @return the scale settings. + */ + IModelScale getScale(); + + /** + * Associates this model data with an entity using its class name. + * + * @param string the fully qualified class name of the entity. + */ + void setEntity(String string); + + /** + * Gets the entity class name associated with this model data. + * + * @return the entity class name, or null if not set. + */ + String getEntity(); +} diff --git a/java/noppes/npcs/api/entity/data/IModelRotate.java b/java/noppes/npcs/api/entity/data/IModelRotate.java index 0ccb68f..abec6a3 100644 --- a/java/noppes/npcs/api/entity/data/IModelRotate.java +++ b/java/noppes/npcs/api/entity/data/IModelRotate.java @@ -1,18 +1,59 @@ -package noppes.npcs.api.entity.data; - -public interface IModelRotate { - - boolean whileStanding(); - - void whileStanding(boolean whileStanding); - - boolean whileAttacking(); - - void whileAttacking(boolean whileAttacking); - - boolean whileMoving(); - - void whileMoving(boolean whileMoving); - - IModelRotatePart getPart(int part); -} +package noppes.npcs.api.entity.data; + +/** + * Represents the rotation configuration for a model. + * It controls how different parts of a model rotate under various conditions. + */ +public interface IModelRotate { + + /** + * Checks if rotation is applied while the entity is standing. + * + * @return true if rotation while standing is enabled; false otherwise. + */ + boolean whileStanding(); + + /** + * Sets whether rotation should be applied while the entity is standing. + * + * @param whileStanding true to enable; false to disable. + */ + void whileStanding(boolean whileStanding); + + /** + * Checks if rotation is applied while the entity is attacking. + * + * @return true if rotation while attacking is enabled; false otherwise. + */ + boolean whileAttacking(); + + /** + * Sets whether rotation should be applied while the entity is attacking. + * + * @param whileAttacking true to enable; false to disable. + */ + void whileAttacking(boolean whileAttacking); + + /** + * Checks if rotation is applied while the entity is moving. + * + * @return true if rotation while moving is enabled; false otherwise. + */ + boolean whileMoving(); + + /** + * Sets whether rotation should be applied while the entity is moving. + * + * @param whileMoving true to enable; false to disable. + */ + void whileMoving(boolean whileMoving); + + /** + * Retrieves the rotation settings for a specific part of the model. + * Parts are indexed as follows: 0 - head, 1 - body, 2 - left arm, 3 - right arm, 4 - left leg, 5 - right leg. + * + * @param part the index of the model part. + * @return the rotation settings for the specified part. + */ + IModelRotatePart getPart(int part); +} diff --git a/java/noppes/npcs/api/entity/data/IModelRotatePart.java b/java/noppes/npcs/api/entity/data/IModelRotatePart.java index 9633fd9..c13e8d1 100644 --- a/java/noppes/npcs/api/entity/data/IModelRotatePart.java +++ b/java/noppes/npcs/api/entity/data/IModelRotatePart.java @@ -1,16 +1,53 @@ -package noppes.npcs.api.entity.data; - -public interface IModelRotatePart { - - void setRotation(float x, float y, float z); - - float getRotateX(); - - float getRotateY(); - - float getRotateZ(); - - void disabled(boolean enabled); - - boolean disabled(); -} +package noppes.npcs.api.entity.data; + +/** + * Represents the rotation settings for a specific part of a model. + * Allows configuring the rotation angles along the X, Y, and Z axes + * as well as enabling/disabling the rotation. + */ +public interface IModelRotatePart { + + /** + * Sets the rotation angles for this model part. + * + * @param x the rotation angle around the X-axis. + * @param y the rotation angle around the Y-axis. + * @param z the rotation angle around the Z-axis. + */ + void setRotation(float x, float y, float z); + + /** + * Returns the rotation angle around the X-axis. + * + * @return the X-axis rotation. + */ + float getRotateX(); + + /** + * Returns the rotation angle around the Y-axis. + * + * @return the Y-axis rotation. + */ + float getRotateY(); + + /** + * Returns the rotation angle around the Z-axis. + * + * @return the Z-axis rotation. + */ + float getRotateZ(); + + /** + * Enables or disables rotation for this part. + * + * @param enabled true to disable rotation; false to enable. + */ + void disabled(boolean enabled); + + /** + * Checks whether rotation is disabled for this part. + * + * @return true if rotation is disabled; false otherwise. + */ + boolean disabled(); +} diff --git a/java/noppes/npcs/api/entity/data/IModelScale.java b/java/noppes/npcs/api/entity/data/IModelScale.java index c0b4d2f..617357a 100644 --- a/java/noppes/npcs/api/entity/data/IModelScale.java +++ b/java/noppes/npcs/api/entity/data/IModelScale.java @@ -1,5 +1,17 @@ -package noppes.npcs.api.entity.data; - -public interface IModelScale { - IModelScalePart getPart(int part); -} +package noppes.npcs.api.entity.data; + +/** + * Represents the scaling configuration for a model. + * Provides access to scaling data for individual parts of a model. + */ +public interface IModelScale { + + /** + * Retrieves the scaling settings for a specified model part. + * Parts are indexed as follows: 0 - head, 1 - body, 2 - arms, 3 - legs. + * + * @param part the index of the model part. + * @return the scale configuration for that part. + */ + IModelScalePart getPart(int part); +} diff --git a/java/noppes/npcs/api/entity/data/IModelScalePart.java b/java/noppes/npcs/api/entity/data/IModelScalePart.java index 00b6e26..fdc1a66 100644 --- a/java/noppes/npcs/api/entity/data/IModelScalePart.java +++ b/java/noppes/npcs/api/entity/data/IModelScalePart.java @@ -1,12 +1,38 @@ -package noppes.npcs.api.entity.data; - -public interface IModelScalePart { - - void setScale(float x, float y, float z); - - float getScaleX(); - - float getScaleY(); - - float getScaleZ(); -} +package noppes.npcs.api.entity.data; + +/** + * Represents the scale configuration for a specific part of a model. + * Allows setting and retrieving scale factors along the X, Y, and Z axes. + */ +public interface IModelScalePart { + + /** + * Sets the scale factors for this model part. + * + * @param x the scale factor along the X-axis. + * @param y the scale factor along the Y-axis. + * @param z the scale factor along the Z-axis. + */ + void setScale(float x, float y, float z); + + /** + * Returns the scale factor along the X-axis. + * + * @return the X-axis scale. + */ + float getScaleX(); + + /** + * Returns the scale factor along the Y-axis. + * + * @return the Y-axis scale. + */ + float getScaleY(); + + /** + * Returns the scale factor along the Z-axis. + * + * @return the Z-axis scale. + */ + float getScaleZ(); +} diff --git a/java/noppes/npcs/api/event/IPlayerEvent.java b/java/noppes/npcs/api/event/IPlayerEvent.java index 7ec624b..102f97a 100644 --- a/java/noppes/npcs/api/event/IPlayerEvent.java +++ b/java/noppes/npcs/api/event/IPlayerEvent.java @@ -8,6 +8,7 @@ import noppes.npcs.api.entity.IEntity; import noppes.npcs.api.entity.IEntityLivingBase; import noppes.npcs.api.entity.IPlayer; import noppes.npcs.api.handler.data.IPlayerEffect; +import noppes.npcs.api.handler.data.IProfile; import noppes.npcs.api.item.IItemStack; public interface IPlayerEvent extends ICustomNPCsEvent { @@ -294,4 +295,23 @@ public interface IPlayerEvent extends ICustomNPCsEvent { } } + + @Cancelable + interface ProfileEvent extends IPlayerEvent { + + IProfile getProfile(); + int getSlot(); + + interface Changed extends ProfileEvent { + int getPrevSlot(); + } + + interface Create extends ProfileEvent { + + } + + interface Removed extends ProfileEvent { + + } + } } diff --git a/java/noppes/npcs/api/handler/data/IAnimationData.java b/java/noppes/npcs/api/handler/data/IAnimationData.java index 8659297..117613f 100644 --- a/java/noppes/npcs/api/handler/data/IAnimationData.java +++ b/java/noppes/npcs/api/handler/data/IAnimationData.java @@ -2,23 +2,71 @@ package noppes.npcs.api.handler.data; import noppes.npcs.api.entity.IAnimatable; +/** + * Holds and manages animation data for an animatable entity. + * This includes the current animation, its timing, and the ability to update + * the animation state on clients. + */ public interface IAnimationData { - + + /** + * Retrieves the animatable entity this data is associated with. + * + * @return the animatable entity. + */ IAnimatable getEntity(); + /** + * Updates the animation data on the client side. + */ void updateClient(); + /** + * Checks whether the current animation is active. + * + * @return true if an animation is active; false otherwise. + */ boolean isActive(); + /** + * Checks whether the client is currently animating. + * + * @return true if client animation is active; false otherwise. + */ boolean isClientAnimating(); + /** + * Enables or disables animations for the entity. + * + * @param enabled true to enable animations; false to disable. + */ void setEnabled(boolean enabled); + /** + * Checks if animations are enabled. + * + * @return true if enabled; false otherwise. + */ boolean enabled(); + /** + * Sets the current animation. + * + * @param animation the animation to set. + */ void setAnimation(IAnimation animation); + /** + * Returns the current animation. + * + * @return the animation, or null if none is set. + */ IAnimation getAnimation(); + /** + * Returns the total time the current animation has been running. + * + * @return the animating time in ticks. + */ long getAnimatingTime(); } diff --git a/java/noppes/npcs/api/handler/data/IAvailability.java b/java/noppes/npcs/api/handler/data/IAvailability.java index a16843c..307c53e 100644 --- a/java/noppes/npcs/api/handler/data/IAvailability.java +++ b/java/noppes/npcs/api/handler/data/IAvailability.java @@ -1,31 +1,173 @@ -package noppes.npcs.api.handler.data; - -import noppes.npcs.api.entity.IPlayer; - -public interface IAvailability { - boolean isAvailable(IPlayer var1); - - int getDaytime(); - - void setDaytime(int var1); - - int getMinPlayerLevel(); - - void setMinPlayerLevel(int var1); - - int getDialog(int var1); - - void setDialog(int var1, int var2, int var3); - - void removeDialog(int var1); - - int getQuest(int var1); - - void setQuest(int var1, int var2, int var3); - - void removeQuest(int var1); - - void setFaction(int var1, int var2, int var3, int var4); - - void removeFaction(int var1); -} +package noppes.npcs.api.handler.data; + +import noppes.npcs.api.entity.IPlayer; + +/** + * Defines the conditions that determine if certain NPC interactions + * (dialogs, quests, and faction requirements) are available to a player. + *

+ * Availability conditions include: + *

    + *
  • Daytime restrictions (Always, Day, or Night)
  • + *
  • Dialog conditions (based on whether a dialog has been read or not)
  • + *
  • Quest conditions (before, after, active, not active, acceptable, etc.)
  • + *
  • Faction requirements (faction ID, availability type and required stance)
  • + *
  • Minimum player level
  • + *
+ * The method {@link #isAvailable(IPlayer)} evaluates all these criteria. + */ +public interface IAvailability { + + /** + * Determines whether all availability conditions are met for the given player. + *

+ * Conditions checked include: + *

    + *
  • Daytime requirement – if set to Day, the player must be in daytime; if Night, in nighttime.
  • + *
  • Dialog conditions – all dialog slots (0–3) must match their respective availability settings.
  • + *
  • Quest conditions – all quest slots (0–3) must satisfy their availability criteria.
  • + *
  • Faction conditions – each faction requirement (slot 0 and 1) must match the specified faction availability and stance.
  • + *
  • Minimum player level – the player's level must be at least the required minimum.
  • + *
+ * + * @param player the player for whom availability is being checked. + * @return true if all conditions are met; false otherwise. + */ + boolean isAvailable(IPlayer player); + + /** + * Returns the daytime condition requirement as an ordinal value. + *

+ * The returned value corresponds to: + *

    + *
  • 0 – Always
  • + *
  • 1 – Day
  • + *
  • 2 – Night
  • + *
+ * + * @return the ordinal value representing the required daytime condition. + */ + int getDaytime(); + + /** + * Sets the daytime condition requirement. + *

+ * The provided value is clamped between 0 and 2, corresponding to: + *

    + *
  • 0 – Always
  • + *
  • 1 – Day
  • + *
  • 2 – Night
  • + *
+ * + * @param daytime the ordinal value for the daytime condition. + */ + void setDaytime(int daytime); + + /** + * Returns the minimum player level required for the availability conditions. + * + * @return the minimum player level. + */ + int getMinPlayerLevel(); + + /** + * Sets the minimum player level required for the availability conditions. + * + * @param level the minimum player level. + */ + void setMinPlayerLevel(int level); + + /** + * Retrieves the dialog ID for the specified slot. + *

+ * Valid slot indices are 0 to 3. A dialog ID of -1 indicates no dialog is set. + * + * @param index the dialog slot index (0–3). + * @return the dialog ID associated with the specified slot. + */ + int getDialog(int index); + + /** + * Sets the dialog for the specified slot with the given dialog ID and availability type. + *

+ * The availability type (provided as an ordinal) determines when the dialog is available: + *

    + *
  • 0 – Always
  • + *
  • 1 – Before (available before the dialog is read)
  • + *
  • 2 – After (available after the dialog is read)
  • + *
+ * + * @param index the dialog slot index (0–3). + * @param id the dialog ID to set. + * @param type the availability type as an ordinal value. + */ + void setDialog(int index, int id, int type); + + /** + * Removes the dialog from the specified slot, resetting it to default values. + *

+ * After removal, the dialog ID is set to -1 and its availability is reset to Always. + * + * @param index the dialog slot index (0–3). + */ + void removeDialog(int index); + + /** + * Retrieves the quest ID for the specified slot. + *

+ * Valid slot indices are 0 to 3. A quest ID of -1 indicates no quest is set. + * + * @param index the quest slot index (0–3). + * @return the quest ID for the specified slot. + */ + int getQuest(int index); + + /** + * Sets the quest for the specified slot with the given quest ID and availability type. + *

+ * The availability type for quests is provided as an ordinal and can represent various conditions + * such as Always, After, Before, Active, NotActive, Acceptable, or NotAcceptable. + * + * @param index the quest slot index (0–3). + * @param id the quest ID to set. + * @param type the availability type as an ordinal value. + */ + void setQuest(int index, int id, int type); + + /** + * Removes the quest from the specified slot, resetting it to default values. + *

+ * After removal, the quest ID is set to -1 and its availability is reset to Always. + * + * @param index the quest slot index (0–3). + */ + void removeQuest(int index); + + /** + * Sets the faction requirement for the specified slot with the given parameters. + *

+ * The parameters are: + *

    + *
  • slot – the faction slot index (0 or 1).
  • + *
  • id – the faction ID.
  • + *
  • type – the faction availability type (clamped between 0 and 2).
  • + *
  • stance – the required faction stance (clamped between 0 and 2).
  • + *
+ * + * @param slot the faction slot index (0 or 1). + * @param id the faction ID. + * @param type the faction availability type as an ordinal value. + * @param stance the required faction stance as an ordinal value. + */ + void setFaction(int slot, int id, int type, int stance); + + /** + * Removes the faction requirement from the specified slot, resetting it to default values. + *

+ * After removal, the faction ID is set to -1, the availability type is set to Always, + * and the faction stance is reset to Friendly. + * + * @param slot the faction slot index (0 or 1). + */ + void removeFaction(int slot); +}