A lot of GOOD API DOCUMENTATION

This commit is contained in:
Kam committed 2026-03-09 16:20:07 -04:00
1 parent a6c55ca331
commit 319e774518
131 files changed
+3363 -175

No files matched your search

+8
View File
@@ -67,6 +67,7 @@ public class Vec3i implements Comparable<Vec3i> {
/**
* Get the X coordinate
* @return the X component
*/
public int getX() {
return this.x;
@@ -74,6 +75,7 @@ public class Vec3i implements Comparable<Vec3i> {
/**
* Get the Y coordinate
* @return the Y component
*/
public int getY() {
return this.y;
@@ -81,6 +83,7 @@ public class Vec3i implements Comparable<Vec3i> {
/**
* Get the Z coordinate
* @return the Z component
*/
public int getZ() {
return this.z;
@@ -89,6 +92,7 @@ public class Vec3i implements Comparable<Vec3i> {
/**
* Get the X coordinate as a double
* @return the X component as a double
*/
public double getXD() {
return this.xd;
@@ -96,6 +100,7 @@ public class Vec3i implements Comparable<Vec3i> {
/**
* Get the Y coordinate as a double
* @return the Y component as a double
*/
public double getYD() {
return this.yd;
@@ -103,6 +108,7 @@ public class Vec3i implements Comparable<Vec3i> {
/**
* Get the Z coordinate as a double
* @return the Z component as a double
*/
public double getZD() {
return this.zd;
@@ -110,6 +116,8 @@ public class Vec3i implements Comparable<Vec3i> {
/**
* Calculate the cross product of this and the given Vector
* @param vec the other vector
* @return the cross product of this vector and the given vector
*/
public Vec3i crossProduct(Vec3i vec) {
return new Vec3i(this.getYD() * vec.getZD() - this.getZD() * vec.getYD(), this.getZD() * vec.getXD() - this.getXD() * vec.getZD(), this.getXD() * vec.getYD() - this.getYD() * vec.getXD());
+70 -4
View File
@@ -50,6 +50,11 @@ public class BlockPos extends Vec3i {
/**
* Add the given coordinates to the coordinates of this BlockPos
*
* @param x X offset
* @param y Y offset
* @param z Z offset
* @return a new BlockPos offset by the given values
*/
public BlockPos add(double x, double y, double z) {
return x == 0.0D && y == 0.0D && z == 0.0D ? this : new BlockPos(this.getXD() + x, this.getYD() + y, this.getZD() + z);
@@ -57,6 +62,11 @@ public class BlockPos extends Vec3i {
/**
* Add the given coordinates to the coordinates of this BlockPos
*
* @param x X offset
* @param y Y offset
* @param z Z offset
* @return a new BlockPos offset by the given values
*/
public BlockPos add(int x, int y, int z) {
return x == 0 && y == 0 && z == 0 ? this : new BlockPos(this.getXD() + x, this.getYD() + y, this.getZD() + z);
@@ -64,6 +74,9 @@ public class BlockPos extends Vec3i {
/**
* Add the given Vector to this BlockPos
*
* @param vec the vector to add
* @return a new BlockPos offset by the vector
*/
public BlockPos add(Vec3i vec) {
return vec.getXD() == 0 && vec.getYD() == 0 && vec.getZD() == 0 ? this : new BlockPos(this.getXD() + vec.getXD(), this.getYD() + vec.getYD(), this.getZD() + vec.getZD());
@@ -71,6 +84,8 @@ public class BlockPos extends Vec3i {
/**
* Offset this BlockPos 1 block up
*
* @return the BlockPos one block above
*/
public BlockPos up() {
return this.up(1);
@@ -78,6 +93,9 @@ public class BlockPos extends Vec3i {
/**
* Offset this BlockPos n blocks up
*
* @param n the distance upward
* @return the BlockPos n blocks above
*/
public BlockPos up(double n) {
return this.offset(EnumFacing.UP, n);
@@ -85,6 +103,8 @@ public class BlockPos extends Vec3i {
/**
* Offset this BlockPos 1 block down
*
* @return the BlockPos one block below
*/
public BlockPos down() {
return this.down(1);
@@ -92,6 +112,9 @@ public class BlockPos extends Vec3i {
/**
* Offset this BlockPos n blocks down
*
* @param n the distance downward
* @return the BlockPos n blocks below
*/
public BlockPos down(double n) {
return this.offset(EnumFacing.DOWN, n);
@@ -99,6 +122,8 @@ public class BlockPos extends Vec3i {
/**
* Offset this BlockPos 1 block in northern direction
*
* @return the BlockPos one block to the north
*/
public BlockPos north() {
return this.north(1);
@@ -106,6 +131,9 @@ public class BlockPos extends Vec3i {
/**
* Offset this BlockPos n blocks in northern direction
*
* @param n the distance northward
* @return the BlockPos n blocks to the north
*/
public BlockPos north(double n) {
return this.offset(EnumFacing.NORTH, n);
@@ -113,6 +141,8 @@ public class BlockPos extends Vec3i {
/**
* Offset this BlockPos 1 block in southern direction
*
* @return the BlockPos one block to the south
*/
public BlockPos south() {
return this.south(1);
@@ -120,6 +150,9 @@ public class BlockPos extends Vec3i {
/**
* Offset this BlockPos n blocks in southern direction
*
* @param n the distance southward
* @return the BlockPos n blocks to the south
*/
public BlockPos south(double n) {
return this.offset(EnumFacing.SOUTH, n);
@@ -127,6 +160,8 @@ public class BlockPos extends Vec3i {
/**
* Offset this BlockPos 1 block in western direction
*
* @return the BlockPos one block to the west
*/
public BlockPos west() {
return this.west(1);
@@ -134,6 +169,9 @@ public class BlockPos extends Vec3i {
/**
* Offset this BlockPos n blocks in western direction
*
* @param n the distance westward
* @return the BlockPos n blocks to the west
*/
public BlockPos west(double n) {
return this.offset(EnumFacing.WEST, n);
@@ -141,6 +179,8 @@ public class BlockPos extends Vec3i {
/**
* Offset this BlockPos 1 block in eastern direction
*
* @return the BlockPos one block to the east
*/
public BlockPos east() {
return this.east(1);
@@ -148,6 +188,9 @@ public class BlockPos extends Vec3i {
/**
* Offset this BlockPos n blocks in eastern direction
*
* @param n the distance eastward
* @return the BlockPos n blocks to the east
*/
public BlockPos east(double n) {
return this.offset(EnumFacing.EAST, n);
@@ -155,6 +198,9 @@ public class BlockPos extends Vec3i {
/**
* Offset this BlockPos 1 block in the given direction
*
* @param facing the direction to offset
* @return the BlockPos one block in the given direction
*/
public BlockPos offset(EnumFacing facing) {
return this.offset(facing, 1);
@@ -162,6 +208,10 @@ public class BlockPos extends Vec3i {
/**
* Offsets this BlockPos n blocks in the given direction
*
* @param facing the direction to offset
* @param n the distance
* @return the BlockPos n blocks in the given direction
*/
public BlockPos offset(EnumFacing facing, double n) {
return n == 0 ? this : new BlockPos(this.getXD() + facing.getFrontOffsetX() * n, this.getYD() + facing.getFrontOffsetY() * n, this.getZD() + facing.getFrontOffsetZ() * n);
@@ -176,6 +226,8 @@ public class BlockPos extends Vec3i {
/**
* Serialize this BlockPos into a long value
*
* @return this position serialized as a long
*/
public long toLong() {
return ((long) this.getX() & X_MASK) << X_SHIFT | ((long) this.getY() & Y_MASK) << Y_SHIFT | ((long) this.getZ() & Z_MASK) << 0;
@@ -183,6 +235,9 @@ public class BlockPos extends Vec3i {
/**
* Create a BlockPos from a serialized long value (created by toLong)
*
* @param serialized the serialized position
* @return a BlockPos decoded from the long
*/
public static BlockPos fromLong(long serialized) {
int i = (int) (serialized << 64 - X_SHIFT - NUM_X_BITS >> 64 - NUM_X_BITS);
@@ -193,6 +248,10 @@ public class BlockPos extends Vec3i {
/**
* Create an Iterable that returns all positions in the box specified by the given corners
*
* @param from the starting corner
* @param to the ending corner
* @return an iterable of all BlockPos within the bounding box
*/
public static Iterable<BlockPos> getAllInBox(BlockPos from, BlockPos to) {
final BlockPos blockpos = new BlockPos(Math.min(from.getX(), to.getX()), Math.min(from.getY(), to.getY()), Math.min(from.getZ(), to.getZ()));
@@ -285,11 +344,16 @@ public class BlockPos extends Vec3i {
/**
* Sets the position, MUST not be name 'set' as that causes obfusication conflicts with func_185343_d
*
* @param x the X coordinate
* @param y the Y coordinate
* @param z the Z coordinate
* @return this mutable position
*/
public BlockPos.MutableBlockPos setPos(int xIn, int yIn, int zIn) {
this.x = xIn;
this.y = yIn;
this.z = zIn;
public BlockPos.MutableBlockPos setPos(int x, int y, int z) {
this.x = x;
this.y = y;
this.z = z;
return this;
}
@@ -318,6 +382,8 @@ public class BlockPos extends Vec3i {
*
* <p>When storing a BlockPos given to you for an extended period of time, make sure you
* use this in case the value is changed internally.</p>
*
* @return an immutable copy of this position
*/
public BlockPos toImmutable() {
return new BlockPos(this);
+23 -12
View File
@@ -32,12 +32,15 @@ public class IntHashMap<V> {
/**
* Returns the object associated to a key
*
* @param key the integer key to look up
* @return the value associated with the key, or null if not found
*/
public V lookup(int p_76041_1_) {
int i = computeHash(p_76041_1_);
public V lookup(int key) {
int i = computeHash(key);
for (IntHashMap.Entry<V> entry = this.slots[getSlotIndex(i, this.slots.length)]; entry != null; entry = entry.nextEntry) {
if (entry.hashEntry == p_76041_1_) {
if (entry.hashEntry == key) {
return entry.valueEntry;
}
}
@@ -47,9 +50,12 @@ public class IntHashMap<V> {
/**
* Returns true if this hash table contains the specified item.
*
* @param key the integer key to check
* @return true if the map contains this key
*/
public boolean containsItem(int p_76037_1_) {
return this.lookupEntry(p_76037_1_) != null;
public boolean containsItem(int key) {
return this.lookupEntry(key) != null;
}
final IntHashMap.Entry<V> lookupEntry(int p_76045_1_) {
@@ -66,19 +72,22 @@ public class IntHashMap<V> {
/**
* Adds a key and associated value to this map
*
* @param key the integer key
* @param value the value to associate with the key
*/
public void addKey(int p_76038_1_, V p_76038_2_) {
int i = computeHash(p_76038_1_);
public void addKey(int key, V value) {
int i = computeHash(key);
int j = getSlotIndex(i, this.slots.length);
for (IntHashMap.Entry<V> entry = this.slots[j]; entry != null; entry = entry.nextEntry) {
if (entry.hashEntry == p_76038_1_) {
entry.valueEntry = p_76038_2_;
if (entry.hashEntry == key) {
entry.valueEntry = value;
return;
}
}
this.insert(i, p_76038_1_, p_76038_2_, j);
this.insert(i, key, value, j);
}
/**
@@ -128,9 +137,11 @@ public class IntHashMap<V> {
/**
* Removes the specified object from the map and returns it
*
* @param key the integer key to remove
*/
public V removeObject(int p_76049_1_) {
IntHashMap.Entry<V> entry = this.removeEntry(p_76049_1_);
public V removeObject(int key) {
IntHashMap.Entry<V> entry = this.removeEntry(key);
return (V) (entry == null ? null : entry.valueEntry);
}
+13
View File
@@ -190,6 +190,12 @@ public abstract class AbstractNpcAPI {
/**
*
* Spawns a new NPC in the world at the given coordinates and returns an ICustomNpc object of it.
*
* @param var1 the world
* @param var2 X position
* @param var3 Y position
* @param var4 Z position
* @return the spawned NPC
*/
public abstract ICustomNpc<?> spawnNPC(IWorld var1, int var2, int var3, int var4);
@@ -243,11 +249,13 @@ public abstract class AbstractNpcAPI {
public abstract IItemStack getIItemStack(ItemStack var1);
/**
* @param var1 the Minecraft world
* @return A single IWorld from Loaded IWorlds
*/
public abstract IWorld getIWorld(World var1);
/**
* @param var1 the dimension ID
* @return A single IWorld from Loaded IWorlds
*/
public abstract IWorld getIWorld(int var1);
@@ -257,6 +265,7 @@ public abstract class AbstractNpcAPI {
* Forge sometimes automatically, unloads the End when all players
* are no longer present.
*
* @param var1 the dimension ID
* @return A single IWorld from Loaded/Unloaded IWorlds
*/
public abstract IWorld getIWorldLoad(int var1);
@@ -325,6 +334,7 @@ public abstract class AbstractNpcAPI {
* 0: Random
* 1: Male
* 2: Female
* @return a random name
*/
public abstract String getRandomName(int dictionary, int gender);
@@ -357,6 +367,7 @@ public abstract class AbstractNpcAPI {
/**
*
* @param directory the particle texture directory
* @return A new IParticle object initialized with the given texture.
*/
public abstract IParticle createParticle(String directory);
@@ -408,12 +419,14 @@ public abstract class AbstractNpcAPI {
/**
*
* @param id the overlay ID
* @return A new ICustomOverlay overlay object with the given ID.
*/
public abstract ICustomOverlay createCustomOverlay(int id);
/**
*
* @param texture the texture path
* @return A new ISkinOverlay object initialized with the given texture.
*/
public abstract ISkinOverlay createSkinOverlay(String texture);
+44
View File
@@ -1,23 +1,67 @@
package noppes.npcs.api;
/**
* Represents a custom command that can be registered and executed.
*/
public interface ICommand {
/**
* Gets the name of this command.
* @return the command name
*/
String getCommandName();
/**
* Gets the usage string for this command.
* @return the command usage description
*/
String getCommandUsage();
/**
* Gets the permission level required to execute this command.
* @return the permission level (0 = all, 1 = moderator, 2 = gamemaster, 3 = admin, 4 = owner)
*/
int getPermissionLevel();
/**
* Sets the name of this command.
* @param commandName the command name to set
*/
void setCommandName(String commandName);
/**
* Sets the usage string for this command.
* @param commandUsage the command usage description to set
*/
void setCommandUsage(String commandUsage);
/**
* Sets the permission level required to execute this command.
* @param permissionLevel the permission level (0 = all, 1 = moderator, 2 = gamemaster, 3 = admin, 4 = owner)
*/
void setPermissionLevel(int permissionLevel);
/**
* Gets all aliases for this command.
* @return an array of alias strings
*/
String[] getAliases();
/**
* Adds one or more aliases for this command.
* @param aliases the alias(es) to add
*/
void addAliases(String... aliases);
/**
* Checks whether this command has a specific alias.
* @param alias the alias to check for
* @return true if the alias exists
*/
boolean hasAlias(String alias);
/**
* Removes an alias from this command.
* @param alias the alias to remove
*/
void removeAlias(String alias);
}
+62 -1
View File
@@ -17,21 +17,51 @@ public interface IEnergyController {
/**
* Create an energy orb projectile. Not spawned until fire() is called.
* @param world the world
* @param owner the owning entity
* @param x X position
* @param y Y position
* @param z Z position
* @param size the orb size
* @return the energy orb entity
*/
IEnergyOrb createOrb(IWorld world, IEntity owner, double x, double y, double z, float size);
/**
* Create an energy beam projectile. Not spawned until fire() is called.
* @param world the world
* @param owner the owning entity
* @param x X position
* @param y Y position
* @param z Z position
* @param beamWidth the beam width
* @param headSize the head size
* @return the energy beam entity
*/
IEnergyBeam createBeam(IWorld world, IEntity owner, double x, double y, double z, float beamWidth, float headSize);
/**
* Create an energy disc projectile. Not spawned until fire() is called.
* @param world the world
* @param owner the owning entity
* @param x X position
* @param y Y position
* @param z Z position
* @param radius the disc radius
* @param thickness the disc thickness
* @return the energy disc entity
*/
IEnergyDisc createDisc(IWorld world, IEntity owner, double x, double y, double z, float radius, float thickness);
/**
* Create an energy laser projectile. Not spawned until fire() is called.
* @param world the world
* @param owner the owning entity
* @param x X position
* @param y Y position
* @param z Z position
* @param laserWidth the laser width
* @return the energy laser entity
*/
IEnergyLaser createLaser(IWorld world, IEntity owner, double x, double y, double z, float laserWidth);
@@ -40,12 +70,24 @@ public interface IEnergyController {
/**
* Create a hazard zone entity with defaults. Not spawned until spawn() is called.
* Hazards deal continuous damage to entities within the zone.
* @param world the world
* @param owner the owning entity
* @param x X position
* @param y Y position
* @param z Z position
* @return the energy zone entity
*/
IEnergyZone createHazard(IWorld world, IEntity owner, double x, double y, double z);
/**
* Create a trap zone entity with defaults. Not spawned until spawn() is called.
* Traps trigger when entities enter and deal burst damage.
* @param world the world
* @param owner the owning entity
* @param x X position
* @param y Y position
* @param z Z position
* @return the energy zone entity
*/
IEnergyZone createTrap(IWorld world, IEntity owner, double x, double y, double z);
@@ -54,6 +96,12 @@ public interface IEnergyController {
/**
* Create a sweeper entity with defaults. Not spawned until spawn() is called.
* Sweepers rotate a beam that damages entities in its path.
* @param world the world
* @param owner the owning entity
* @param x X position
* @param y Y position
* @param z Z position
* @return the energy sweeper entity
*/
IEnergySweeper createSweeper(IWorld world, IEntity owner, double x, double y, double z);
@@ -62,6 +110,12 @@ public interface IEnergyController {
/**
* Create a panel entity with defaults. Not spawned until spawn() is called.
* Panels are flat energy barriers that can deal damage on contact.
* @param world the world
* @param owner the owning entity
* @param x X position
* @param y Y position
* @param z Z position
* @return the energy panel entity
*/
IEnergyPanel createPanel(IWorld world, IEntity owner, double x, double y, double z);
@@ -69,7 +123,14 @@ public interface IEnergyController {
/**
* Create an energy explosion entity. Not spawned until spawn() is called.
* Visual-only by default. Set damage > 0 to enable area damage with falloff.
* Visual-only by default. Set damage &gt; 0 to enable area damage with falloff.
* @param world the world
* @param owner the owning entity
* @param x X position
* @param y Y position
* @param z Z position
* @param radius the explosion radius
* @return the energy explosion entity
*/
IEnergyExplosion createExplosion(IWorld world, IEntity owner, double x, double y, double z, float radius);
}
+7
View File
@@ -30,10 +30,12 @@ import net.minecraft.nbt.NBTTagCompound;
public interface INbt {
/**
* Returns the tag with the given key from the compound tag.
* @param key the NBT key
*/
void remove(String key);
/**
* @param key the NBT key
* @return True if the compound tag has a tag with the given key.
*/
boolean has(String key);
@@ -82,12 +84,16 @@ public interface INbt {
* Returns a tag list of objects with this key in the compound tag. All the objects in the list
* will always be of the same type.
*
* @param key the NBT key
* @param value the list type
* @return The tag list of objects, depending on the tag type.
*/
Object[] getList(String key, int value);
/**
* Returns the type of the tag list with this key, as an integer.
* @param key the NBT key
* @return the list element type
*/
int getListType(String key);
@@ -112,6 +118,7 @@ public interface INbt {
/**
*
* @param key the NBT key
* @return The type of the tag with the input key as an integer.
*/
int getType(String key);
@@ -2,9 +2,21 @@ package noppes.npcs.api;
import noppes.npcs.api.entity.IPixelmon;
/**
* Provides access to a player's Pixelmon data, including party and PC storage.
*/
public interface IPixelmonPlayerData {
/**
* Gets the Pixelmon in the specified party slot.
* @param slot the party slot index (0-5)
* @return the Pixelmon in that slot, or null if empty
*/
IPixelmon getPartySlot(int slot);
/**
* Gets the total number of Pixelmon stored in the player's PC.
* @return the PC Pixelmon count
*/
int countPCPixelmon();
}
+11
View File
@@ -19,6 +19,7 @@ public interface IPos {
/**
* Shifts the IPos up by 1 block and returns the new object.
*
* @return the position above
*/
IPos up();
@@ -32,6 +33,7 @@ public interface IPos {
/**
* Shifts the IPos down by 1 block and returns the new object.
*
* @return the position below
*/
IPos down();
@@ -45,6 +47,7 @@ public interface IPos {
/**
* Shifts the IPos north by 1 block and returns the new object.
*
* @return the position to the north
*/
IPos north();
@@ -58,6 +61,7 @@ public interface IPos {
/**
* Shifts the IPos east by 1 block and returns the new object.
*
* @return the position to the east
*/
IPos east();
@@ -71,6 +75,7 @@ public interface IPos {
/**
* Shifts the IPos south by 1 block and returns the new object.
*
* @return the position to the south
*/
IPos south();
@@ -84,6 +89,7 @@ public interface IPos {
/**
* Shifts the IPos west by 1 block and returns the new object.
*
* @return the position to the west
*/
IPos west();
@@ -146,12 +152,17 @@ public interface IPos {
/**
* Offsets the block by 1 block in the given direction and returns the resulting IPos object
*
* @param direction the direction ordinal
* @return the offset position
*/
IPos offset(int direction);
/**
* Offsets the block by n blocks in the given direction and returns the resulting IPos object
*
* @param direction the direction ordinal
* @param n the distance
* @return the offset position
*/
IPos offset(int direction, double n);
+21
View File
@@ -1,12 +1,33 @@
package noppes.npcs.api;
/**
* Represents the scaled screen dimensions of the client display.
*/
public interface IScreenSize {
/**
* Gets the scaled screen width in pixels.
* @return the screen width
*/
public int getWidth();
/**
* Gets the scaled screen height in pixels.
* @return the screen height
*/
public int getHeight();
/**
* Gets a pixel value representing the given percentage of the screen width.
* @param percent the percentage of the width (0.0 to 100.0)
* @return the corresponding pixel value
*/
public int getWidthPercent(double percent);
/**
* Gets a pixel value representing the given percentage of the screen height.
* @param percent the percentage of the height (0.0 to 100.0)
* @return the corresponding pixel value
*/
public int getHeightPercent(double percent);
}
+12
View File
@@ -9,6 +9,7 @@ package noppes.npcs.api;
public interface ISkinOverlay {
/**
* Sets the directory texture of the overlay. Does not support URLs.
* @param texture the texture path
*/
void setTexture(String texture);
@@ -16,6 +17,7 @@ public interface ISkinOverlay {
/**
* Sets whether this overlay glows in the dark or not.
* @param glow whether to glow
*/
void setGlow(boolean glow);
@@ -23,6 +25,7 @@ public interface ISkinOverlay {
/**
* Sets whether this overlay blends on top of bottom textures at any alpha value.
* @param blend whether to blend
*/
void setBlend(boolean blend);
@@ -30,6 +33,7 @@ public interface ISkinOverlay {
/**
* Sets the transparency of the overlay, from 0 to 1.
* @param alpha the alpha value
*/
void setAlpha(float alpha);
@@ -38,6 +42,7 @@ public interface ISkinOverlay {
/**
* Sets the size of the entire overlay when rendered on the entity. By default, overlays render slightly on top of
* the entity's model.
* @param size the overlay size
*/
void setSize(float size);
@@ -49,6 +54,8 @@ public interface ISkinOverlay {
/**
* Sets the texture scale of the overlay. Higher values will "zoom in" to the texture more.
* @param scaleX horizontal scale
* @param scaleY vertical scale
*/
void setTextureScale(float scaleX, float scaleY);
@@ -59,6 +66,8 @@ public interface ISkinOverlay {
/**
* Sets the "texture speed" by which the texture shifts on each render tick. Used to create a powered creeper effect!
* This does not move the entire overlay, it just moves the position at which the texture begins rendering.
* @param speedX horizontal speed
* @param speedY vertical speed
*/
void setSpeed(float speedX, float speedY);
@@ -68,6 +77,9 @@ public interface ISkinOverlay {
/**
* Sets the amount in each direction by which the overlay will be offset from the entity.
* @param offsetX horizontal render offset
* @param offsetY vertical render offset
* @param offsetZ depth render offset
*/
void setOffset(float offsetX, float offsetY, float offsetZ);
+36 -14
View File
@@ -25,9 +25,9 @@ import noppes.npcs.api.entity.IEntity;
*/
public interface ITelegraph {
// ═══════════════════════════════════════════════════════════════════════════
// ==========================================================================
// TYPE
// ═══════════════════════════════════════════════════════════════════════════
// ==========================================================================
/**
* Get the telegraph type.
@@ -43,143 +43,165 @@ public interface ITelegraph {
*/
void setType(String type);
// ═══════════════════════════════════════════════════════════════════════════
// ==========================================================================
// SHAPE PARAMETERS
// ═══════════════════════════════════════════════════════════════════════════
// ==========================================================================
/**
* Get the radius (for CIRCLE and RING types).
* @return the circle/ring radius in blocks
*/
float getRadius();
/**
* Set the radius (for CIRCLE and RING types).
* @param radius circle/ring radius in blocks
*/
void setRadius(float radius);
/**
* Get the inner radius (for RING type).
* @return the inner radius for RING type in blocks
*/
float getInnerRadius();
/**
* Set the inner radius (for RING type).
* @param innerRadius inner radius for RING type in blocks
*/
void setInnerRadius(float innerRadius);
/**
* Get the length (for LINE and CONE types).
* @return the length for LINE/CONE types in blocks
*/
float getLength();
/**
* Set the length (for LINE and CONE types).
* @param length length for LINE/CONE types in blocks
*/
void setLength(float length);
/**
* Get the width (for LINE type).
* @return the width for LINE type in blocks
*/
float getWidth();
/**
* Set the width (for LINE type).
* @param width width for LINE type in blocks
*/
void setWidth(float width);
/**
* Get the angle in degrees (for CONE type).
* @return the arc angle for CONE type in degrees
*/
float getAngle();
/**
* Set the angle in degrees (for CONE type).
* @param angle arc angle for CONE type in degrees
*/
void setAngle(float angle);
// ═══════════════════════════════════════════════════════════════════════════
// ==========================================================================
// TIMING
// ═══════════════════════════════════════════════════════════════════════════
// ==========================================================================
/**
* Get the duration in ticks.
* @return duration in ticks (20 ticks = 1 second)
*/
int getDuration();
/**
* Set the duration in ticks (20 ticks = 1 second).
* @param ticks duration in ticks (20 ticks = 1 second)
*/
void setDuration(int ticks);
// ═══════════════════════════════════════════════════════════════════════════
// ==========================================================================
// COLORS
// ═══════════════════════════════════════════════════════════════════════════
// ==========================================================================
/**
* Get the primary color in ARGB format.
* @return the primary color in ARGB format
*/
int getColor();
/**
* Set the primary color in ARGB format.
* Example: 0x80FF0000 for semi-transparent red
* @param argb primary color in ARGB format (e.g. 0x80FF0000)
*/
void setColor(int argb);
/**
* Get the warning phase color in ARGB format.
* @return the warning phase color in ARGB format
*/
int getWarningColor();
/**
* Set the warning phase color in ARGB format.
* This color is used during the final warning phase.
* @param argb warning phase color in ARGB format
*/
void setWarningColor(int argb);
/**
* Get the tick at which warning phase begins.
* @return the tick at which warning phase begins
*/
int getWarningStartTick();
/**
* Set the tick at which warning phase begins.
* When remaining ticks falls below this value, the telegraph uses the warning color.
* @param tick tick at which warning phase begins
*/
void setWarningStartTick(int tick);
// ═══════════════════════════════════════════════════════════════════════════
// ==========================================================================
// ANIMATION
// ═══════════════════════════════════════════════════════════════════════════
// ==========================================================================
/**
* Check if pulsing animation is enabled.
* @return true if pulsing animation is enabled
*/
boolean isAnimated();
/**
* Enable or disable pulsing animation.
* @param animated whether pulsing animation is enabled
*/
void setAnimated(boolean animated);
// ═══════════════════════════════════════════════════════════════════════════
// ==========================================================================
// POSITIONING
// ═══════════════════════════════════════════════════════════════════════════
// ==========================================================================
/**
* Get the height offset from ground level.
* @return the height offset from ground level in blocks
*/
float getHeightOffset();
/**
* Set the height offset from ground level.
* Default is 0.1 to prevent z-fighting with ground blocks.
* @param offset height offset from ground level in blocks
*/
void setHeightOffset(float offset);
// ═══════════════════════════════════════════════════════════════════════════
// ==========================================================================
// SPAWN METHODS
// ═══════════════════════════════════════════════════════════════════════════
// ==========================================================================
/**
* Spawn this telegraph at a position.
+22 -8
View File
@@ -19,46 +19,55 @@ public interface ITelegraphInstance {
/**
* Get the unique instance ID.
* @return the unique instance identifier
*/
String getInstanceId();
// ═══════════════════════════════════════════════════════════════════════════
// ==========================================================================
// POSITION
// ═══════════════════════════════════════════════════════════════════════════
// ==========================================================================
/**
* Get the current X position.
* @return the current X coordinate
*/
double getX();
/**
* Get the current Y position.
* @return the current Y coordinate
*/
double getY();
/**
* Get the current Z position.
* @return the current Z coordinate
*/
double getZ();
/**
* Get the rotation yaw.
* @return the rotation yaw in degrees
*/
float getYaw();
/**
* Set the position.
* Note: Only works for static telegraphs (not following an entity).
* @param x X coordinate
* @param y Y coordinate
* @param z Z coordinate
*/
void setPosition(double x, double y, double z);
// ═══════════════════════════════════════════════════════════════════════════
// ==========================================================================
// ENTITY FOLLOWING
// ═══════════════════════════════════════════════════════════════════════════
// ==========================================================================
/**
* Make this telegraph follow an entity.
* The telegraph position will update each tick to match the entity.
* @param entity the entity to follow
*/
void followEntity(IEntity entity);
@@ -69,36 +78,41 @@ public interface ITelegraphInstance {
/**
* Check if this telegraph is following an entity.
* @return true if currently following an entity
*/
boolean isFollowing();
// ═══════════════════════════════════════════════════════════════════════════
// ==========================================================================
// TIMING
// ═══════════════════════════════════════════════════════════════════════════
// ==========================================================================
/**
* Get the remaining ticks before the telegraph expires.
* @return remaining ticks before expiration
*/
int getRemainingTicks();
/**
* Get the total duration ticks.
* @return the total duration in ticks
*/
int getTotalTicks();
/**
* Get the progress from 0.0 (just started) to 1.0 (finished).
* @return progress from 0.0 (just started) to 1.0 (finished)
*/
float getProgress();
/**
* Check if the telegraph is in the warning phase.
* @return true if in the warning phase
*/
boolean isWarning();
// ═══════════════════════════════════════════════════════════════════════════
// ==========================================================================
// CONTROL
// ═══════════════════════════════════════════════════════════════════════════
// ==========================================================================
/**
* Remove this telegraph immediately.
+5
View File
@@ -29,10 +29,14 @@ public interface ITileEntity {
/**
* Reads an INbt compound tag, creates a tile entity based on the data, and replaces this entity with the new one.
* @param nbt the NBT data to read from
*/
void readFromNBT(INbt nbt);
/**
* @param x X coordinate
* @param y Y coordinate
* @param z Z coordinate
* @return The distance of this tile entity from the point given by the x, y, and z parameters.
*/
double getDistanceFrom(double x, double y, double z);
@@ -67,6 +71,7 @@ public interface ITileEntity {
/**
* Writes the tile entity to NBT and returns the compound tag.
* @return the tile entity's NBT data
*/
INbt getNBT();
}
+11
View File
@@ -26,6 +26,7 @@ public interface ITimers {
/**
*
* @param id the timer ID
* @return True if the set of timers contains a timer with the given id, false otherwise.
*/
boolean has(int id);
@@ -33,12 +34,14 @@ public interface ITimers {
/**
* Stops the timer with the given id
*
* @param id the timer ID
* @return True if there was a timer with the given id.
*/
boolean stop(int id);
/**
* Resets the ticks elapsed in the timer with the given id to 0.
* @param id the timer ID
*/
void reset(int id);
@@ -48,6 +51,7 @@ public interface ITimers {
void clear();
/**
* @param id the timer ID
* @return The amount of ticks elapsed in the timer.
*/
int ticks(int id);
@@ -55,27 +59,34 @@ public interface ITimers {
/**
* Sets the amount of ticks elapsed in the timer with the given id to a different value.
*
* @param id the timer ID
* @param ticks The new ticks elapsed by the timer.
*/
void setTicks(int id, int ticks);
/**
* @param id the timer ID
* @return The maximum amount of ticks the timer with the given id runs for before it stops.
*/
int maxTicks(int id);
/**
* Sets the maximum amount of ticks the timer with the given id can run for before it stops.
* @param id the timer ID
* @param maxTicks the maximum tick count
*/
void setMaxTicks(int id, int maxTicks);
/**
* @param id the timer ID
* @return True if the timer with the given id repeats, false otherwise.
*/
boolean repeats(int id);
/**
* Sets whether the timer with the given id repeats or not.
* @param id the timer ID
* @param repeat whether the timer repeats
*/
void setRepeats(int id, boolean repeat);
+41 -13
View File
@@ -33,13 +33,14 @@ public interface IWorld {
public IBlock getBlock(int x, int y, int z);
/**
* @param pos
* @param pos the block position
* @return The block at the given position. Returns null if there isn't a block
*/
public IBlock getBlock(IPos pos);
/**
*
* @param x X coordinate
* @param z Z coordinate
* @return The top-most block in the world as an IBlock object.
*/
IBlock getTopBlock(int x, int z);
@@ -71,20 +72,27 @@ public interface IWorld {
boolean canSnowAtBody(int x, int y, int z, boolean checkLight);
/**
* @return The Y-value of the world at this x & z value based on the height map of the world.
* @param x X coordinate
* @param z Z coordinate
* @return The Y-value of the world at this x &amp; z value based on the height map of the world.
*/
int getHeightValue(int x, int z);
int getHeightValue(IPos pos);
/**
* @return The minimum Y-value of the world at this x & z value based on the height map of the world.
* @param x X coordinate
* @param z Z coordinate
* @return The minimum Y-value of the world at this x &amp; z value based on the height map of the world.
*/
int getChunkHeightMapMinimum(int x, int z);
int getChunkHeightMapMinimum(IPos pos);
/**
* @param x X coordinate
* @param y Y coordinate
* @param z Z coordinate
* @return The metadata of the block at this position.
*/
int getBlockMetadata(int x, int y, int z);
@@ -96,15 +104,15 @@ public interface IWorld {
boolean setBlockMetadataWithNotify(IPos pos, int metadata, int flag);
/**
* @param x
* @param y
* @param z
* @param x X coordinate
* @param y Y coordinate
* @param z Z coordinate
* @return can the block at this position see the sky or are there no blocks above this one
*/
boolean canSeeSky(int x, int y, int z);
/**
* @param pos
* @param pos the block position
* @return can the block at this position see the sky or are there no blocks above this one
*/
boolean canSeeSky(IPos pos);
@@ -162,6 +170,11 @@ public interface IWorld {
/**
* Sets the block's tile entity at the given position.
*
* @param x X coordinate
* @param y Y coordinate
* @param z Z coordinate
* @param tileEntity the tile entity to place
*/
void setTileEntity(int x, int y, int z, ITileEntity tileEntity);
@@ -169,13 +182,19 @@ public interface IWorld {
/**
* Removes the block's tile entity at the given position.
*
* @param x X coordinate
* @param y Y coordinate
* @param z Z coordinate
*/
void removeTileEntity(int x, int y, int z);
void removeTileEntity(IPos pos);
/**
*
* @param x X coordinate
* @param y Y coordinate
* @param z Z coordinate
* @return True if the block at this position is of cubic shape. (Not a stair, slab, etc.)
*/
boolean isBlockFullCube(int x, int y, int z);
@@ -212,6 +231,7 @@ public interface IWorld {
* @param y World position y
* @param z World position z
* @param item The block to be set
* @return true if the block was successfully placed
*/
boolean setBlock(int x, int y, int z, IItemStack item);
@@ -222,6 +242,7 @@ public interface IWorld {
* @param y World position y
* @param z World position z
* @param block The block to be set
* @return true if the block was successfully placed
*/
boolean setBlock(int x, int y, int z, IBlock block);
@@ -255,9 +276,12 @@ public interface IWorld {
/**
* starting at the start position, draw a line in the lookVector direction until a block is detected
*
* @param startPos
* @param startPos the ray origin as [x, y, z]
* @param lookVector should be a normalized direction vector
* @param maxDistance
* @param maxDistance maximum ray distance in blocks
* @param stopOnBlock whether to stop on solid blocks
* @param stopOnLiquid whether to stop on liquid blocks
* @param stopOnCollision whether to stop on collision boundaries
* @return the first detected block but null if maxDistance is reached
*/
IBlock rayCastBlock(double[] startPos, double[] lookVector, int maxDistance, boolean stopOnBlock, boolean stopOnLiquid, boolean stopOnCollision);
@@ -269,8 +293,8 @@ public interface IWorld {
IBlock rayCastBlock(IPos startPos, IPos lookVector, int maxDistance);
/**
* @param startPos
* @param maxHeight
* @param startPos the start position as [x, y, z]
* @param maxHeight maximum search height
* @return the position of the closest block of air to startPos
*/
public IPos getNearestAir(IPos startPos, int maxHeight);
@@ -457,6 +481,7 @@ public interface IWorld {
* @param y Spawn Y position
* @param z Spawn Z position
* @param size Orb size
* @return the energy orb entity
*/
IEnergyOrb createEnergyOrb(IEntity owner, double x, double y, double z, float size);
@@ -469,6 +494,7 @@ public interface IWorld {
* @param z Spawn Z position
* @param beamWidth Width of the beam
* @param headSize Size of the beam head
* @return the energy beam entity
*/
IEnergyBeam createEnergyBeam(IEntity owner, double x, double y, double z, float beamWidth, float headSize);
@@ -481,6 +507,7 @@ public interface IWorld {
* @param z Spawn Z position
* @param radius Disc radius
* @param thickness Disc thickness
* @return the energy disc entity
*/
IEnergyDisc createEnergyDisc(IEntity owner, double x, double y, double z, float radius, float thickness);
@@ -492,6 +519,7 @@ public interface IWorld {
* @param y Spawn Y position
* @param z Spawn Z position
* @param laserWidth Width of the laser
* @return the energy laser entity
*/
IEnergyLaser createEnergyLaser(IEntity owner, double x, double y, double z, float laserWidth);
@@ -12,6 +12,7 @@ public interface IAbility extends IAbilityAction {
/**
* Get the unique ID (UUID for custom abilities, registry key for built-in).
* This is the stable reference that never changes after creation.
* @return the unique ability ID
*/
String getId();
@@ -34,6 +35,7 @@ public interface IAbility extends IAbilityAction {
/**
* Get the display name (cosmetic). Falls back to getName() if not set.
* @return the display name
*/
String getDisplayName();
@@ -45,6 +47,7 @@ public interface IAbility extends IAbilityAction {
/**
* Get the type ID of this ability (e.g., "cnpc:slam", "cnpc:beam").
* @return the type ID
*/
String getTypeId();
@@ -106,6 +109,7 @@ public interface IAbility extends IAbilityAction {
/**
* Get the wind-up time in ticks (telegraph phase).
* @return wind-up time in ticks
*/
int getWindUpTicks();
@@ -117,6 +121,7 @@ public interface IAbility extends IAbilityAction {
/**
* Get the dazed time in ticks (stun after interrupt during WINDUP).
* @return dazed time in ticks
*/
int getDazedTicks();
@@ -128,6 +133,7 @@ public interface IAbility extends IAbilityAction {
/**
* Check if this ability can be interrupted by damage.
* @return true if interruptible
*/
boolean isInterruptible();
@@ -139,6 +145,7 @@ public interface IAbility extends IAbilityAction {
/**
* Check if this ability ignores target invulnerability frames (hurt resistance).
* @return true if ignoring invulnerability frames
*/
boolean isIgnoreIFrames();
@@ -193,6 +200,7 @@ public interface IAbility extends IAbilityAction {
/**
* Get track speed for TRACK rotation mode (blocks/second).
* 0 = instant tracking. Comparable to player sprint speed (~5.6 blocks/sec).
* @return track speed in blocks/second
*/
float getTrackSpeedValue();
@@ -205,36 +213,43 @@ public interface IAbility extends IAbilityAction {
/**
* Check if movement (pathfinding/motion) is locked during the WINDUP phase.
* @return true if movement is locked during windup
*/
boolean isMovementLockedDuringWindup();
/**
* Check if movement (pathfinding/motion) is locked during the ACTIVE phase.
* @return true if movement is locked during active phase
*/
boolean isMovementLockedDuringActive();
/**
* Check if rotation (yaw/pitch) is locked during the WINDUP phase.
* @return true if rotation is locked during windup
*/
boolean isRotationLockedDuringWindup();
/**
* Check if rotation (yaw/pitch) is locked during the ACTIVE phase.
* @return true if rotation is locked during active phase
*/
boolean isRotationLockedDuringActive();
/**
* Check if this ability is currently being executed.
* @return true if currently executing
*/
boolean isExecuting();
/**
* Get the current execution phase (0=IDLE, 1=WINDUP, 2=ACTIVE, 3=DAZED, 4=BURST_DELAY).
* @return the current phase ordinal
*/
int getPhaseInt();
/**
* Get the current tick within the current phase.
* @return the current tick within the phase
*/
int getCurrentTick();
@@ -254,6 +269,7 @@ public interface IAbility extends IAbilityAction {
/**
* Check if this ability ignores cooldowns.
* @return true if ignoring cooldowns
*/
boolean isIgnoreCooldown();
@@ -266,6 +282,7 @@ public interface IAbility extends IAbilityAction {
/**
* Check if this ability uses per-ability cooldown instead of global cooldown.
* When true, using this ability only puts THIS ability on cooldown, not all abilities.
* @return true if using per-ability cooldown
*/
boolean isPerAbilityCooldown();
@@ -277,6 +294,7 @@ public interface IAbility extends IAbilityAction {
/**
* Get this ability's data as NBT.
* @return the ability's NBT data
*/
INbt getNbt();
@@ -322,12 +340,14 @@ public interface IAbility extends IAbilityAction {
/**
* Check if this ability is toggleable (has at least 1 toggle state).
* @return true if toggleable
*/
boolean isToggleable();
/**
* Get the number of toggle states.
* 0 = not toggleable, 1 = binary on/off, 2+ = multi-state cycling.
* @return number of toggle states
*/
int getToggleStates();
@@ -17,17 +17,25 @@ public interface IAbilityHandler {
/**
* Check if an ability type is registered.
*
* @param typeId the type ID to check
* @return true if registered
*/
boolean hasType(String typeId);
/**
* Get all registered ability type IDs.
*
* @return array of registered type IDs
*/
String[] getTypes();
/**
* Create a new ability of the given type.
* Returns null if the type is not registered.
*
* @param typeId the type ID
* @return the new ability, or null
*/
IAbility create(String typeId);
@@ -8,11 +8,13 @@ public interface ICustomAbility extends IAbility {
/**
* Get the duration in ticks for instant mode (non-toggle).
* @return duration in ticks
*/
int getDurationTicks();
/**
* Set the duration in ticks for instant mode.
* @param ticks duration in ticks
*/
void setDurationTicks(int ticks);
@@ -43,72 +45,86 @@ public interface ICustomAbility extends IAbility {
/**
* Get how many ticks the telegraph persists during the active phase.
* When syncTelegraphWithDuration is true, this returns the duration ticks.
* @return telegraph active ticks
*/
int getTelegraphActiveTicks();
/**
* Set how many ticks the telegraph persists during the active phase.
* Only used when syncTelegraphWithDuration is false.
* @param ticks telegraph active ticks
*/
void setTelegraphActiveTicks(int ticks);
/**
* Whether telegraph active ticks are synced to the ability duration.
* @return true if synced
*/
boolean isSyncTelegraphWithDuration();
/**
* Set whether telegraph active ticks should sync to the ability duration.
* @param sync whether to sync
*/
void setSyncTelegraphWithDuration(boolean sync);
/**
* Get the telegraph radius (used by CIRCLE, RING, SQUARE shapes).
* @return the telegraph radius
*/
float getTelegraphRadius();
/**
* Set the telegraph radius.
* @param radius the telegraph radius
*/
void setTelegraphRadius(float radius);
/**
* Get the telegraph inner radius (used by RING, CONE shapes).
* @return the inner radius
*/
float getTelegraphInnerRadius();
/**
* Set the telegraph inner radius.
* @param innerRadius the inner radius
*/
void setTelegraphInnerRadius(float innerRadius);
/**
* Get the telegraph length (used by LINE, CONE shapes).
* @return the telegraph length
*/
float getTelegraphLength();
/**
* Set the telegraph length.
* @param length the telegraph length
*/
void setTelegraphLength(float length);
/**
* Get the telegraph width (used by LINE shape).
* @return the telegraph width
*/
float getTelegraphWidth();
/**
* Set the telegraph width.
* @param width the telegraph width
*/
void setTelegraphWidth(float width);
/**
* Get the telegraph angle in degrees (used by CONE shape).
* @return the telegraph angle in degrees
*/
float getTelegraphAngle();
/**
* Set the telegraph angle in degrees.
* @param angle the angle in degrees
*/
void setTelegraphAngle(float angle);
}
@@ -8,54 +8,78 @@ public interface IDataAbilities {
/**
* Check if the ability system is enabled for this NPC.
*
* @return true if enabled
*/
boolean isEnabled();
/**
* Enable or disable the ability system for this NPC.
*
* @param enabled whether to enable
*/
void setEnabled(boolean enabled);
/**
* Get all abilities assigned to this NPC (resolved from slots).
* Returns safe deep copies. Use {@link #getSourceAbility(String)} for live references.
*
* @return array of abilities
*/
IAbility[] getAbilities();
/**
* Add an inline ability to this NPC.
*
* @param ability the ability to add
*/
void addAbility(IAbility ability);
/**
* Add a reference ability by key (built-in name or custom UUID).
*
* @param key the ability reference key
*/
void addAbilityReference(String key);
/**
* Remove an ability by ID.
*
* @param abilityId the ability ID to remove
*/
void removeAbility(String abilityId);
/**
* Get an ability by ID.
* Returns a safe deep copy. Use {@link #getSourceAbility(String)} for the live reference.
*
* @param abilityId the ability ID
* @return the ability, or null
*/
IAbility getAbility(String abilityId);
/**
* Check if the NPC has an ability with the given ID.
*
* @param abilityId the ability ID
* @return true if found
*/
boolean hasAbility(String abilityId);
/**
* Check if a slot is a reference (by ability ID).
*
* @param abilityId the ability ID
* @return true if reference
*/
boolean isAbilityReference(String abilityId);
/**
* Convert a reference slot to inline (by ability ID).
* Returns false if the reference cannot be resolved.
*
* @param abilityId the ability ID
* @return true if converted successfully
*/
boolean convertToInline(String abilityId);
@@ -67,11 +91,15 @@ public interface IDataAbilities {
/**
* Get the currently executing ability, or null if none.
* Returns a safe deep copy. Use {@link #getSourceCurrentAbility()} for the live reference.
*
* @return the current ability, or null
*/
IAbility getCurrentAbility();
/**
* Check if any ability is currently executing.
*
* @return true if executing
*/
boolean isExecutingAbility();
@@ -87,11 +115,15 @@ public interface IDataAbilities {
/**
* Get the global cooldown timer in ticks.
*
* @return cooldown in ticks
*/
int getGlobalCooldown();
/**
* Set the global cooldown timer in ticks.
*
* @param ticks cooldown in ticks
*/
void setGlobalCooldown(int ticks);
@@ -10,6 +10,8 @@ public interface IPlayerAbilityData {
/**
* Get all unlocked ability keys.
*
* @return array of ability keys
*/
String[] getUnlockedAbilities();
@@ -22,26 +24,37 @@ public interface IPlayerAbilityData {
/**
* Lock (remove) an ability from this player.
*
* @param key the ability key
*/
void lockAbility(String key);
/**
* Check if the player has unlocked a specific ability.
*
* @param key the ability key
* @return true if unlocked
*/
boolean hasUnlockedAbility(String key);
/**
* Get the currently selected ability index.
*
* @return the selected index
*/
int getSelectedIndex();
/**
* Set the selected ability index.
*
* @param index the ability index
*/
void setSelectedIndex(int index);
/**
* Get the key of the currently selected ability.
*
* @return the selected ability key
*/
String getSelectedAbilityKey();
@@ -57,11 +70,15 @@ public interface IPlayerAbilityData {
/**
* Check if the player is currently executing an ability.
*
* @return true if executing
*/
boolean isExecutingAbility();
/**
* Get the currently executing ability.
*
* @return the current ability, or null
*/
IAbility getCurrentAbility();
@@ -77,6 +94,8 @@ public interface IPlayerAbilityData {
/**
* Check if the player is on universal cooldown.
*
* @return true if on cooldown
*/
boolean isOnCooldown();
@@ -107,11 +126,16 @@ public interface IPlayerAbilityData {
/**
* Activate the currently selected ability.
*
* @return true if activated
*/
boolean activateAbility();
/**
* Activate a specific ability by key.
*
* @param key the ability key
* @return true if activated
*/
boolean activateAbility(String key);
@@ -119,24 +143,33 @@ public interface IPlayerAbilityData {
/**
* Cycle a toggle ability to its next state.
* Off -> State 1 -> State 2 -> ... -> State N -> Off
* Off -&gt; State 1 -&gt; State 2 -&gt; ... -&gt; State N -&gt; Off
* @param key the ability key
* @return The new state (0 = off, 1+ = active state number)
*/
int toggleAbility(String key);
/**
* Get the current toggle state for an ability.
*
* @param key the ability key
* @return 0 if not active, 1+ for active state
*/
int getToggleState(String key);
/**
* Set a toggle to a specific state. 0 = deactivate, 1+ = specific state.
*
* @param key the ability key
* @param state the toggle state
*/
void setToggleState(String key, int state);
/**
* Check if a toggle ability is currently active (any state > 0).
* Check if a toggle ability is currently active (any state &gt; 0).
*
* @param key the ability key
* @return true if toggled on
*/
boolean isAbilityToggled(String key);
}
@@ -5,10 +5,13 @@ package noppes.npcs.api.ability.data;
* Controls where the projectile spawns relative to the caster.
*/
public interface IEnergyAnchorData {
/** @return Anchor point ordinal (0=FEET, 1=CENTER, 2=RIGHT_HAND, 3=LEFT_HAND, 4=HEAD, 5=FRONT, 6=ABOVE_HEAD). */
/** @return Anchor point ordinal (0=FRONT, 1=CENTER, 2=RIGHT_HAND, 3=LEFT_HAND, 4=ABOVE_HEAD, 5=CHEST, 6=EYE). */
int getAnchor();
/** Set the anchor point. @param anchor Anchor ordinal (0=FEET, 1=CENTER, 2=RIGHT_HAND, 3=LEFT_HAND, 4=HEAD, 5=FRONT, 6=ABOVE_HEAD). */
/**
* Set the anchor point.
* @param anchor Anchor ordinal (0=FRONT, 1=CENTER, 2=RIGHT_HAND, 3=LEFT_HAND, 4=ABOVE_HEAD, 5=CHEST, 6=EYE)
*/
void setAnchor(int anchor);
/** @return X offset from the anchor point (positive = right). */
@@ -79,11 +79,13 @@ public interface IBlockScripted extends IBlock {
/**
* TYPO VERSION
* @return true if entities can pass through this block
*/
boolean getIsPassible();
/**
* TYPO VERSION
* @param bo whether entities can pass through this block
*/
void setIsPassible(boolean bo);
+63 -2
View File
@@ -1,42 +1,103 @@
package noppes.npcs.api.block;
/**
* Represents a text plane that can be positioned, rotated, and scaled on a block.
*/
public interface ITextPlane {
/**
* Gets the text displayed on this plane.
* @return the display text
*/
public String getText();
/**
* Sets the text displayed on this plane.
* @param text the display text to set
*/
public void setText(String text);
/**
* Gets the X-axis rotation in degrees.
* @return the X rotation
*/
public int getRotationX();
/**
* Gets the Y-axis rotation in degrees.
* @return the Y rotation
*/
public int getRotationY();
/**
* Gets the Z-axis rotation in degrees.
* @return the Z rotation
*/
public int getRotationZ();
/**
* Sets the X-axis rotation in degrees.
* @param x the X rotation to set
*/
public void setRotationX(int x);
/**
* Sets the Y-axis rotation in degrees.
* @param y the Y rotation to set
*/
public void setRotationY(int y);
/**
* @param z Default: 0.5
* Sets the Z-axis rotation in degrees.
* @param z the Z rotation to set. Default: 0.5
*/
public void setRotationZ(int z);
/**
* Gets the X-axis positional offset.
* @return the X offset
*/
public float getOffsetX();
/**
* Gets the Y-axis positional offset.
* @return the Y offset
*/
public float getOffsetY();
/**
* Gets the Z-axis positional offset.
* @return the Z offset
*/
public float getOffsetZ();
/**
* Sets the X-axis positional offset.
* @param x the X offset to set
*/
public void setOffsetX(float x);
/**
* Sets the Y-axis positional offset.
* @param y the Y offset to set
*/
public void setOffsetY(float y);
/**
* Sets the Z-axis positional offset.
* @param z the Z offset to set
*/
public void setOffsetZ(float z);
/**
* Gets the scale of the text plane.
* @return the scale factor
*/
public float getScale();
/**
* @param scale Default: 1
* Sets the scale of the text plane.
* @param scale the scale factor to set. Default: 1
*/
public void setScale(float scale);
}
+11
View File
@@ -9,9 +9,20 @@ import net.minecraft.entity.projectile.EntityArrow;
*/
public interface IArrow<T extends EntityArrow> extends IEntity<T> {
/**
* Gets the entity that shot this arrow.
* @return the shooter entity, or null if none
*/
IEntity getShooter();
/**
* Gets the base damage of this arrow.
* @return the damage value
*/
double getDamage();
/**
* Removes this arrow from the world.
*/
void kill();
}
@@ -63,6 +63,7 @@ public interface IEnergyBarrier<T extends Entity> extends IEnergyAbility<T> {
/**
* Returns the barrier type: 0=Dome, 1=Panel
* @return the barrier type ordinal
*/
int getBarrierType();
+4 -1
View File
@@ -13,7 +13,10 @@ import net.minecraft.entity.Entity;
*/
public interface IEnergyBeam<T extends Entity> extends IEnergyProjectile<T> {
/** Width of the beam trail. */
/**
* Width of the beam trail.
* @return the beam width in blocks
*/
float getBeamWidth();
void setBeamWidth(float width);
+4 -1
View File
@@ -10,7 +10,10 @@ import net.minecraft.entity.Entity;
*/
public interface IEnergyDisc<T extends Entity> extends IEnergyProjectile<T> {
/** Radius of the disc. */
/**
* Radius of the disc.
* @return the disc radius in blocks
*/
float getDiscRadius();
void setDiscRadius(float radius);
@@ -7,7 +7,9 @@ import net.minecraft.entity.Entity;
*/
public interface IEnergyDome<T extends Entity> extends IEnergyBarrier<T> {
/** @return The radius of the dome in blocks. */
float getDomeRadius();
/** @param radius The radius of the dome in blocks. */
void setDomeRadius(float radius);
}
@@ -8,7 +8,7 @@ import noppes.npcs.api.INbt;
* Created via {@link noppes.npcs.api.IEnergyController#createExplosion}.
* Configure visual/damage properties, then call {@link #spawn()} to place in the world.
*
* When damage is set (> 0), the explosion will deal area damage on the first tick
* When damage is set (&gt; 0), the explosion will deal area damage on the first tick
* with distance-based falloff, routing through energy damage handlers for addon integration.
*/
public interface IEnergyExplosion<T extends Entity> extends IEnergyAbility<T> {
@@ -29,7 +29,7 @@ public interface IEnergyExplosion<T extends Entity> extends IEnergyAbility<T> {
/** @return Base damage dealt at the center. 0 means visual-only. */
float getDamage();
/** @param damage Base damage at the center. Setting > 0 enables damage. */
/** @param damage Base damage at the center. Setting &gt; 0 enables damage. */
void setDamage(float damage);
/** @return Base knockback strength. */
@@ -54,7 +54,7 @@ public interface IEnergyExplosion<T extends Entity> extends IEnergyAbility<T> {
/**
* Spawn this explosion entity into the world.
* Sends the visual to nearby clients and, if damage > 0, applies area damage on the first tick.
* Sends the visual to nearby clients and, if damage &gt; 0, applies area damage on the first tick.
*/
void spawn();
}
@@ -14,7 +14,10 @@ import net.minecraft.entity.Entity;
*/
public interface IEnergyLaser<T extends Entity> extends IEnergyProjectile<T> {
/** Width of the laser beam. */
/**
* Width of the laser beam.
* @return the laser width in blocks
*/
float getLaserWidth();
void setLaserWidth(float width);
@@ -21,6 +21,7 @@ public interface IEnergyPanel<T extends Entity> extends IEnergyBarrier<T> {
/**
* Panel mode: 0=PLACED, 1=HELD, 2=LAUNCHED
* @return the panel mode ordinal
*/
int getPanelMode();
@@ -23,7 +23,10 @@ public interface IEnergyProjectile<T extends Entity> extends IEnergyAbility<T> {
// ==================== OWNER & TARGET ====================
/** Sets the owner entity (used for homing return, damage attribution, etc.). */
/**
* Sets the owner entity (used for homing return, damage attribution, etc.).
* @param owner the entity that owns this projectile
*/
void setOwner(IEntity owner);
/** @return the entity ID of the current homing/tracking target, or -1 if none */
@@ -32,7 +35,10 @@ public interface IEnergyProjectile<T extends Entity> extends IEnergyAbility<T> {
/** @return the current homing/tracking target entity, or null if none */
IEntity getTarget();
/** Sets the homing/tracking target entity. Pass null to clear. */
/**
* Sets the homing/tracking target entity. Pass null to clear.
* @param target the entity to home towards
*/
void setTarget(IEntity target);
// ==================== SIZE ====================
@@ -40,7 +46,10 @@ public interface IEnergyProjectile<T extends Entity> extends IEnergyAbility<T> {
/** @return the projectile's visual and collision size */
float getSize();
/** Sets the projectile's visual and collision size. */
/**
* Sets the projectile's visual and collision size.
* @param size the projectile size
*/
void setSize(float size);
// ==================== DISPLAY (PROJECTILE-SPECIFIC) ====================
@@ -9,7 +9,10 @@ import net.minecraft.entity.Entity;
*/
public interface IEnergySlicer<T extends Entity> extends IEnergyProjectile<T> {
/** Width of the slicer blade. */
/**
* Width of the slicer blade.
* @return the width of each slice in blocks
*/
float getSliceWidth();
void setSliceWidth(float width);
@@ -11,35 +11,53 @@ public interface IEnergySweeper<T extends Entity> extends IEnergyAbility<T> {
// ==================== BEAM DIMENSIONS ====================
/** @return Length of the sweeping beam in blocks. */
float getBeamLength();
/** @param length Beam length in blocks. */
void setBeamLength(float length);
/** @return Width of the sweeping beam in blocks. */
float getBeamWidth();
/** @param width Beam width in blocks. */
void setBeamWidth(float width);
/** @return Height of the sweeping beam in blocks. */
float getBeamHeight();
/** @param height Beam height in blocks. */
void setBeamHeight(float height);
// ==================== ROTATION ====================
/** @return Rotation speed of the sweep in degrees per tick. */
float getSweepSpeed();
/** @param degreesPerTick Sweep rotation speed in degrees per tick. */
void setSweepSpeed(float degreesPerTick);
/** @return Number of full rotations the beam completes before stopping. */
int getNumberOfRotations();
/** @param rotations Number of full rotations. */
void setNumberOfRotations(int rotations);
/** @return Whether the beam pivot tracks the target instead of rotating freely. */
boolean isLockOnTarget();
/** @param lock Whether the beam locks on to the target. */
void setLockOnTarget(boolean lock);
// ==================== DAMAGE ====================
/** @return Damage dealt per hit to entities caught in the beam. */
float getDamage();
/** @param damage Damage per hit. */
void setDamage(float damage);
/** @return Interval in ticks between damage applications to the same target. */
int getDamageInterval();
/** @param ticks Damage interval in ticks. */
void setDamageInterval(int ticks);
/** @return Whether the beam can hit through multiple targets. */
boolean isPiercing();
/** @param piercing Whether the beam pierces through targets. */
void setPiercing(boolean piercing);
// ==================== SPAWNING ====================
+8 -2
View File
@@ -90,10 +90,16 @@ public interface IEnergyZone<T extends Entity> extends IEntity<T> {
// ==================== CUSTOM DAMAGE DATA ====================
/** Get custom damage data for addon handler routing (e.g. DBC damage stats). */
/**
* Get custom damage data for addon handler routing (e.g. DBC damage stats).
* @return the zone's damage configuration as NBT
*/
noppes.npcs.api.INbt getDamageData();
/** Set custom damage data for addon handler routing. */
/**
* Set custom damage data for addon handler routing.
* @param data the damage configuration NBT
*/
void setDamageData(noppes.npcs.api.INbt data);
// ==================== SPAWNING ====================
@@ -437,6 +437,11 @@ public interface IEntityLivingBase<T extends EntityLivingBase> extends IEntity<T
*/
float getAbsorptionAmount();
/**
* Sets the current hurt time (red flash duration) of the entity.
*
* @param time the hurt time in ticks.
*/
void setHurtTime(int time);
/**
@@ -9,7 +9,15 @@ import net.minecraft.entity.projectile.EntityFishHook;
*/
public interface IFishHook<T extends EntityFishHook> extends IEntity<T> {
/**
* Returns the player who cast this fish hook.
*
* @return the casting player, or null if none.
*/
IPlayer getCaster();
/**
* Removes this fish hook entity from the world.
*/
void kill();
}
+5
View File
@@ -684,6 +684,11 @@ public interface IPlayer<T extends EntityPlayerMP> extends IEntityLivingBase<T>,
IActionManager getActionManager();
/**
* Returns the members of the player's current party, excluding the player.
*
* @return an array of party members, or an empty array if the player is not in a party.
*/
IPlayer[] getPartyMembers();
// =========================================
@@ -9,7 +9,15 @@ import net.minecraft.entity.projectile.EntityThrowable;
*/
public interface IThrowable<T extends EntityThrowable> extends IEntity<T> {
/**
* Returns the entity that threw this throwable.
*
* @return the thrower, or null if unknown.
*/
IEntityLivingBase getThrower();
/**
* Removes this throwable entity from the world.
*/
void kill();
}
@@ -15,26 +15,31 @@ public interface IAbilityEvent extends INpcEvent {
/**
* Get the entity executing the ability (NPC or Player).
* @return the entity executing the ability
*/
IEntityLivingBase getEntity();
/**
* Get the player executing the ability, or null if the caster is an NPC.
* @return the player executing the ability, or null if NPC
*/
IPlayer getPlayer();
/**
* Whether the entity executing the ability is an NPC.
* @return true if the executor is an NPC
*/
boolean isNPC();
/**
* Get the ability involved in this event.
* @return the ability being executed
*/
IAbility getAbility();
/**
* Get the target of the ability, or null if no target.
* @return the current target entity
*/
IEntityLivingBase getTarget();
@@ -60,11 +65,13 @@ public interface IAbilityEvent extends INpcEvent {
interface InterruptEvent extends IAbilityEvent {
/**
* Get the damage source that caused the interruption.
* @return the damage source
*/
IDamageSource getDamageSource();
/**
* Get the amount of damage that caused the interruption.
* @return the final damage dealt
*/
float getDamage();
}
@@ -105,36 +112,43 @@ public interface IAbilityEvent extends INpcEvent {
interface HitEvent extends IAbilityEvent {
/**
* Get the entity that was hit by the ability.
* @return the entity that was hit
*/
IEntityLivingBase getHitEntity();
/**
* Get the damage amount.
* @return the damage amount
*/
float getDamage();
/**
* Set the damage amount. Allows scripts to modify damage.
* @param damage the new damage amount
*/
void setDamage(float damage);
/**
* Get the horizontal knockback amount.
* @return the knockback strength
*/
float getKnockback();
/**
* Set the horizontal knockback amount.
* @param knockback the new knockback strength
*/
void setKnockback(float knockback);
/**
* Get the vertical knockback (upward force) amount.
* @return the upward knockback component
*/
float getKnockbackUp();
/**
* Set the vertical knockback (upward force) amount.
* @param knockbackUp the new upward knockback component
*/
void setKnockbackUp(float knockbackUp);
}
@@ -147,11 +161,13 @@ public interface IAbilityEvent extends INpcEvent {
/**
* Get the current phase of the ability.
* 0 = IDLE, 1 = WINDUP, 2 = ACTIVE, 3 = DAZED, 4 = BURST_DELAY
* @return the current ability phase (0=IDLE, 1=WINDUP, 2=ACTIVE, 3=DAZED, 4=BURST_DELAY)
*/
int getAbilityPhase();
/**
* Get the current tick count within the phase.
* @return the current tick within the phase
*/
int getTick();
}
@@ -6,15 +6,22 @@ import noppes.npcs.api.handler.data.IAnimation;
import noppes.npcs.api.handler.data.IAnimationData;
import noppes.npcs.api.handler.data.IFrame;
/**
* Events fired during entity animation playback.
*/
public interface IAnimationEvent extends ICustomNPCsEvent {
/** @return the animation being played. */
IAnimation getAnimation();
/** @return the animation data managing the playback. */
IAnimationData getAnimationData();
/** @return the animatable entity playing the animation. */
IAnimatable getEntity();
/**
* Fired when an animation starts playing. Cancelable.
* @hookName animationStart
*/
@Cancelable
@@ -23,16 +30,20 @@ public interface IAnimationEvent extends ICustomNPCsEvent {
}
/**
* Fired when an animation finishes playing.
* @hookName animationEnd
*/
interface Ended extends IAnimationEvent {
}
/** Events fired when animation frames are entered or exited. */
interface IFrameEvent extends IAnimationEvent {
/** @return the frame index. */
int getIndex();
/** @return the frame data. */
IFrame getFrame();
/**
@@ -6,7 +6,11 @@ import noppes.npcs.api.IPos;
import noppes.npcs.api.entity.IEntity;
import noppes.npcs.api.entity.IPlayer;
/**
* Events fired for scripted blocks, including interactions, redstone, and entity collisions.
*/
public interface IBlockEvent extends ICustomNPCsEvent {
/** @return the scripted block associated with this event. */
IBlock getBlock();
/**
@@ -15,36 +15,43 @@ public interface IChainEvent extends ICustomNPCsEvent {
/**
* Get the entity executing the chain (NPC or Player).
* @return the entity executing the chain
*/
IEntityLivingBase getEntity();
/**
* Get the player executing the chain, or null if the caster is an NPC.
* @return the player executing the chain, or null if NPC
*/
IPlayer getPlayer();
/**
* Get the NPC executing the chain, or null if the caster is a player.
* @return the NPC executing the chain, or null if player
*/
ICustomNpc<?> getNpc();
/**
* Whether the entity executing the chain is an NPC.
* @return true if the executor is an NPC
*/
boolean isNPC();
/**
* Get the chained ability being executed.
* @return the chained ability being executed
*/
IChainedAbility getChain();
/**
* Get the target of the chain, or null if no target.
* @return the current target entity
*/
IEntityLivingBase getTarget();
/**
* Get the current entry index within the chain (0-based).
* @return the current entry index in the chain
*/
int getEntryIndex();
@@ -69,11 +76,13 @@ public interface IChainEvent extends ICustomNPCsEvent {
interface InterruptEvent extends IChainEvent {
/**
* Get the damage source that caused the interruption.
* @return the damage source used for this hit
*/
IDamageSource getDamageSource();
/**
* Get the amount of damage that caused the interruption.
* @return the damage amount
*/
float getDamage();
}
@@ -4,10 +4,15 @@ import cpw.mods.fml.common.eventhandler.Cancelable;
import noppes.npcs.api.gui.ICustomGui;
import noppes.npcs.api.item.IItemStack;
/**
* Events fired when a player interacts with a custom GUI.
*/
public interface ICustomGuiEvent extends IPlayerEvent {
/** @return the custom GUI associated with this event. */
ICustomGui getGui();
/** @return the component ID that triggered this event. */
int getId();
/**
@@ -5,8 +5,12 @@ import noppes.npcs.api.IPos;
import noppes.npcs.api.IWorld;
import noppes.npcs.api.handler.data.INaturalSpawn;
/**
* Base interface for all CustomNPC+ script events.
*/
public interface ICustomNPCsEvent {
/** @return the script hook name that triggered this event. */
String getHookName();
/**
@@ -3,23 +3,38 @@ package noppes.npcs.api.event;
import cpw.mods.fml.common.eventhandler.Cancelable;
import noppes.npcs.api.handler.data.IDialog;
/**
* Events fired during dialog interactions between a player and an NPC.
*/
public interface IDialogEvent extends IPlayerEvent {
/** @return the dialog associated with this event. */
IDialog getDialog();
/** @return the dialog's unique ID. */
int getDialogId();
/** @return the selected dialog option ID. */
int getOptionId();
/**
* Fired when a dialog is opened. Cancelable.
* @hookName dialogOpen
*/
@Cancelable
interface DialogOpen extends IDialogEvent {
}
/**
* Fired when a dialog option is selected. Cancelable.
* @hookName dialogOption
*/
@Cancelable
interface DialogOption extends IDialogEvent {
}
/**
* Fired when a dialog is closed.
* @hookName dialogClose
*/
interface DialogClosed extends IDialogEvent {
@@ -4,36 +4,48 @@ import noppes.npcs.api.entity.IEnergyBarrier;
import noppes.npcs.api.entity.IEnergyProjectile;
import noppes.npcs.api.entity.IEntity;
/**
* Events fired during energy barrier lifecycle and interactions.
*/
public interface IEnergyBarrierEvent extends ICustomNPCsEvent {
/** @return the energy barrier entity. */
IEnergyBarrier getBarrier();
/** @return the entity that owns this barrier. */
IEntity getOwner();
/**
* Fired when an energy barrier is spawned.
* @hookName energyBarrierSpawned
*/
interface SpawnedEvent extends IEnergyBarrierEvent {
}
/**
* Fired each tick while the barrier exists.
* @hookName energyBarrierTick
*/
interface UpdateEvent extends IEnergyBarrierEvent {
}
/**
* Fired when the barrier is hit by an energy projectile.
* @hookName energyBarrierHit
*/
interface HitEvent extends IEnergyBarrierEvent {
/** @return the projectile that hit the barrier. */
IEnergyProjectile getProjectile();
/** @return the damage dealt. */
float getDamage();
/** @param damage the new damage value. */
void setDamage(float damage);
}
/**
* Fired when the barrier is destroyed.
* @hookName energyBarrierDestroyed
*/
interface DestroyedEvent extends IEnergyBarrierEvent {
@@ -4,43 +4,57 @@ import noppes.npcs.api.IBlock;
import noppes.npcs.api.entity.IEnergyProjectile;
import noppes.npcs.api.entity.IEntity;
/**
* Events fired during energy projectile lifecycle and impacts.
*/
public interface IEnergyProjectileEvent extends ICustomNPCsEvent {
/** @return the energy projectile entity. */
IEnergyProjectile getProjectile();
/** @return the entity that fired this projectile. */
IEntity getOwner();
/**
* Fired when an energy projectile is launched.
* @hookName energyProjectileFired
*/
interface FiredEvent extends IEnergyProjectileEvent {
}
/**
* Fired each tick while the projectile exists.
* @hookName energyProjectileTick
*/
interface UpdateEvent extends IEnergyProjectileEvent {
}
/**
* Fired when the projectile hits an entity.
* @hookName energyProjectileEntityImpact
*/
interface EntityImpactEvent extends IEnergyProjectileEvent {
/** @return the entity that was hit. */
IEntity getTarget();
/** @return the damage dealt. */
float getDamage();
/** @param damage the new damage value. */
void setDamage(float damage);
}
/**
* Fired when the projectile hits a block.
* @hookName energyProjectileBlockImpact
*/
interface BlockImpactEvent extends IEnergyProjectileEvent {
/** @return the block that was hit. */
IBlock getBlock();
}
/**
* Fired when the projectile expires without hitting anything.
* @hookName energyProjectileExpired
*/
interface ExpiredEvent extends IEnergyProjectileEvent {
@@ -3,14 +3,24 @@ package noppes.npcs.api.event;
import cpw.mods.fml.common.eventhandler.Cancelable;
import noppes.npcs.api.handler.data.IFaction;
/**
* Events fired when a player's faction standing changes.
*/
public interface IFactionEvent extends IPlayerEvent {
/** @return the faction involved in this event. */
IFaction getFaction();
/**
* Fired when a player's faction points change. Cancelable.
* @hookName factionPoints
*/
@Cancelable
interface FactionPoints extends IFactionEvent {
/** @return true if the points decreased, false if increased. */
boolean decreased();
/** @return the amount of points changed. */
int getPoints();
}
}
@@ -4,25 +4,34 @@ import cpw.mods.fml.common.eventhandler.Event;
import noppes.npcs.api.IWorld;
import noppes.npcs.api.entity.IEntity;
/**
* Wrapper events for Forge events, allowing scripts to listen for native Forge events.
*/
public interface IForgeEvent extends ICustomNPCsEvent {
/** @return the underlying Forge event. */
Event getEvent();
/**
* Fired for Forge world events.
* @hookName forgeWorld
*/
interface WorldEvent extends IForgeEvent {
/** @return the world associated with this event. */
IWorld getWorld();
}
/**
* Fired for Forge entity events.
* @hookName forgeEntity
*/
interface EntityEvent extends IForgeEvent {
/** @return the entity associated with this event. */
IEntity getEntity();
}
/**
* Fired during Forge initialization.
* @hookName forgeInit
*/
interface InitEvent extends IForgeEvent {
+82 -10
View File
@@ -6,113 +6,185 @@ import noppes.npcs.api.entity.IPlayer;
import noppes.npcs.api.item.IItemCustomizable;
import noppes.npcs.api.item.IItemStack;
/**
* Events fired for scripted/customizable items during their lifecycle and interactions.
*/
public interface IItemEvent extends ICustomNPCsEvent {
/** @return the customizable item associated with this event. */
IItemCustomizable getItem();
/**
* Fired when the item is initialized.
* @hookName init
*/
interface InitEvent extends IItemEvent {
}
/**
* Fired each tick while the item exists in an entity's inventory.
* @hookName tick
*/
interface UpdateEvent extends IItemEvent {
/** @return the entity holding the item. */
IEntity getEntity();
}
/**
* Fired when the item is tossed/dropped. Cancelable.
* @hookName tossed
*/
@Cancelable
interface TossedEvent extends IItemEvent {
/** @return the dropped item entity. */
IEntity getEntity();
/** @return the player who dropped the item. */
IPlayer getPlayer();
}
/**
* Fired when the item is picked up.
* @hookName pickedUp
*/
interface PickedUpEvent extends IItemEvent {
/** @return the player who picked up the item. */
IPlayer getPlayer();
}
/**
* Fired when the item entity spawns in the world. Cancelable.
* @hookName spawn
*/
@Cancelable
interface SpawnEvent extends IItemEvent {
/** @return the spawned item entity. */
IEntity getEntity();
}
/**
* Fired when the item is used to interact with an entity. Cancelable.
* @hookName interact
*/
@Cancelable
interface InteractEvent extends IItemEvent {
/** @return the interaction type. */
int getType();
/** @return the target entity. */
IEntity getTarget();
/** @return the player performing the interaction. */
IPlayer getPlayer();
}
/**
* Fired when the item is right-clicked. Cancelable.
* @hookName rightClick
*/
@Cancelable
interface RightClickEvent extends IItemEvent {
/** @return the click type. */
int getType();
/** @return the target (entity or block). */
Object getTarget();
/** @return the player who right-clicked. */
IPlayer getPlayer();
}
/**
* Fired when the item is used to attack an entity. Cancelable.
* @hookName attack
*/
@Cancelable
interface AttackEvent extends IItemEvent {
/** @return the attack type. */
int getType();
/** @return the entity being attacked. */
IEntity getTarget();
/** @return the entity swinging the item. */
IEntity getSwingingEntity();
}
/**
* Fired when the player starts using the item (e.g., drawing a bow).
* @hookName startItem
*/
interface StartUsingItem extends IItemEvent {
/** @return the player using the item. */
IPlayer getPlayer();
int getDuration();
}
interface UsingItem extends IItemEvent {
IPlayer getPlayer();
/** @return the use duration in ticks. */
int getDuration();
}
/**
* Fired each tick while the player is using the item.
* @hookName usingItem
*/
interface UsingItem extends IItemEvent {
/** @return the player using the item. */
IPlayer getPlayer();
/** @return the remaining use duration in ticks. */
int getDuration();
}
/**
* Fired when the player stops using the item before completion.
* @hookName stopItem
*/
interface StopUsingItem extends IItemEvent {
/** @return the player who stopped using the item. */
IPlayer getPlayer();
/** @return the remaining use duration in ticks. */
int getDuration();
}
/**
* Fired when the player finishes using the item (full duration).
* @hookName finishItem
*/
interface FinishUsingItem extends IItemEvent {
/** @return the player who finished using the item. */
IPlayer getPlayer();
/** @return the total use duration in ticks. */
int getDuration();
}
// onBreakEvent if Durability Expires or Consumed
/**
* Fired when the item breaks due to durability loss or consumption.
* @hookName breakItem
*/
interface BreakItem extends IItemEvent {
/** @return the item stack that broke. */
IItemStack getBrokenStack();
/** @return the player whose item broke. */
IPlayer getPlayer();
}
// onRepairEvent
/**
* Fired when the item is repaired on an anvil.
* @hookName repairItem
*/
interface RepairItem extends IItemEvent {
/** @return the left input item. */
IItemStack getLeft();
/** @return the right input item (repair material). */
IItemStack getRight();
/** @return the resulting output item. */
IItemStack getOutput();
/** @return the chance the anvil breaks after this repair. */
float getAnvilBreakChance();
}
}
@@ -1,18 +1,24 @@
package noppes.npcs.api.event;
/**
* Events fired for linked items when their version changes or when they are being built.
*/
public interface ILinkedItemEvent extends IItemEvent {
/**
* Fired when the linked item's version changes.
* @hookName versionChanged
*/
interface VersionChangeEvent extends IItemEvent {
/** @return the new version number. */
int getVersion();
/** @return the previous version number. */
int getPreviousVersion();
}
/**
* Fired when the linked item is being built/constructed.
* @hookName buildingItem
*/
interface BuildEvent extends IItemEvent {
+97 -10
View File
@@ -9,55 +9,94 @@ import noppes.npcs.api.entity.IPlayer;
import noppes.npcs.api.handler.data.IDialog;
import noppes.npcs.api.item.IItemStack;
/**
* Events fired for CustomNPC entities during their lifecycle and interactions.
*/
public interface INpcEvent extends ICustomNPCsEvent {
/** @return the NPC associated with this event. */
ICustomNpc getNpc();
/**
* Fired when an NPC timer triggers.
* @hookName timer
*/
interface TimerEvent extends INpcEvent {
/** @return the timer ID. */
int getId();
}
/**
* Fired when an entity collides with the NPC.
* @hookName collide
*/
interface CollideEvent extends INpcEvent {
/** @return the colliding entity. */
IEntity getEntity();
}
/**
* Fired when the NPC takes damage. Cancelable.
* @hookName damaged
*/
@Cancelable
interface DamagedEvent extends INpcEvent {
/** @return the entity that caused the damage, or null. */
IEntity getSource();
/** @return the damage source details. */
IDamageSource getDamageSource();
/** @return the damage amount. */
float getDamage();
/** @param damage the new damage amount. */
void setDamage(float damage);
/** @param bo whether to clear the NPC's current target after damage. */
void setClearTarget(boolean bo);
/** @return whether the NPC's target will be cleared after damage. */
boolean getClearTarget();
/** @return the damage type string. */
String getType();
}
/**
* Fired when the NPC launches a ranged attack. Cancelable.
* @hookName rangedLaunched
*/
@Cancelable
interface RangedLaunchedEvent extends INpcEvent {
/** @return the target entity. */
IEntityLivingBase getTarget();
/** @param damage the new ranged damage. */
void setDamage(float damage);
float getDamage();
}
@Cancelable
interface MeleeAttackEvent extends INpcEvent {
IEntityLivingBase getTarget();
void setDamage(float damage);
/** @return the ranged damage. */
float getDamage();
}
/**
* Fired when the NPC performs a melee attack. Cancelable.
* @hookName meleeAttack
*/
@Cancelable
interface MeleeAttackEvent extends INpcEvent {
/** @return the target entity. */
IEntityLivingBase getTarget();
/** @param damage the new melee damage. */
void setDamage(float damage);
/** @return the melee damage. */
float getDamage();
}
/**
* Fired when the NPC swings its weapon.
* @hookName meleeSwing
*/
interface SwingEvent extends INpcEvent {
@@ -71,78 +110,126 @@ public interface INpcEvent extends ICustomNPCsEvent {
}
/**
* Fired when the NPC kills an entity.
* @hookName kills
*/
interface KilledEntityEvent {
/** @return the entity that was killed. */
IEntityLivingBase getEntity();
}
/**
* Fired when the NPC dies. Cancelable.
* @hookName killed
*/
@Cancelable
interface DiedEvent extends INpcEvent {
/** @return the entity that killed this NPC, or null. */
IEntity getSource();
/** @return the damage source details. */
IDamageSource getDamageSource();
/** @return the damage type string. */
String getType();
/** @param droppedItems the items to drop on death. */
void setDroppedItems(IItemStack[] droppedItems);
/** @return the items dropped on death. */
IItemStack[] getDroppedItems();
/** @param expDropped the experience to drop on death. */
void setExpDropped(int expDropped);
/** @return the experience dropped on death. */
int getExpDropped();
}
/**
* Fired when a player interacts with the NPC. Cancelable.
* @hookName interact
*/
@Cancelable
interface InteractEvent extends INpcEvent {
/** @return the interacting player. */
IPlayer getPlayer();
}
/**
* Fired when a dialog opens with the NPC. Cancelable.
* @hookName dialog
*/
@Cancelable
interface DialogEvent extends INpcEvent {
/** @return the interacting player. */
IPlayer getPlayer();
/** @return the dialog. */
IDialog getDialog();
/** @return the dialog ID. */
int getDialogId();
/** @return the selected option ID. */
int getOptionId();
}
/**
* Fired when a dialog with the NPC is closed.
* @hookName dialogClosed
*/
interface DialogClosedEvent extends INpcEvent {
/** @return the player who closed the dialog. */
IPlayer getPlayer();
/** @return the dialog. */
IDialog getDialog();
/** @return the dialog ID. */
int getDialogId();
/** @return the selected option ID. */
int getOptionId();
}
/**
* Fired when the NPC loses its current target. Cancelable.
* @hookName targetLost
*/
@Cancelable
interface TargetLostEvent extends INpcEvent {
/** @return the target being lost. */
IEntityLivingBase getTarget();
/** @return the new target, or null. */
IEntityLivingBase getNewTarget();
}
/**
* Fired when the NPC acquires a new target. Cancelable.
* @hookName target
*/
@Cancelable
interface TargetEvent extends INpcEvent {
/** @param entity the new target to set. */
void setTarget(IEntityLivingBase entity);
/** @return the current target. */
IEntityLivingBase getTarget();
}
/**
* Fired each tick for the NPC.
* @hookName tick
*/
interface UpdateEvent extends INpcEvent {
}
/**
* Fired when the NPC is initialized.
* @hookName init
*/
interface InitEvent extends INpcEvent {
}
}
+39 -2
View File
@@ -5,45 +5,82 @@ import noppes.npcs.api.entity.IPlayer;
import noppes.npcs.api.handler.data.IParty;
import noppes.npcs.api.handler.data.IQuest;
/**
* Events fired during party operations such as quest progress, invitations, kicks, and disbanding.
*/
public interface IPartyEvent {
/** @return the party involved in this event. */
IParty getParty();
/** @return the quest associated with this party event. */
IQuest getQuest();
/**
* Fired when a party quest is completed.
* @hookName partyQuestCompleted
*/
interface PartyQuestCompletedEvent extends IPartyEvent {
}
/**
* Fired when a quest is assigned to the party. Cancelable.
* @hookName partyQuestSet
*/
@Cancelable
interface PartyQuestSetEvent extends IPartyEvent {
}
/**
* Fired when a party quest is turned in. Cancelable.
* @hookName partyQuestTurnedIn
*/
@Cancelable
interface PartyQuestTurnedInEvent extends IPartyEvent {
}
/**
* Fired when a player is invited to the party. Cancelable.
* @hookName partyInvite
*/
@Cancelable
interface PartyInviteEvent extends IPartyEvent {
/** @return the invited player. */
IPlayer getPlayer();
/** @return the invited player's name. */
String getPlayerName();
}
/**
* Fired when a player is kicked from the party. Cancelable.
* @hookName partyKick
*/
@Cancelable
interface PartyKickEvent extends IPartyEvent {
/** @return the kicked player. */
IPlayer getPlayer();
/** @return the kicked player's name. */
String getPlayerName();
}
/**
* Fired when a player voluntarily leaves the party.
* @hookName partyLeave
*/
interface PartyLeaveEvent extends IPartyEvent {
/** @return the leaving player. */
IPlayer getPlayer();
/** @return the leaving player's name. */
String getPlayerName();
}
/**
* Fired when the party is disbanded.
* @hookName partyDisband
*/
interface PartyDisbandEvent extends IPartyEvent {
}
}
+245 -6
View File
@@ -11,307 +11,537 @@ import noppes.npcs.api.handler.data.IPlayerEffect;
import noppes.npcs.api.handler.data.IProfile;
import noppes.npcs.api.item.IItemStack;
/**
* Events fired for player actions including combat, items, movement, and interactions.
*/
public interface IPlayerEvent extends ICustomNPCsEvent {
/** @return the player associated with this event. */
IPlayer getPlayer();
/**
* Fired when the player sends a chat message. Cancelable.
* @hookName chat
*/
@Cancelable
interface ChatEvent extends IPlayerEvent {
/** @param message the new chat message. */
void setMessage(String message);
/** @return the chat message. */
String getMessage();
}
/**
* Fired when the player presses or releases a key.
* @hookName keyPressed
*/
interface KeyPressedEvent extends IPlayerEvent {
/** @return the key code. */
int getKey();
/** @return true if Ctrl is held. */
boolean isCtrlPressed();
/** @return true if Alt is held. */
boolean isAltPressed();
/** @return true if Shift is held. */
boolean isShiftPressed();
/** @return true if Meta is held. */
boolean isMetaPressed();
/** @return true if the key is being pressed down, false if released. */
boolean keyDown();
/** @return array of currently held key codes. */
int[] getKeysDown();
}
/**
* Fired when the player clicks a mouse button.
* @hookName mouseClicked
*/
interface MouseClickedEvent extends IPlayerEvent {
/** @return the mouse button index. */
int getButton();
/** @return the mouse wheel scroll delta. */
int getMouseWheel();
/** @return true if the button is being pressed down. */
boolean buttonDown();
/** @return true if Ctrl is held. */
boolean isCtrlPressed();
/** @return true if Alt is held. */
boolean isAltPressed();
/** @return true if Shift is held. */
boolean isShiftPressed();
/** @return true if Meta is held. */
boolean isMetaPressed();
/** @return array of currently held key codes. */
int[] getKeysDown();
}
/**
* Fired when the player picks up experience orbs.
* @hookName pickupXP
*/
interface PickupXPEvent extends IPlayerEvent {
/** @return the amount of XP picked up. */
int getAmount();
}
/**
* Fired when the player levels up.
* @hookName levelUp
*/
interface LevelUpEvent extends IPlayerEvent {
/** @return the number of levels gained. */
int getChange();
}
/**
* Fired when the player logs out.
* @hookName logout
*/
interface LogoutEvent extends IPlayerEvent {
}
/**
* Fired when the player logs in.
* @hookName login
*/
interface LoginEvent extends IPlayerEvent {
}
/**
* Fired when the player respawns after death.
* @hookName respawn
*/
interface RespawnEvent extends IPlayerEvent {
}
/**
* Fired when the player changes dimensions.
* @hookName changedDim
*/
interface ChangedDimension extends IPlayerEvent {
/** @return the dimension ID the player came from. */
int getFromDim();
/** @return the dimension ID the player traveled to. */
int getToDim();
}
/**
* Fired when a player timer triggers.
* @hookName timer
*/
interface TimerEvent extends IPlayerEvent {
/** @return the timer ID. */
int getId();
}
/**
* Fired when the player is attacked (before armor reduction). Cancelable.
* @hookName attacked
*/
@Cancelable
interface AttackedEvent extends IPlayerEvent {
/** @return the damage source details. */
IDamageSource getDamageSource();
/** @return the attacking entity, or null. */
IEntity getSource();
/** @return the raw damage amount. */
float getDamage();
}
/**
* Fired when the player takes damage (after armor reduction). Cancelable.
* @hookName damaged
*/
@Cancelable
interface DamagedEvent extends IPlayerEvent {
/** @return the damage source details. */
IDamageSource getDamageSource();
/** @return the damaging entity, or null. */
IEntity getSource();
/** @return the damage amount after reduction. */
float getDamage();
}
/**
* Fired when the player is about to be struck by lightning. Cancelable.
* @hookName lightning
*/
@Cancelable
interface LightningEvent extends IPlayerEvent {
}
/**
* Fired when a sound is played for the player. Cancelable.
* @hookName playSound
*/
@Cancelable
interface SoundEvent extends IPlayerEvent {
/** @return the sound resource name. */
String getName();
/** @return the sound pitch. */
float getPitch();
/** @return the sound volume. */
float getVolume();
}
/**
* Fired when the player falls. Cancelable.
* @hookName fall
*/
@Cancelable
interface FallEvent extends IPlayerEvent {
/** @return the fall distance in blocks. */
float getDistance();
}
/**
* Fired when the player jumps.
* @hookName jump
*/
interface JumpEvent extends IPlayerEvent {
}
/**
* Fired when the player kills an entity.
* @hookName kills
*/
interface KilledEntityEvent extends IPlayerEvent {
/** @return the killed entity. */
IEntityLivingBase getEntity();
}
/**
* Fired when the player dies.
* @hookName killed
*/
interface DiedEvent extends IPlayerEvent {
/** @return the damage source that killed the player. */
IDamageSource getDamageSource();
/** @return the damage type string. */
String getType();
/** @return the entity that killed the player, or null. */
IEntity getSource();
}
/**
* Fired when the player launches a ranged weapon (e.g., bow). Cancelable.
* @hookName rangedLaunched
*/
@Cancelable
interface RangedLaunchedEvent extends IPlayerEvent {
/** @return the bow item. */
IItemStack getBow();
/** @return the charge level of the bow. */
int getCharge();
}
/**
* Fired when the player attacks an entity. Cancelable.
* @hookName attack
*/
@Cancelable
interface AttackEvent extends IPlayerEvent {
/** @return the damage source details. */
IDamageSource getDamageSource();
/** @return the target entity. */
IEntity getTarget();
/** @return the attack damage. */
float getDamage();
}
/**
* Fired when the player deals damage to an entity (after hit). Cancelable.
* @hookName damagedEntity
*/
@Cancelable
interface DamagedEntityEvent extends IPlayerEvent {
/** @return the damage source details. */
IDamageSource getDamageSource();
/** @return the damaged entity. */
IEntity getTarget();
/** @return the damage dealt. */
float getDamage();
}
/**
* Fired when the player closes a container.
* @hookName containerClosed
*/
interface ContainerClosed extends IPlayerEvent {
/** @return the closed container. */
IContainer getContainer();
}
/**
* Fired when the player opens a container.
* @hookName containerOpen
*/
interface ContainerOpen extends IPlayerEvent {
/** @return the opened container. */
IContainer getContainer();
}
/**
* Fired when the player picks up an item. Cancelable.
* @hookName pickUp
*/
@Cancelable
interface PickUpEvent extends IPlayerEvent {
/** @return the picked up item. */
IItemStack getItem();
}
/**
* Fired when items are dropped from the player's inventory (e.g., on death). Cancelable.
* @hookName drop
*/
@Cancelable
interface DropEvent extends IPlayerEvent {
/** @return the dropped items. */
IItemStack[] getItems();
}
/**
* Fired when the player tosses a single item. Cancelable.
* @hookName toss
*/
@Cancelable
interface TossEvent extends IPlayerEvent {
/** @return the tossed item. */
IItemStack getItem();
}
/**
* Fired when the player interacts with an entity. Cancelable.
* @hookName interact
*/
@Cancelable
interface InteractEvent extends IPlayerEvent {
/** @return the interaction type. */
int getType();
/** @return the target entity. */
IEntity getTarget();
}
/**
* Fired when the player right-clicks. Cancelable.
* @hookName rightClick
*/
@Cancelable
interface RightClickEvent extends IPlayerEvent {
/** @return the click type. */
int getType();
/** @return the target (entity, block, or null). */
Object getTarget();
/** @return the player. */
IPlayer getPlayer();
}
/**
* Fired each tick for the player.
* @hookName tick
*/
interface UpdateEvent extends IPlayerEvent {
}
/**
* Fired when the player script is initialized.
* @hookName init
*/
interface InitEvent extends IPlayerEvent {
}
/**
* Fired when the player starts using an item (e.g., drawing a bow).
* @hookName startItem
*/
interface StartUsingItem extends IPlayerEvent {
/** @return the item being used. */
IItemStack getItem();
int getDuration();
}
interface UsingItem extends IPlayerEvent {
IItemStack getItem();
/** @return the use duration in ticks. */
int getDuration();
}
/**
* Fired each tick while the player is using an item.
* @hookName usingItem
*/
interface UsingItem extends IPlayerEvent {
/** @return the item being used. */
IItemStack getItem();
/** @return the remaining use duration in ticks. */
int getDuration();
}
/**
* Fired when the player stops using an item before completion.
* @hookName stopItem
*/
interface StopUsingItem extends IPlayerEvent {
/** @return the item that was being used. */
IItemStack getItem();
/** @return the remaining use duration in ticks. */
int getDuration();
}
/**
* Fired when the player finishes using an item (full duration).
* @hookName finishItem
*/
interface FinishUsingItem extends IPlayerEvent {
/** @return the item that was used. */
IItemStack getItem();
/** @return the total use duration in ticks. */
int getDuration();
}
/**
* Fired when the player breaks a block. Cancelable.
* @hookName breakBlock
*/
@Cancelable
interface BreakEvent extends IPlayerEvent {
/** @return the block being broken. */
IBlock getBlock();
/** @return the experience dropped from breaking the block. */
int getExp();
}
/**
* Fired when the player uses a hoe on a block.
* @hookName useHoe
*/
interface UseHoeEvent extends IPlayerEvent {
/** @return the hoe item. */
IItemStack getHoe();
/** @return the X coordinate of the hoed block. */
int getX();
/** @return the Y coordinate of the hoed block. */
int getY();
/** @return the Z coordinate of the hoed block. */
int getZ();
}
/**
* Fired when the player wakes up from a bed.
* @hookName wakeUp
*/
interface WakeUpEvent extends IPlayerEvent {
/** @return true if the bed position was set as spawn. */
boolean setSpawn();
}
/**
* Fired when the player sleeps in a bed.
* @hookName sleep
*/
interface SleepEvent extends IPlayerEvent {
/** @return the X coordinate of the bed. */
int getX();
/** @return the Y coordinate of the bed. */
int getY();
/** @return the Z coordinate of the bed. */
int getZ();
}
/**
* Fired when the player earns an achievement.
* @hookName achievement
*/
interface AchievementEvent extends IPlayerEvent {
/** @return the achievement description. */
String getDescription();
}
/**
* Fired when the player fills a bucket.
* @hookName fillBucket
*/
interface FillBucketEvent extends IPlayerEvent {
/** @return the empty bucket item. */
IItemStack getCurrent();
/** @return the filled bucket item. */
IItemStack getFilled();
}
/**
* Fired when the player uses bonemeal on a block.
* @hookName bonemeal
*/
interface BonemealEvent extends IPlayerEvent {
/** @return the block that was bonemealed. */
IBlock getBlock();
/** @return the X coordinate. */
int getX();
/** @return the Y coordinate. */
int getY();
/** @return the Z coordinate. */
int getZ();
}
/**
* Fired when the player begins charging a ranged weapon.
* @hookName rangedCharge
*/
interface RangedChargeEvent extends IPlayerEvent {
}
/**
* Events fired for player custom effects (add, tick, remove).
* @hookName onEffect
*/
interface EffectEvent extends IPlayerEvent {
/** @return the player effect. */
IPlayerEffect getEffect();
/**
* Fired when an effect is added to the player.
* @hookName onEffectAdd
*/
interface Added extends EffectEvent {
@@ -319,6 +549,7 @@ public interface IPlayerEvent extends ICustomNPCsEvent {
}
/**
* Fired each tick while the effect is active.
* @hookName onEffectTick
*/
interface Ticked extends EffectEvent {
@@ -326,6 +557,7 @@ public interface IPlayerEvent extends ICustomNPCsEvent {
}
/**
* Fired when an effect is removed from the player.
* @hookName onEffectRemove
*/
interface Removed extends EffectEvent {
@@ -343,6 +575,10 @@ public interface IPlayerEvent extends ICustomNPCsEvent {
}
/**
* Events fired for profile operations (create, change, remove). Cancelable.
* @hookName profile
*/
@Cancelable
interface ProfileEvent extends IPlayerEvent {
@@ -362,6 +598,7 @@ public interface IPlayerEvent extends ICustomNPCsEvent {
boolean isPost();
/**
* Fired when the player switches profile slots. Cancelable.
* @hookName profileChange
*/
@Cancelable
@@ -373,6 +610,7 @@ public interface IPlayerEvent extends ICustomNPCsEvent {
}
/**
* Fired when a new profile is created. Cancelable.
* @hookName profileCreate
*/
@Cancelable
@@ -380,6 +618,7 @@ public interface IPlayerEvent extends ICustomNPCsEvent {
}
/**
* Fired when a profile is removed. Cancelable.
* @hookName profileRemove
*/
@Cancelable
@@ -4,26 +4,36 @@ import noppes.npcs.api.IBlock;
import noppes.npcs.api.entity.IEntity;
import noppes.npcs.api.entity.IProjectile;
/**
* Events fired during NPC projectile lifecycle and impacts.
*/
public interface IProjectileEvent extends ICustomNPCsEvent {
/** @return the projectile entity. */
public IProjectile getProjectile();
/** @return the entity that launched this projectile. */
public IEntity getSource();
/**
* Fired each tick while the projectile exists.
* @hookName projectileTick
*/
interface UpdateEvent extends IProjectileEvent {
}
/**
* Fired when the projectile hits something.
* @hookName projectileImpact
*/
interface ImpactEvent extends IProjectileEvent {
/** @return the impact type. */
public int getType();
/** @return the entity hit, or null if a block was hit. */
public IEntity getEntity();
/** @return the block hit, or null if an entity was hit. */
public IBlock getBlock();
}
@@ -4,28 +4,45 @@ import cpw.mods.fml.common.eventhandler.Cancelable;
import noppes.npcs.api.handler.data.IQuest;
import noppes.npcs.api.item.IItemStack;
/**
* Events fired during quest lifecycle: starting, completing, and turning in.
*/
public interface IQuestEvent extends IPlayerEvent {
/** @return the quest associated with this event. */
IQuest getQuest();
/**
* Fired when a quest's objectives are all completed.
* @hookName questCompleted
*/
interface QuestCompletedEvent extends IQuestEvent {
}
/**
* Fired when a quest is started/accepted. Cancelable.
* @hookName questStart
*/
@Cancelable
interface QuestStartEvent extends IQuestEvent {
}
/**
* Fired when a completed quest is turned in. Cancelable.
* @hookName questTurnIn
*/
@Cancelable
interface QuestTurnedInEvent extends IQuestEvent {
/** @param expReward the experience reward to give. */
void setExpReward(int expReward);
/** @param itemRewards the item rewards to give. */
void setItemRewards(IItemStack[] itemRewards);
/** @return the experience reward. */
int getExpReward();
/** @return the item rewards. */
IItemStack[] getItemRewards();
}
}
@@ -3,6 +3,9 @@ package noppes.npcs.api.event;
import cpw.mods.fml.common.eventhandler.Cancelable;
import noppes.npcs.api.item.IItemStack;
/**
* Events fired before and after recipe crafting, for both crafting table and anvil recipes.
*/
public interface IRecipeEvent extends IPlayerEvent {
/**
@@ -13,14 +16,22 @@ public interface IRecipeEvent extends IPlayerEvent {
*/
Object getRecipe();
/** @return the input item stacks used in the recipe. */
IItemStack[] getItems();
/** @return true if this is an anvil recipe, false for crafting table. */
boolean isAnvil();
/**
* Fired before a recipe is crafted. Cancelable.
* @hookName recipeCraftPre
*/
@Cancelable
interface Pre extends IRecipeEvent {
/** @param message the denial message shown when canceled. */
void setMessage(String message);
/** @return the denial message. */
String getMessage();
/**
@@ -52,9 +63,15 @@ public interface IRecipeEvent extends IPlayerEvent {
void setMaterialUsage(int materialUsage);
}
/**
* Fired after a recipe is crafted.
* @hookName recipeCraftPost
*/
interface Post extends IRecipeEvent {
/** @return the crafted item. */
IItemStack getCraft();
/** @param stack the item to set as the crafting result. */
void setResult(IItemStack stack);
}
}
+7
View File
@@ -231,12 +231,19 @@ public interface ICustomGui {
IItemSlot addItemSlot(int id, int x, int y, IItemStack itemStack);
/**
* @param x the X position in the GUI
* @param y the Y position in the GUI
* @return the created item slot
* @deprecated Use addItemSlot(int, int, IItemStack) with an ID instead.
*/
@Deprecated
IItemSlot addItemSlot(int x, int y);
/**
* @param x the X position in the GUI
* @param y the Y position in the GUI
* @param itemStack the item to display in the slot
* @return the created item slot
* @deprecated Use addItemSlot(int, int, IItemStack) with an ID instead.
*/
@Deprecated
@@ -12,54 +12,76 @@ public interface IAbilityHandler {
/**
* Get all registered ability type IDs.
*
* @return array of all registered ability type IDs
*/
String[] getTypes();
/**
* Check if an ability type is registered.
*
* @param typeId the ability type ID to check
* @return true if the type is registered
*/
boolean hasType(String typeId);
/**
* Get all built-in ability names.
*
* @return array of all registered ability names (built-in and custom)
*/
String[] getAbilityNameArray();
/**
* Check if a built-in ability exists by name.
*
* @param name the ability name to check
* @return true if an ability with this name exists
*/
boolean hasAbilityName(String name);
/**
* Get all custom ability preset names.
*
* @return array of all custom (user-created) ability names
*/
String[] getCustomAbilityNameArray();
/**
* Check if a custom ability preset exists by name.
*
* @param name the custom ability name to check
* @return true if a custom ability with this name exists
*/
boolean hasCustomAbilityName(String name);
/**
* Delete a custom ability preset by name.
*
* @param name the custom ability name to delete
* @return true if deleted successfully
*/
boolean deleteCustomAbilityByName(String name);
/**
* Get all chained ability names.
*
* @return array of all chained ability names
*/
String[] getChainedAbilityNames();
/**
* Check if a chained ability exists by name.
*
* @param name the chained ability name to check
* @return true if a chained ability with this name exists
*/
boolean hasChainedAbilityName(String name);
/**
* Delete a chained ability by name.
*
* @param name the chained ability name to delete
* @return true if deleted successfully
*/
boolean deleteChainedAbilityByName(String name);
@@ -67,6 +89,7 @@ public interface IAbilityHandler {
/**
* Get a chained ability by name.
*
* @param name the chained ability name
* @return the chained ability, or null if not found
*/
IChainedAbility getChainedAbility(String name);
@@ -74,6 +97,7 @@ public interface IAbilityHandler {
/**
* Save a chained ability. If a chain with the same name exists, it is overwritten.
*
* @param chain the chained ability to save
* @return true if saved successfully
*/
boolean saveChainedAbility(IChainedAbility chain);
@@ -18,12 +18,16 @@ public interface IActionManager {
/**
* Begin processing scheduled actions. Must be called once.
*
* @return this action manager
*/
IActionManager start();
/**
* Halt processing of actions. Queued actions remain but will not run until
* {@link #start()} is called again.
*
* @return this action manager
*/
IActionManager stop();
@@ -59,8 +63,8 @@ public interface IActionManager {
/**
* Enabling prints to the console the life cycle of IActionManager, it's IActionQueues and the scheduled IActions
*
* @param debug
* @return
* @param debug whether to enable debug logging
* @return this action manager
*/
IActionManager setDebugMode(boolean debug);
@@ -148,7 +152,7 @@ public interface IActionManager {
boolean hasQueue(String name);
/**
* @param name
* @param name the name for the new action
* @return True if queue successfully removed from IActionManager and cleared
*/
boolean removeQueue(String name);
@@ -176,7 +180,7 @@ public interface IActionManager {
* Multiple actions chained one after another
* i.e schedule(act1,act2,act3,...)
*
* @param actions
* @param actions the actions to schedule
*/
void schedule(IAction... actions);
@@ -192,7 +196,7 @@ public interface IActionManager {
* Multiple tasks chained one after another
* i.e schedule(task1,task2,task3,...)
*
* @param tasks
* @param tasks the task consumers to schedule
*/
void schedule(Consumer<IAction>... tasks);
@@ -261,7 +265,7 @@ public interface IActionManager {
* Multiple conditionals
* i.e schedule(act1,act2,act3,...)
*
* @param actions
* @param actions the conditional actions to schedule
*/
void schedule(IConditionalAction... actions);
@@ -340,8 +344,8 @@ public interface IActionManager {
/**
* Schedules actions on the parallelQueue, where all actions are executed simultaneously
*
* @param action
* @return
* @param action the action to add to the parallel chain
* @return the parallel action
*/
IAction scheduleParallel(IAction action);
@@ -350,7 +354,7 @@ public interface IActionManager {
* Multiple actions in parallel
* i.e scheduleParallel(act1,act2,act3,...)
*
* @param actions
* @param actions the actions to run in parallel
*/
void scheduleParallel(IAction... actions);
@@ -380,7 +384,7 @@ public interface IActionManager {
boolean hasAny(String name);
/**
* @param name
* @param name the name for the new parallel action
* @return Checks through all available queues and fetches the first IAction with given name
*/
IAction getAny(String name);
@@ -20,11 +20,15 @@ public interface IAnimationHandler {
/**
* Get all built-in animations.
* Built-in animations are read-only and cannot be modified or deleted.
*
* @return array of all built-in animations
*/
IAnimation[] getBuiltInAnimations();
/**
* Get all animations (both built-in and user-created).
*
* @return array of all animations (built-in and custom)
*/
IAnimation[] getAllAnimations();
@@ -38,6 +42,8 @@ public interface IAnimationHandler {
/**
* Get names of all built-in animations.
*
* @return array of all built-in animation names
*/
String[] getBuiltInAnimationNames();
}
@@ -12,11 +12,13 @@ public interface IAuctionHandler {
/**
* Check if the auction system is enabled.
* @return true if the auction system is enabled
*/
boolean isEnabled();
/**
* Get all active listings.
* @return array of all currently active auction listings
*/
IAuctionListing[] getActiveListings();
@@ -32,6 +34,7 @@ public interface IAuctionHandler {
* Get all active listings by a specific seller.
*
* @param sellerUUID The seller's UUID as a string
* @return array of listings created by this seller
*/
IAuctionListing[] getListingsBySeller(String sellerUUID);
@@ -39,11 +42,13 @@ public interface IAuctionHandler {
* Get all listings where a player is the current high bidder.
*
* @param bidderUUID The bidder's UUID as a string
* @return array of listings this player has bid on
*/
IAuctionListing[] getListingsByBidder(String bidderUUID);
/**
* Get total count of active listings.
* @return the number of currently active listings
*/
int getActiveListingCount();
@@ -89,36 +94,43 @@ public interface IAuctionHandler {
/**
* Get the listing fee amount.
* @return the currency fee charged when creating a listing
*/
long getListingFee();
/**
* Get the sales tax percentage (0.0 to 1.0).
* @return the sales tax percentage applied to completed sales
*/
double getSalesTaxPercent();
/**
* Get the minimum bid increment percentage (0.0 to 1.0).
* @return the minimum bid increment as a percentage of current bid
*/
double getMinBidIncrementPercent();
/**
* Get the auction duration in hours.
* @return the default auction duration in hours
*/
int getAuctionDurationHours();
/**
* Get the snipe protection time in minutes.
* @return the snipe protection window in minutes
*/
int getSnipeProtectionMinutes();
/**
* Get the currency name used by the auction system.
* @return the display name of the auction currency
*/
String getCurrencyName();
/**
* Get the minimum listing price.
* @return the minimum starting price for new listings
*/
long getMinimumListingPrice();
@@ -4,47 +4,216 @@ import noppes.npcs.api.IPos;
import noppes.npcs.api.IWorld;
import noppes.npcs.api.entity.IEntity;
/**
* Handles storing and spawning cloned entities.
* Clones are organized by numbered tabs (0-based) or named folders.
*/
public interface ICloneHandler {
/**
* Spawns a clone at the given coordinates.
*
* @param x the x coordinate.
* @param y the y coordinate.
* @param z the z coordinate.
* @param tab the tab index.
* @param name the clone name.
* @param world the world to spawn in.
* @param ignoreProtection whether to bypass spawn protection.
* @return the spawned entity, or null on failure.
*/
IEntity spawn(double x, double y, double z, int tab, String name, IWorld world, boolean ignoreProtection);
/**
* Spawns a clone at the given position.
*
* @param pos the position.
* @param tab the tab index.
* @param name the clone name.
* @param world the world to spawn in.
* @param ignoreProtection whether to bypass spawn protection.
* @return the spawned entity, or null on failure.
*/
IEntity spawn(IPos pos, int tab, String name, IWorld world, boolean ignoreProtection);
/**
* Spawns a clone at the given coordinates with default protection rules.
*
* @param x the x coordinate.
* @param y the y coordinate.
* @param z the z coordinate.
* @param tab the tab index.
* @param name the clone name.
* @param world the world to spawn in.
* @return the spawned entity, or null on failure.
*/
IEntity spawn(double x, double y, double z, int tab, String name, IWorld world);
/**
* Spawns a clone at the given position with default protection rules.
*
* @param pos the position.
* @param tab the tab index.
* @param name the clone name.
* @param world the world to spawn in.
* @return the spawned entity, or null on failure.
*/
IEntity spawn(IPos pos, int tab, String name, IWorld world);
/**
* Returns all clones stored in the specified tab.
*
* @param tab the tab index.
* @param world the world context for entity creation.
* @return an array of entities in the tab.
*/
IEntity[] getTab(int tab, IWorld world);
/**
* Returns a specific clone from a tab by name.
*
* @param tab the tab index.
* @param name the clone name.
* @param world the world context for entity creation.
* @return the entity, or null if not found.
*/
IEntity get(int tab, String name, IWorld world);
/**
* Checks whether a clone with the given name exists in the tab.
*
* @param tab the tab index.
* @param name the clone name.
* @return true if the clone exists; false otherwise.
*/
boolean has(int tab, String name);
/**
* Stores an entity as a clone in the given tab with the specified name.
*
* @param tab the tab index.
* @param name the clone name.
* @param entity the entity to store.
*/
void set(int tab, String name, IEntity entity);
/**
* Removes a clone from the given tab.
*
* @param tab the tab index.
* @param name the clone name.
*/
void remove(int tab, String name);
// --- Custom Folder Methods ---
/**
* Returns all custom folder names.
*
* @return an array of folder names.
*/
String[] getFolders();
/**
* Checks whether a custom folder exists.
*
* @param folderName the folder name.
* @return true if the folder exists; false otherwise.
*/
boolean hasFolder(String folderName);
/**
* Spawns a clone from a custom folder at the given coordinates.
*
* @param x the x coordinate.
* @param y the y coordinate.
* @param z the z coordinate.
* @param folderName the folder name.
* @param name the clone name.
* @param world the world to spawn in.
* @param ignoreProtection whether to bypass spawn protection.
* @return the spawned entity, or null on failure.
*/
IEntity spawn(double x, double y, double z, String folderName, String name, IWorld world, boolean ignoreProtection);
/**
* Spawns a clone from a custom folder at the given position.
*
* @param pos the position.
* @param folderName the folder name.
* @param name the clone name.
* @param world the world to spawn in.
* @param ignoreProtection whether to bypass spawn protection.
* @return the spawned entity, or null on failure.
*/
IEntity spawn(IPos pos, String folderName, String name, IWorld world, boolean ignoreProtection);
/**
* Spawns a clone from a custom folder with default protection rules.
*
* @param x the x coordinate.
* @param y the y coordinate.
* @param z the z coordinate.
* @param folderName the folder name.
* @param name the clone name.
* @param world the world to spawn in.
* @return the spawned entity, or null on failure.
*/
IEntity spawn(double x, double y, double z, String folderName, String name, IWorld world);
/**
* Spawns a clone from a custom folder at the given position with default protection rules.
*
* @param pos the position.
* @param folderName the folder name.
* @param name the clone name.
* @param world the world to spawn in.
* @return the spawned entity, or null on failure.
*/
IEntity spawn(IPos pos, String folderName, String name, IWorld world);
/**
* Returns all clones stored in the specified custom folder.
*
* @param folderName the folder name.
* @param world the world context for entity creation.
* @return an array of entities in the folder.
*/
IEntity[] getFolder(String folderName, IWorld world);
/**
* Returns a specific clone from a custom folder by name.
*
* @param folderName the folder name.
* @param name the clone name.
* @param world the world context for entity creation.
* @return the entity, or null if not found.
*/
IEntity get(String folderName, String name, IWorld world);
/**
* Checks whether a clone exists in a custom folder.
*
* @param folderName the folder name.
* @param name the clone name.
* @return true if the clone exists; false otherwise.
*/
boolean has(String folderName, String name);
/**
* Stores an entity as a clone in a custom folder.
*
* @param folderName the folder name.
* @param name the clone name.
* @param entity the entity to store.
*/
void set(String folderName, String name, IEntity entity);
/**
* Removes a clone from a custom folder.
*
* @param folderName the folder name.
* @param name the clone name.
*/
void remove(String folderName, String name);
}
@@ -5,8 +5,23 @@ import noppes.npcs.api.handler.data.IDialogCategory;
import java.util.List;
/**
* Handles retrieval of dialogs and dialog categories.
*/
public interface IDialogHandler {
/**
* Returns all dialog categories.
*
* @return a list of dialog categories.
*/
List<IDialogCategory> categories();
IDialog get(int var1);
/**
* Returns the dialog with the specified ID.
*
* @param id the dialog ID.
* @return the dialog, or null if not found.
*/
IDialog get(int id);
}
@@ -4,12 +4,40 @@ import noppes.npcs.api.handler.data.IFaction;
import java.util.List;
/**
* Handles creation, deletion, and retrieval of factions.
*/
public interface IFactionHandler {
/**
* Returns all registered factions.
*
* @return a list of factions.
*/
List<IFaction> list();
IFaction delete(int var1);
/**
* Deletes the faction with the given ID.
*
* @param id the faction ID.
* @return the deleted faction, or null if not found.
*/
IFaction delete(int id);
IFaction create(String var1, int var2);
/**
* Creates a new faction with the given name and default points.
*
* @param name the faction name.
* @param defaultPoints the default standing points for new players.
* @return the created faction.
*/
IFaction create(String name, int defaultPoints);
IFaction get(int var1);
/**
* Returns the faction with the given ID.
*
* @param id the faction ID.
* @return the faction, or null if not found.
*/
IFaction get(int id);
}
@@ -3,18 +3,64 @@ package noppes.npcs.api.handler;
import noppes.npcs.api.handler.data.ILinkedItem;
import noppes.npcs.api.item.IItemStack;
/**
* Handles registration and retrieval of linked items.
* Linked items are custom item definitions that can be updated globally.
*/
public interface ILinkedItemHandler {
/**
* Creates a new linked item with the given name.
*
* @param name the item name.
* @return the created linked item.
*/
ILinkedItem createItem(String name);
/**
* Creates an ItemStack from a linked item by its ID.
*
* @param id the linked item ID.
* @return the item stack, or null if the ID is invalid.
*/
IItemStack createItemStack(int id);
/**
* Registers a linked item with this handler.
*
* @param linkedItem the linked item to add.
*/
void add(ILinkedItem linkedItem);
/**
* Removes and returns the linked item with the given ID.
*
* @param id the linked item ID.
* @return the removed linked item, or null if not found.
*/
ILinkedItem remove(int id);
/**
* Returns the linked item with the given ID.
*
* @param id the linked item ID.
* @return the linked item, or null if not found.
*/
ILinkedItem get(int id);
/**
* Checks whether a linked item with the given ID exists.
*
* @param id the linked item ID.
* @return true if it exists; false otherwise.
*/
boolean contains(int id);
/**
* Checks whether the given linked item is registered.
*
* @param linkedItem the linked item to check.
* @return true if it exists; false otherwise.
*/
boolean contains(ILinkedItem linkedItem);
}
@@ -2,17 +2,49 @@ package noppes.npcs.api.handler;
import noppes.npcs.api.handler.data.INaturalSpawn;
/**
* Handles natural spawn configurations for custom NPCs.
*/
public interface INaturalSpawnsHandler {
/**
* Saves all spawn configurations to disk.
*/
void save();
/**
* Returns all registered natural spawn configurations.
*
* @return an array of spawn configurations.
*/
INaturalSpawn[] getSpawns();
/**
* Returns spawn configurations that include the specified biome.
*
* @param biome the biome name.
* @return an array of matching spawn configurations.
*/
INaturalSpawn[] getSpawns(String biome);
/**
* Registers a new natural spawn configuration.
*
* @param spawn the spawn to add.
*/
void addSpawn(INaturalSpawn spawn);
/**
* Removes a natural spawn configuration.
*
* @param spawn the spawn to remove.
*/
void removeSpawn(INaturalSpawn spawn);
/**
* Creates a new empty natural spawn configuration.
*
* @return the created spawn.
*/
INaturalSpawn createSpawn();
}
@@ -2,17 +2,53 @@ package noppes.npcs.api.handler;
import noppes.npcs.api.ISkinOverlay;
/**
* Manages skin overlays applied to an entity or player.
* Overlays are indexed by ID and rendered on top of the base skin.
*/
public interface IOverlayHandler {
/**
* Adds or replaces an overlay at the given ID.
*
* @param id the overlay ID.
* @param overlay the skin overlay to add.
*/
void add(int id, ISkinOverlay overlay);
/**
* Returns the overlay at the given ID.
*
* @param id the overlay ID.
* @return the skin overlay, or null if not found.
*/
ISkinOverlay get(int id);
/**
* Checks whether an overlay exists at the given ID.
*
* @param id the overlay ID.
* @return true if an overlay exists; false otherwise.
*/
boolean has(int id);
/**
* Removes the overlay at the given ID.
*
* @param id the overlay ID.
* @return true if an overlay was removed; false otherwise.
*/
boolean remove(int id);
/**
* Returns the number of active overlays.
*
* @return the overlay count.
*/
int size();
/**
* Removes all overlays.
*/
void clear();
}
@@ -1,4 +1,8 @@
package noppes.npcs.api.handler;
/**
* Holds bank-related data for a player.
* Currently a marker interface.
*/
public interface IPlayerBankData {
}
@@ -3,33 +3,65 @@ package noppes.npcs.api.handler;
import noppes.npcs.api.ability.IPlayerAbilityData;
import noppes.npcs.api.entity.ICustomNpc;
/**
* Provides access to all persistent data categories for a player,
* including companion, dialog, quest, faction, transport, mail, trade, and ability data.
*/
public interface IPlayerData {
/**
* Sets the player's companion NPC.
*
* @param npc the companion NPC, or null to clear.
*/
void setCompanion(ICustomNpc npc);
/**
* Returns the player's companion NPC.
*
* @return the companion NPC, or null if none.
*/
ICustomNpc getCompanion();
/**
* @return true if the player currently has a companion NPC.
*/
boolean hasCompanion();
/**
* @return the entity ID of the companion, or -1 if none.
*/
int getCompanionID();
/** @return the player's dialog data. */
IPlayerDialogData getDialogData();
/** @return the player's bank data. */
IPlayerBankData getBankData();
/** @return the player's quest data. */
IPlayerQuestData getQuestData();
/** @return the player's transport data. */
IPlayerTransportData getTransportData();
/** @return the player's faction data. */
IPlayerFactionData getFactionData();
/** @return the player's item giver data. */
IPlayerItemGiverData getItemGiverData();
/** @return the player's mail data. */
IPlayerMailData getMailData();
/** @return the player's trade data. */
IPlayerTradeData getTradeData();
/** @return the player's ability data. */
IPlayerAbilityData getAbilityData();
/**
* Saves all player data to disk.
*/
void save();
}
@@ -1,10 +1,29 @@
package noppes.npcs.api.handler;
/**
* Tracks which dialogs a player has read.
*/
public interface IPlayerDialogData {
/**
* Checks if the player has read the dialog with the given ID.
*
* @param id the dialog ID.
* @return true if the dialog has been read; false otherwise.
*/
boolean hasReadDialog(int id);
/**
* Marks the dialog with the given ID as read.
*
* @param id the dialog ID.
*/
void readDialog(int id);
/**
* Marks the dialog with the given ID as unread.
*
* @param id the dialog ID.
*/
void unreadDialog(int id);
}
@@ -1,10 +1,32 @@
package noppes.npcs.api.handler;
/**
* Tracks a player's faction standing points.
*/
public interface IPlayerFactionData {
/**
* Returns the player's points for the given faction.
*
* @param id the faction ID.
* @return the faction points.
*/
int getPoints(int id);
/**
* Adds points to the player's standing with the given faction.
* Use negative values to decrease.
*
* @param id the faction ID.
* @param points the points to add.
*/
void addPoints(int id, int points);
/**
* Sets the player's points for the given faction.
*
* @param id the faction ID.
* @param points the new point value.
*/
void setPoints(int id, int points);
}
@@ -2,11 +2,33 @@ package noppes.npcs.api.handler;
import noppes.npcs.api.jobs.IJobItemGiver;
/**
* Tracks item giver interaction data for a player, including
* cooldown timestamps and interaction history.
*/
public interface IPlayerItemGiverData {
/**
* Returns the last interaction time for the given item giver job.
*
* @param jobItemGiver the item giver job.
* @return the last interaction time in game ticks.
*/
long getTime(IJobItemGiver jobItemGiver);
/**
* Sets the last interaction time for the given item giver job.
*
* @param jobItemGiver the item giver job.
* @param day the time to set in game ticks.
*/
void setTime(IJobItemGiver jobItemGiver, long day);
/**
* Checks whether the player has interacted with the item giver before.
*
* @param jobItemGiver the item giver job.
* @return true if previously interacted; false otherwise.
*/
boolean hasInteractedBefore(IJobItemGiver jobItemGiver);
}
@@ -2,21 +2,50 @@ package noppes.npcs.api.handler;
import noppes.npcs.api.handler.data.IPlayerMail;
/**
* Manages a player's mail inbox, including sending, removing, and querying mail.
*/
public interface IPlayerMailData {
/** @return true if the player has any mail. */
boolean hasMail();
/**
* Adds mail to the player's inbox.
*
* @param mail the mail to add.
*/
void addMail(IPlayerMail mail);
/**
* Removes specific mail from the player's inbox.
*
* @param mail the mail to remove.
*/
void removeMail(IPlayerMail mail);
/**
* Checks if the player has the specified mail.
*
* @param mail the mail to check.
* @return true if the mail exists in the inbox.
*/
boolean hasMail(IPlayerMail mail);
/** @return all mail in the player's inbox. */
IPlayerMail[] getAllMail();
/** @return all unread mail in the player's inbox. */
IPlayerMail[] getUnreadMail();
/** @return all read mail in the player's inbox. */
IPlayerMail[] getReadMail();
/**
* Returns all mail from the given sender.
*
* @param sender the sender name.
* @return an array of matching mail.
*/
IPlayerMail[] getMailFrom(String sender);
}
@@ -2,27 +2,73 @@ package noppes.npcs.api.handler;
import noppes.npcs.api.handler.data.IQuest;
/**
* Tracks a player's quest progress, including active, finished, and tracked quests.
*/
public interface IPlayerQuestData {
/** @return the quest currently being tracked by the player, or null if none. */
IQuest getTrackedQuest();
/**
* Starts the quest with the given ID for the player.
*
* @param id the quest ID.
*/
void startQuest(int id);
/**
* Marks the quest with the given ID as finished.
*
* @param id the quest ID.
*/
void finishQuest(int id);
/**
* Removes the quest from the player's active quest list.
*
* @param id the quest ID.
*/
void stopQuest(int id);
/**
* Removes the quest from both active and finished lists.
*
* @param id the quest ID.
*/
void removeQuest(int id);
/**
* @param id the quest ID.
* @return true if the player has finished the quest.
*/
boolean hasFinishedQuest(int id);
public boolean hasActiveQuest(int id);
/**
* @param id the quest ID.
* @return true if the player has the quest active.
*/
boolean hasActiveQuest(int id);
/** @return all active quests for the player. */
IQuest[] getActiveQuests();
/** @return all finished quests for the player. */
IQuest[] getFinishedQuests();
/**
* Returns the timestamp when the quest was last completed.
*
* @param id the quest ID.
* @return the completion time, or 0 if never completed.
*/
long getLastCompletedTime(int id);
/**
* Sets the last completed time for the quest.
*
* @param id the quest ID.
* @param time the completion timestamp.
*/
void setLastCompletedTime(int id, long time);
}
@@ -11,6 +11,8 @@ public interface IPlayerTradeData {
/**
* Get the current balance
*
* @return the player's current currency balance
*/
long getBalance();
@@ -47,16 +49,22 @@ public interface IPlayerTradeData {
/**
* Get lifetime earned currency
*
* @return the total currency earned over the player's lifetime
*/
long getLifetimeEarned();
/**
* Get lifetime spent currency
*
* @return the total currency spent over the player's lifetime
*/
long getLifetimeSpent();
/**
* Format the balance for display
*
* @return the balance formatted as a human-readable string
*/
String formatBalance();
@@ -69,16 +77,22 @@ public interface IPlayerTradeData {
/**
* Get the number of pending auction claims
*
* @return the number of pending auction claims
*/
int getClaimCount();
/**
* Check if player has any pending auction claims
*
* @return true if the player has pending auction claims
*/
boolean hasClaims();
/**
* Get all pending auction claims for this player.
*
* @return array of the player's pending auction claims
*/
IAuctionClaim[] getClaims();
@@ -2,17 +2,50 @@ package noppes.npcs.api.handler;
import noppes.npcs.api.handler.data.ITransportLocation;
/**
* Tracks which transport locations a player has unlocked.
*/
public interface IPlayerTransportData {
/**
* @param id the transport location ID.
* @return true if the player has unlocked this transport.
*/
boolean hasTransport(int id);
/**
* Unlocks a transport location by ID.
*
* @param id the transport location ID.
*/
void addTransport(int id);
/**
* Unlocks the given transport location.
*
* @param location the transport location.
*/
void addTransport(ITransportLocation location);
/**
* Returns the transport location with the given ID.
*
* @param id the transport location ID.
* @return the transport location, or null if not found.
*/
ITransportLocation getTransport(int id);
/**
* Returns all unlocked transport locations for the player.
*
* @return an array of transport locations.
*/
ITransportLocation[] getTransports();
/**
* Removes an unlocked transport location by ID.
*
* @param id the transport location ID.
*/
void removeTransport(int id);
}
@@ -3,17 +3,60 @@ package noppes.npcs.api.handler;
import noppes.npcs.api.entity.IPlayer;
import noppes.npcs.api.handler.data.IProfile;
/**
* Manages player profiles, which allow players to have multiple save slots
* for their CNPC+ data.
*/
public interface IProfileHandler {
/**
* Returns the profile for the given player.
*
* @param player the player.
* @return the player's profile.
*/
IProfile getProfile(IPlayer player);
/**
* Switches the player to a different profile slot.
*
* @param player the player.
* @param slotID the slot ID to switch to.
* @return true if the switch was successful.
*/
boolean changeSlot(IPlayer player, int slotID);
/**
* Checks whether a profile slot exists for the player.
*
* @param player the player.
* @param slotID the slot ID.
* @return true if the slot exists.
*/
boolean hasSlot(IPlayer player, int slotID);
/**
* Removes a profile slot from the player.
*
* @param player the player.
* @param slotID the slot ID to remove.
* @return true if the slot was removed.
*/
boolean removeSlot(IPlayer player, int slotID);
/**
* Returns the player data for a specific profile slot without switching to it.
*
* @param player the player.
* @param slotID the slot ID.
* @return the player data for the slot.
*/
IPlayerData getSlotPlayerData(IPlayer player, int slotID);
/**
* Saves the current slot data for the player.
*
* @param player the player.
*/
void saveSlotData(IPlayer player);
}
@@ -5,8 +5,23 @@ import noppes.npcs.api.handler.data.IQuestCategory;
import java.util.List;
/**
* Handles retrieval of quests and quest categories.
*/
public interface IQuestHandler {
/**
* Returns all quest categories.
*
* @return a list of quest categories.
*/
List<IQuestCategory> categories();
IQuest get(int var1);
/**
* Returns the quest with the given ID.
*
* @param id the quest ID.
* @return the quest, or null if not found.
*/
IQuest get(int id);
}
@@ -6,20 +6,67 @@ import noppes.npcs.api.handler.data.IRecipe;
import java.util.List;
/**
* Handles custom crafting recipes and anvil recipes.
*/
public interface IRecipeHandler {
/** @return all global (vanilla workbench) recipes. */
List<IRecipe> getGlobalList();
/** @return all carpentry table recipes. */
List<IRecipe> getCarpentryList();
/** @return all custom anvil recipes. */
List<IAnvilRecipe> getAnvilList();
void addRecipe(String var1, boolean var2, ItemStack var3, Object... var4);
/**
* Adds a shaped crafting recipe.
*
* @param name the recipe name.
* @param global true for global (vanilla workbench); false for carpentry.
* @param result the resulting item stack.
* @param recipe the recipe pattern and ingredient mappings.
*/
void addRecipe(String name, boolean global, ItemStack result, Object... recipe);
void addRecipe(String var1, boolean var2, ItemStack var3, int var4, int var5, ItemStack... var6);
/**
* Adds a shaped crafting recipe with explicit dimensions.
*
* @param name the recipe name.
* @param global true for global; false for carpentry.
* @param result the resulting item stack.
* @param width the recipe grid width.
* @param height the recipe grid height.
* @param items the ingredient item stacks.
*/
void addRecipe(String name, boolean global, ItemStack result, int width, int height, ItemStack... items);
IRecipe delete(int var1);
/**
* Deletes a crafting recipe by ID.
*
* @param id the recipe ID.
* @return the deleted recipe, or null if not found.
*/
IRecipe delete(int id);
IAnvilRecipe deleteAnvil(int var1);
/**
* Deletes an anvil recipe by ID.
*
* @param id the recipe ID.
* @return the deleted anvil recipe, or null if not found.
*/
IAnvilRecipe deleteAnvil(int id);
/**
* Adds a custom anvil recipe.
*
* @param name the recipe name.
* @param global true for global; false for carpentry.
* @param itemToRepair the item to be repaired.
* @param repairMaterial the material used for repair.
* @param xpCost the experience cost.
* @param repairPercentage the percentage of durability restored per material.
*/
void addAnvilRecipe(String name, boolean global, ItemStack itemToRepair, ItemStack repairMaterial, int xpCost, float repairPercentage);
}
+32 -3
View File
@@ -4,12 +4,41 @@ import noppes.npcs.api.handler.data.ITag;
import java.util.List;
/**
* Handles creation, deletion, and retrieval of tags.
* Tags are labels that can be applied to entities for categorization.
*/
public interface ITagHandler {
/**
* Returns all registered tags.
*
* @return a list of tags.
*/
List<ITag> list();
ITag delete(int var1);
/**
* Deletes the tag with the given ID.
*
* @param id the tag ID.
* @return the deleted tag, or null if not found.
*/
ITag delete(int id);
ITag create(String var1, int var2);
/**
* Creates a new tag with the given name and color.
*
* @param name the tag name.
* @param color the tag color as a packed RGB integer.
* @return the created tag.
*/
ITag create(String name, int color);
ITag get(int var1);
/**
* Returns the tag with the given ID.
*
* @param id the tag ID.
* @return the tag, or null if not found.
*/
ITag get(int id);
}
@@ -29,9 +29,9 @@ import noppes.npcs.api.entity.IEntity;
*/
public interface ITelegraphHandler {
// ═══════════════════════════════════════════════════════════════════════════
// ==========================================================================
// FACTORY METHODS
// ═══════════════════════════════════════════════════════════════════════════
// ==========================================================================
/**
* Create a circle telegraph.
@@ -83,9 +83,9 @@ public interface ITelegraphHandler {
*/
ITelegraph create(String type);
// ═══════════════════════════════════════════════════════════════════════════
// ==========================================================================
// SPAWN METHODS
// ═══════════════════════════════════════════════════════════════════════════
// ==========================================================================
/**
* Spawn a telegraph at a position.
@@ -131,9 +131,9 @@ public interface ITelegraphHandler {
*/
ITelegraphInstance spawn(ITelegraph telegraph, IEntity entity, float yaw);
// ═══════════════════════════════════════════════════════════════════════════
// ==========================================================================
// PRESET MANAGEMENT
// ═══════════════════════════════════════════════════════════════════════════
// ==========================================================================
/**
* Get a saved telegraph preset by name.
@@ -173,9 +173,9 @@ public interface ITelegraphHandler {
*/
String[] getSavedNames();
// ═══════════════════════════════════════════════════════════════════════════
// ==========================================================================
// REMOVAL
// ═══════════════════════════════════════════════════════════════════════════
// ==========================================================================
/**
* Remove an active telegraph by instance ID.
@@ -2,13 +2,37 @@ package noppes.npcs.api.handler;
import noppes.npcs.api.handler.data.ITransportCategory;
/**
* Handles transport categories and their locations.
*/
public interface ITransportHandler {
/**
* Returns all transport categories.
*
* @return an array of transport categories.
*/
ITransportCategory[] categories();
/**
* Creates a new transport category with the given title.
*
* @param title the category title.
*/
void createCategory(String title);
/**
* Returns the transport category with the given title.
*
* @param title the category title.
* @return the category, or null if not found.
*/
ITransportCategory getCategory(String title);
/**
* Removes the transport category with the given title.
*
* @param title the category title.
*/
void removeCategory(String title);
}
+24 -14
View File
@@ -20,13 +20,13 @@ public interface IAction {
/**
* @param queue Schedules action on this queue. If action was scheduled on different queue, transfers it over from that to this.
* @return
* @return this action
*/
IAction setQueue(IActionQueue queue);
/**
* @param task code to execute each time the action fires
* @return
* @return this action
*/
IAction setTask(Consumer<IAction> task);
@@ -49,14 +49,14 @@ public interface IAction {
/**
*
* @param task Fires right after action gets scheduled at duration 0
* @return
* @return this action
*/
IAction onStart(Consumer<IAction> task);
/**
*
* @param task Fires right before a marked done action gets removed from it's IActionQueue
* @return
* @return this action
*/
IAction onDone(Consumer<IAction> task);
@@ -81,7 +81,7 @@ public interface IAction {
/**
* @param ticks max duration
* default: -1, infinite
* @return
* @return this action
*/
IAction setMaxDuration(int ticks);
@@ -93,7 +93,7 @@ public interface IAction {
/**
* @param n max count, task auto marks done after running for n counts
* default: -1, infinite
* @return
* @return this action
*/
IAction times(int n);
@@ -101,7 +101,7 @@ public interface IAction {
* Execute task only once, mark done
* equivalent to times(1)
*
* @return
* @return this action
*/
IAction once();
@@ -135,6 +135,7 @@ public interface IAction {
*
* @param key a string key
* @param value any object to associate with this action
* @return this action
*/
IAction setData(String key, Object value);
@@ -143,7 +144,7 @@ public interface IAction {
/**
*
* @param copyTo copies all of this IAction's data to copyTo
* @return
* @return this action
*/
IAction copyDataTo(IAction copyTo);
@@ -166,20 +167,21 @@ public interface IAction {
* Set how many ticks between each execution of the action task.
*
* @param ticks tick interval (e.g. 1 = every tick, 20 = once per second)
* @return this action
*/
IAction updateEvery(int ticks);
/**
* Executes task every tick (Sets updateEvery to 1)
*
* @return
* @return this action
*/
IAction everyTick();
/**
* Executes task every second (Sets updateEvery to 20)
*
* @return
* @return this action
*/
IAction everySecond();
@@ -192,7 +194,7 @@ public interface IAction {
* @param ticks pauses action for this number of ticks (any subsequent action is paused too)
* If action was threaded using {@link #threadify()}, sleeps the thread.
* Can be forcibly resumed using {@link #resume()}
* @return
* @return this action
*/
IAction pauseFor(int ticks);
@@ -207,6 +209,8 @@ public interface IAction {
/**
* Must call {@link #threadify()} before using, else throws exception.
* Pauses IAction's thread until the supplied condition is satisfied or {@link #resume()} is called.
*
* @param until condition to check each tick
*/
void pauseUntil(Function<IAction, Boolean> until);
@@ -217,7 +221,7 @@ public interface IAction {
void resume();
/**
* @return checks if IAction's getStartAfterTicks > 0, or if IAction's thread is paused if threaded
* @return checks if IAction's getStartAfterTicks &gt; 0, or if IAction's thread is paused if threaded
* Preferably called from a different thread than the IAction one if it's paused.
*/
boolean isPaused();
@@ -230,6 +234,8 @@ public interface IAction {
/**
* Creates a new thread for task to run into. Allows for pausing and sleeping just this IAction's thread.
*
* @return this action
*/
IAction threadify();
@@ -253,6 +259,7 @@ public interface IAction {
* Enqueue another action immediately after this one.
*
* @param after the action to run next
* @return the chained action
*/
IAction after(IAction after);
@@ -260,7 +267,7 @@ public interface IAction {
* Multiple actions chained one after another
* i.e after(act1,act2,act3,...)
*
* @param actions
* @param actions the actions to chain
*/
void after(IAction... actions);
@@ -268,7 +275,7 @@ public interface IAction {
* Multiple tasks chained one after another
* i.e after(task1,task2,task3,...)
*
* @param tasks
* @param tasks the tasks to chain
*/
void after(Consumer<IAction>... tasks);
@@ -286,6 +293,7 @@ public interface IAction {
* Enqueue another action immediately before this one (pausing this one until done).
*
* @param before the action to run prior
* @return the chained action
*/
IAction before(IAction before);
@@ -303,6 +311,7 @@ public interface IAction {
* Enqueue an IConditionalAction on the conditional chain
*
* @param after the scheduled IConditionalAction
* @return the conditional action
*/
IConditionalAction conditional(IConditionalAction after);
@@ -324,6 +333,7 @@ public interface IAction {
* Enqueue another IAction on the parallel chain which starts firing simultaneously as this.
*
* @param after the scheduled parallel action
* @return the parallel action
*/
IAction parallel(IAction after);
@@ -8,7 +8,7 @@ public interface IActionChain {
/**
* @param name of chain
* @return
* @return this IActionChain for method chaining
*/
IActionChain setName(String name);
@@ -23,7 +23,7 @@ public interface IActionChain {
* @param delay ticks between an IAction and another
* @param name name of IAction
* @param task task of IAction
* @return
* @return this IActionChain for method chaining
*/
IActionChain after(int delay, String name, Consumer<IAction> task);
@@ -32,7 +32,7 @@ public interface IActionChain {
/**
* Start IActionManager
*
* @return
* @return this IActionChain for method chaining
*/
IActionChain start();
}
@@ -1,5 +1,9 @@
package noppes.npcs.api.handler.data;
/**
* Listener interface for action hooks.
* Currently a placeholder for future hook-based action firing.
*/
public interface IActionListener {
// IActionListener Comments
// ActionListener.Hook getOrCreateHook(String name);
@@ -36,7 +36,7 @@ public interface IActionQueue {
/**
*
* @param parallel True to turn queue into parallel, false for sequential
* @return
* @return this IActionQueue for method chaining
*/
IActionQueue setParallel(boolean parallel);
@@ -49,7 +49,7 @@ public interface IActionQueue {
/**
*
* @param stopWhenEmpty to auto-stop queue when empty/no active Actions scheduled using {{@link #stop()}}
* @return
* @return this IActionQueue for method chaining
*/
IActionQueue stopWhenEmpty(boolean stopWhenEmpty);
@@ -71,7 +71,7 @@ public interface IActionQueue {
/**
* @param ticks to kill queue after when killWhenEmpty and queue has no active tasks
* If an IAction is scheduled during the kill process, process is aborted
* @return
* @return this IActionQueue for method chaining
*/
IActionQueue killWhenEmptyAfter(int ticks);
@@ -109,7 +109,7 @@ public interface IActionQueue {
/**
*
* @param action
* @param action the action to find in the queue
* @return index of action in {{@link #getQueue()}}
* -1 if not in queue.
*/
@@ -55,6 +55,8 @@ public interface IAnimation {
/**
* Do not use this unless you know what you are changing. Dangerous to change.
*
* @param id the animation ID
*/
void setID(int id);
@@ -5,16 +5,22 @@ import net.minecraft.item.ItemStack;
public interface IAnvilRecipe {
/**
* Returns the unique name of this anvil recipe.
*
* @return the recipe name
*/
String getName();
/**
* The XP cost per repair tick (e.g., 10 levels per tick).
*
* @return the experience level cost
*/
int getXpCost();
/**
* The repair percentage (e.g., 0.1f repairs 10% of max damage per tick).
*
* @return the repair percentage (0.0 to 1.0)
*/
float getRepairPercentage();
@@ -9,21 +9,25 @@ public interface IAuctionClaim {
/**
* Get the unique claim ID.
* @return the unique claim ID
*/
String getId();
/**
* Get the player's UUID who can claim this.
* @return the UUID of the player who can claim this
*/
String getPlayerUUID();
/**
* Get the player's display name.
* @return the name of the player who can claim this
*/
String getPlayerName();
/**
* Get the related listing ID.
* @return the ID of the original auction listing
*/
String getListingId();
@@ -36,16 +40,19 @@ public interface IAuctionClaim {
/**
* Check if this is an item claim.
* @return true if this claim contains an item to collect
*/
boolean isItemClaim();
/**
* Check if this is a currency claim (sale proceeds or refund).
* @return true if this claim contains currency to collect
*/
boolean isCurrencyClaim();
/**
* Check if this is a refund claim (outbid).
* @return true if this is a refund from an outbid or cancelled auction
*/
boolean isRefundClaim();
@@ -58,11 +65,13 @@ public interface IAuctionClaim {
/**
* Get the item display name (for currency/refund claims tooltip).
* @return the display name of the claimed item
*/
String getItemName();
/**
* Get the currency amount (for currency/refund claims).
* @return the currency amount to claim
*/
long getCurrency();
@@ -70,32 +79,38 @@ public interface IAuctionClaim {
* Get the other player's name involved.
* For currency claims: the buyer's name.
* For refund claims: the player who outbid.
* @return the name of the other party in the transaction
*/
String getOtherPlayerName();
/**
* Get when this claim was created (Unix timestamp in ms).
* @return the timestamp when this claim was created
*/
long getCreatedTime();
/**
* Check if this claim has been claimed.
* @return true if this claim has already been collected
*/
boolean isClaimed();
/**
* Check if this is a returned item (expired/cancelled listing) vs won item.
* Only relevant for item claims.
* @return true if this is a returned unsold item
*/
boolean isReturnedItem();
/**
* Get days until this claim expires.
* @return the number of days until this claim expires
*/
long getDaysUntilExpiration();
/**
* Check if this claim has expired.
* @return true if this claim has expired
*/
boolean isExpired();
}
@@ -9,86 +9,103 @@ public interface IAuctionListing {
/**
* Get the unique listing ID.
* @return the unique listing ID
*/
String getId();
/**
* Get the seller's UUID as a string.
* @return the seller's UUID
*/
String getSellerUUID();
/**
* Get the seller's display name.
* @return the seller's display name
*/
String getSellerName();
/**
* Get the item being sold.
* @return the item being auctioned
*/
IItemStack getItem();
/**
* Get the starting price.
* @return the starting bid price in currency
*/
long getStartingPrice();
/**
* Get the buyout price (0 if no buyout).
* @return the instant buyout price in currency
*/
long getBuyoutPrice();
/**
* Check if this listing has a buyout option.
* @return true if this listing has a buyout option
*/
boolean hasBuyout();
/**
* Get the current highest bid.
* @return the current highest bid amount
*/
long getCurrentBid();
/**
* Get the high bidder's UUID as a string (null if no bids).
* @return the UUID of the current highest bidder
*/
String getHighBidderUUID();
/**
* Get the high bidder's display name (null if no bids).
* @return the name of the current highest bidder
*/
String getHighBidderName();
/**
* Check if there are any bids on this listing.
* @return true if any bids have been placed
*/
boolean hasBids();
/**
* Get the total number of bids placed.
* @return the total number of bids placed
*/
int getBidCount();
/**
* Get when the listing was created (Unix timestamp in ms).
* @return the timestamp when this listing was created
*/
long getCreatedTime();
/**
* Get when the auction ends (Unix timestamp in ms).
* @return the timestamp when this listing ends
*/
long getEndTime();
/**
* Get the remaining time in milliseconds.
* @return the remaining time in milliseconds
*/
long getRemainingTime();
/**
* Check if the auction has expired.
* @return true if the listing has ended
*/
boolean isExpired();
/**
* Check if the auction is still active (can be bid on).
* @return true if the listing is still accepting bids
*/
boolean isActive();
@@ -101,21 +118,27 @@ public interface IAuctionListing {
/**
* Get the minimum bid amount (current bid + increment).
* @return the minimum bid amount required
*/
long getMinimumBid();
/**
* Check if a player UUID is the seller.
* @param playerUUID the player UUID to check
* @return true if this player is the seller
*/
boolean isSeller(String playerUUID);
/**
* Check if a player UUID is the current high bidder.
* @param playerUUID the player UUID to check
* @return true if this player is the current highest bidder
*/
boolean isHighBidder(String playerUUID);
/**
* Get the remaining time formatted as a string (e.g., "2h 30m").
* @return the remaining time as a human-readable string
*/
String getRemainingTimeFormatted();
}
@@ -2,46 +2,152 @@ package noppes.npcs.api.handler.data;
public interface ICustomEffect {
/**
* Returns the unique ID of this custom effect.
*
* @return the effect ID, or -1 if not yet assigned
*/
int getID();
/**
* Returns the internal name of this custom effect.
*
* @return the effect name
*/
String getName();
/**
* Sets the display name shown in menus. Supports color codes using '&amp;' (converted to section signs).
*
* @param name the display name to set; ignored if null or empty
*/
void setMenuName(String name);
/**
* Returns the display name shown in menus.
*
* @return the menu display name
*/
String getMenuName();
/**
* Sets the internal name of this custom effect.
*
* @param name the name to set; ignored if null or empty
*/
void setName(String name);
/**
* Returns the resource path of the icon texture.
*
* @return the icon texture path
*/
String getIcon();
/**
* Sets the resource path of the icon texture.
*
* @param icon the icon texture path
*/
void setIcon(String icon);
/**
* Returns the tick interval at which this effect fires its script tick event.
*
* @return the tick interval (always a multiple of 10, minimum 10)
*/
int getEveryXTick();
/**
* Sets the tick interval at which this effect fires its script tick event.
* The value is rounded to the nearest multiple of 10 with a minimum of 10.
*
* @param everyXTick the desired tick interval
*/
void setEveryXTick(int everyXTick);
/**
* Returns the X offset of the icon within the texture.
*
* @return the icon X offset in pixels
*/
int getIconX();
/**
* Sets the X offset of the icon within the texture.
*
* @param iconX the icon X offset in pixels
*/
void setIconX(int iconX);
/**
* Returns the Y offset of the icon within the texture.
*
* @return the icon Y offset in pixels
*/
int getIconY();
/**
* Sets the Y offset of the icon within the texture.
*
* @param iconY the icon Y offset in pixels
*/
void setIconY(int iconY);
/**
* Returns the width of the icon.
*
* @return the icon width in pixels
*/
int getWidth();
/**
* Sets the width of the icon.
*
* @param width the icon width in pixels
*/
void setWidth(int width);
/**
* Returns the height of the icon.
*
* @return the icon height in pixels
*/
int getHeight();
/**
* Sets the height of the icon.
*
* @param height the icon height in pixels
*/
void setHeight(int height);
/**
* Returns whether this effect is removed when the player dies.
*
* @return true if the effect is lost on death
*/
boolean isLossOnDeath();
/**
* Sets whether this effect is removed when the player dies.
*
* @param lossOnDeath true to remove the effect on death
*/
void setLossOnDeath(boolean lossOnDeath);
/**
* Saves this custom effect to the effect controller.
*
* @return the saved effect instance
*/
ICustomEffect save();
/**
* Sets the unique ID of this custom effect.
*
* @param id the effect ID to assign
*/
void setID(int id);
/**
@@ -49,19 +155,53 @@ public interface ICustomEffect {
* which map of Effects to Match to.
* Index: 0 - CNPC+
* Index: 1 - DBC Addon
*
* @return the effect's index in the effect list
*/
int getIndex();
/**
* Returns whether the icon texture is animated.
*
* @return true if the icon is animated
*/
boolean isAnimated();
/**
* Sets whether the icon texture is animated.
*
* @param animated true to enable icon animation
*/
void setAnimated(boolean animated);
/**
* Returns the number of frames in the icon animation.
*
* @return the frame count (minimum 1)
*/
int getFrameCount();
/**
* Sets the number of frames in the icon animation.
* Values less than 1 are clamped to 1.
*
* @param frameCount the number of animation frames
*/
void setFrameCount(int frameCount);
/**
* Returns the duration of each animation frame in ticks.
*
* @return the frame time in ticks (minimum 1)
*/
int getFrameTime();
/**
* Sets the duration of each animation frame in ticks.
* Values less than 1 are clamped to 1.
*
* @param frametime the frame duration in ticks
*/
void setFrameTime(int frametime);
}
@@ -3,137 +3,378 @@ package noppes.npcs.api.handler.data;
import java.util.List;
public interface IDialog {
/**
* @return The unique ID of this dialog
*/
int getId();
/**
* @return The title/name of this dialog
*/
String getName();
/**
* Sets the title/name of this dialog.
* @param var1 The new dialog title
*/
void setName(String var1);
/**
* @return The dialog body text displayed to the player
*/
String getText();
/**
* Sets the dialog body text displayed to the player.
* @param var1 The new dialog text
*/
void setText(String var1);
/**
* @return The quest associated with this dialog, or null if none
*/
IQuest getQuest();
/**
* Sets the quest associated with this dialog.
* @param var1 The quest to associate, or null to remove
*/
void setQuest(IQuest var1);
/**
* @return The command executed when this dialog is shown
*/
String getCommand();
/**
* Sets the command executed when this dialog is shown.
* @param var1 The command string
*/
void setCommand(String var1);
/**
* @return A list of all dialog options
*/
List<IDialogOption> getOptions();
/**
* Gets a dialog option by its slot index.
* @param var1 The option slot index
* @return The dialog option at the given slot
*/
IDialogOption getOption(int var1);
/**
* @return The availability settings for this dialog
*/
IAvailability getAvailability();
/**
* @return The category this dialog belongs to
*/
IDialogCategory getCategory();
/**
* Sets whether the screen darkens when this dialog is displayed.
* @param darkenScreen True to darken the screen
*/
void setDarkenScreen(boolean darkenScreen);
/**
* @return Whether the screen darkens when this dialog is displayed
*/
boolean getDarkenScreen();
/**
* Sets whether the Escape key is disabled while this dialog is open.
* @param disableEsc True to disable the Escape key
*/
void setDisableEsc(boolean disableEsc);
/**
* @return Whether the Escape key is disabled while this dialog is open
*/
boolean getDisableEsc();
/**
* Sets whether the dialog option wheel is shown.
* @param showWheel True to show the option wheel
*/
void setShowWheel(boolean showWheel);
/**
* @return Whether the dialog option wheel is shown
*/
boolean getShowWheel();
/**
* Sets whether the NPC is hidden during this dialog.
* @param hideNPC True to hide the NPC
*/
void setHideNPC(boolean hideNPC);
/**
* @return Whether the NPC is hidden during this dialog
*/
boolean getHideNPC();
/**
* Sets the sound played when this dialog opens.
* @param sound The resource location of the sound
*/
void setSound(String sound);
/**
* @return The resource location of the sound played when this dialog opens
*/
String getSound();
/**
* Saves this dialog to the dialog controller.
*/
void save();
/**
* Sets the text color of the dialog body.
* @param color The color as an integer (e.g. 0xe0e0e0)
*/
void setColor(int color);
/**
* @return The text color of the dialog body
*/
int getColor();
/**
* Sets the color of the dialog title.
* @param titleColor The color as an integer (e.g. 0xe0e0e0)
*/
void setTitleColor(int titleColor);
/**
* @return The color of the dialog title
*/
int getTitleColor();
/**
* Sets whether the dialog text renders character by character.
* @param gradual True to enable gradual text rendering
*/
void renderGradual(boolean gradual);
/**
* @return Whether the dialog text renders character by character
*/
boolean renderGradual();
/**
* Sets whether previous dialog text blocks are shown.
* @param show True to show previous dialog blocks
*/
void showPreviousBlocks(boolean show);
/**
* @return Whether previous dialog text blocks are shown
*/
boolean showPreviousBlocks();
/**
* Sets whether the separator line above dialog options is shown.
* @param show True to show the option line
*/
void showOptionLine(boolean show);
/**
* @return Whether the separator line above dialog options is shown
*/
boolean showOptionLine();
/**
* Sets the sound played per character during gradual text rendering.
* @param textSound The resource location of the text sound
*/
void setTextSound(String textSound);
/**
* @return The resource location of the sound played per character during gradual text rendering
*/
String getTextSound();
/**
* Sets the pitch of the per-character text sound.
* @param textPitch The pitch value (default 1.0)
*/
void setTextPitch(float textPitch);
/**
* @return The pitch of the per-character text sound
*/
float getTextPitch();
/**
* Sets the position of the dialog title.
* @param pos The title position value
*/
void setTitlePos(int pos);
/**
* @return The position of the dialog title
*/
int getTitlePos();
/**
* Sets the render scale of the NPC in the dialog.
* @param scale The NPC scale (default 1.0)
*/
void setNPCScale(float scale);
/**
* @return The render scale of the NPC in the dialog
*/
float getNpcScale();
/**
* Sets the NPC render offset in the dialog.
* @param offsetX The horizontal offset in pixels
* @param offsetY The vertical offset in pixels
*/
void setNpcOffset(int offsetX, int offsetY);
/**
* @return The horizontal offset of the NPC render in pixels
*/
int getNpcOffsetX();
/**
* @return The vertical offset of the NPC render in pixels
*/
int getNpcOffsetY();
/**
* Sets the width and height of the dialog text area.
* @param textWidth The text area width in pixels
* @param textHeight The text area height in pixels
*/
void textWidthHeight(int textWidth, int textHeight);
/**
* @return The width of the dialog text area in pixels
*/
int getTextWidth();
/**
* @return The height of the dialog text area in pixels
*/
int setTextHeight();
/**
* Sets the offset of the dialog text area.
* @param offsetX The horizontal offset in pixels
* @param offsetY The vertical offset in pixels
*/
void setTextOffset(int offsetX, int offsetY);
/**
* @return The horizontal offset of the dialog text area in pixels
*/
int getTextOffsetX();
/**
* @return The vertical offset of the dialog text area in pixels
*/
int getTextOffsetY();
/**
* Sets the offset of the dialog title.
* @param offsetX The horizontal offset in pixels
* @param offsetY The vertical offset in pixels
*/
void setTitleOffset(int offsetX, int offsetY);
/**
* @return The horizontal offset of the dialog title in pixels
*/
int getTitleOffsetX();
/**
* @return The vertical offset of the dialog title in pixels
*/
int getTitleOffsetY();
/**
* Sets the offset of the dialog options area.
* @param offsetX The horizontal offset in pixels
* @param offsetY The vertical offset in pixels
*/
void setOptionOffset(int offsetX, int offsetY);
/**
* @return The horizontal offset of the dialog options area in pixels
*/
int getOptionOffsetX();
/**
* @return The vertical offset of the dialog options area in pixels
*/
int getOptionOffsetY();
/**
* Sets the spacing between dialog options.
* @param spaceX The horizontal spacing in pixels
* @param spaceY The vertical spacing in pixels
*/
void setOptionSpacing(int spaceX, int spaceY);
/**
* @return The horizontal spacing between dialog options in pixels
*/
int getOptionSpaceX();
/**
* @return The vertical spacing between dialog options in pixels
*/
int getOptionSpaceY();
/**
* Adds an image to the dialog at the given ID.
* @param id The image ID
* @param image The dialog image to add
*/
void addImage(int id, IDialogImage image);
/**
* Gets a dialog image by its ID.
* @param id The image ID
* @return The dialog image, or null if not found
*/
IDialogImage getImage(int id);
/**
* Creates a new empty dialog image instance.
* @return A new {@link IDialogImage}
*/
IDialogImage createImage();
/**
* @return An array of all dialog images
*/
IDialogImage[] getImages();
/**
* Checks whether an image with the given ID exists.
* @param id The image ID
* @return True if the image exists
*/
boolean hasImage(int id);
/**
* Removes the image with the given ID.
* @param id The image ID to remove
*/
void removeImage(int id);
/**
* Removes all images from this dialog.
*/
void clearImages();
}
@@ -3,11 +3,24 @@ package noppes.npcs.api.handler.data;
import java.util.List;
public interface IDialogCategory {
/**
* @return A list of all dialogs in this category
*/
List<IDialog> dialogs();
/**
* @return The name of this dialog category
*/
String getName();
/**
* Creates a new empty dialog in this category.
* @return The newly created {@link IDialog}
*/
IDialog create();
/**
* @return The unique ID of this dialog category
*/
int getId();
}
@@ -1,55 +1,147 @@
package noppes.npcs.api.handler.data;
public interface IDialogImage {
/**
* @return The unique ID of this dialog image
*/
int getId();
/**
* Sets the texture resource location for this image.
* @param texture The resource location string
*/
void setTexture(String texture);
/**
* @return The texture resource location for this image
*/
String getTexture();
/**
* Sets the screen position of this image.
* @param x The X position in pixels
* @param y The Y position in pixels
*/
void setPosition(int x, int y);
/**
* @return The X position of this image in pixels
*/
int getX();
/**
* @return The Y position of this image in pixels
*/
int getY();
/**
* Sets the rendered width and height of this image.
* @param width The width in pixels
* @param height The height in pixels
*/
void setWidthHeight(int width, int height);
/**
* @return The rendered width of this image in pixels
*/
int getWidth();
/**
* @return The rendered height of this image in pixels
*/
int getHeight();
/**
* Sets the texture UV offset for this image.
* @param offsetX The horizontal texture offset in pixels
* @param offsetY The vertical texture offset in pixels
*/
void setTextureOffset(int offsetX, int offsetY);
/**
* @return The horizontal texture UV offset in pixels
*/
int getTextureX();
/**
* @return The vertical texture UV offset in pixels
*/
int getTextureY();
/**
* Sets the tint color of this image.
* @param color The color as an integer (e.g. 0xFFFFFF)
*/
void setColor(int color);
/**
* @return The tint color of this image
*/
int getColor();
/**
* Sets the tint color used when this image is selected/hovered.
* @param color The selected color as an integer (e.g. 0xFFFFFF)
*/
void setSelectedColor(int color);
/**
* @return The tint color used when this image is selected/hovered
*/
int getSelectedColor();
/**
* Sets the render scale of this image.
* @param scale The scale factor (default 1.0)
*/
void setScale(float scale);
/**
* @return The render scale of this image
*/
float getScale();
/**
* Sets the alpha transparency of this image.
* @param alpha The alpha value from 0.0 (transparent) to 1.0 (opaque)
*/
void setAlpha(float alpha);
/**
* @return The alpha transparency of this image (0.0 to 1.0)
*/
float getAlpha();
/**
* Sets the rotation angle of this image.
* @param rotation The rotation in degrees
*/
void setRotation(float rotation);
/**
* @return The rotation angle of this image in degrees
*/
float getRotation();
/**
* Sets the image type which determines where the image is rendered.
* @param imageType The image type: 0 = Default, 1 = Text, 2 = Option
*/
void setImageType(int imageType);
/**
* @return The image type: 0 = Default, 1 = Text, 2 = Option
*/
int getImageType();
/**
* Sets the alignment of this image.
* @param alignment The alignment value
*/
void setAlignment(int alignment);
/**
* @return The alignment value of this image
*/
int getAlignment();
}
@@ -1,9 +1,18 @@
package noppes.npcs.api.handler.data;
public interface IDialogOption {
/**
* @return The slot index of this dialog option
*/
int getSlot();
/**
* @return The display name/title of this dialog option
*/
String getName();
/**
* @return The option type ordinal: 0 = QuitOption, 1 = DialogOption, 2 = Disabled, 3 = RoleOption, 4 = CommandBlock
*/
int getType();
}
@@ -4,51 +4,139 @@ import noppes.npcs.api.entity.ICustomNpc;
import noppes.npcs.api.entity.IPlayer;
public interface IFaction {
/**
* @return The faction's unique ID
*/
int getId();
/**
* @return The faction's display name
*/
String getName();
/**
* Sets the faction's display name.
* @param name The new name
*/
void setName(String name);
/**
* Sets the default faction points assigned to new players.
* @param var1 The default point value
*/
void setDefaultPoints(int var1);
/**
* @return The default faction points assigned to new players
*/
int getDefaultPoints();
/**
* Sets the point threshold at or above which a player is considered friendly.
* @param p The friendly point threshold
*/
void setFriendlyPoints(int p);
/**
* @return The point threshold at or above which a player is considered friendly
*/
int getFriendlyPoints();
/**
* Sets the point threshold below which a player is considered an enemy.
* @param p The neutral point threshold
*/
void setNeutralPoints(int p);
/**
* @return The point threshold below which a player is considered an enemy
*/
int getNeutralPoints();
/**
* Sets the faction's display color.
* @param c The color as an RGB integer
*/
void setColor(int c);
/**
* @return The faction's display color as an RGB integer
*/
int getColor();
/**
* Returns the player's standing with this faction.
* @param player The player to check
* @return 1 for friendly, 0 for neutral, -1 for enemy
*/
int playerStatus(IPlayer player);
/**
* Checks whether this faction is hostile toward the given NPC's faction.
* @param npc The NPC to check against
* @return True if this faction is aggressive toward the NPC
*/
boolean isAggressiveToNpc(ICustomNpc npc);
/**
* @return Whether this faction is hidden from the player's faction list
*/
boolean getIsHidden();
/**
* Sets whether this faction is hidden from the player's faction list.
* @param hidden True to hide the faction
*/
void setIsHidden(boolean hidden);
/**
* @return Whether NPCs in this faction are passive and will not attack
*/
boolean isPassive();
/**
* Sets whether NPCs in this faction are passive.
* @param passive True to make faction NPCs passive
*/
void setIsPassive(boolean passive);
/**
* @return Whether NPCs in this faction can be attacked by hostile mobs
*/
boolean attackedByMobs();
/**
* Sets whether NPCs in this faction can be attacked by hostile mobs.
* @param attacked True to allow mobs to attack faction NPCs
*/
void setAttackedByMobs(boolean attacked);
/**
* Checks whether the given faction is an enemy of this faction.
* @param faction The faction to check
* @return True if the given faction is an enemy
*/
boolean isEnemyFaction(IFaction faction);
/**
* @return An array of all factions that are enemies of this faction
*/
IFaction[] getEnemyFactions();
/**
* Adds a faction as an enemy of this faction.
* @param faction The faction to add as an enemy
*/
void addEnemyFaction(IFaction faction);
/**
* Removes a faction from this faction's enemy list.
* @param faction The faction to remove
*/
void removeEnemyFaction(IFaction faction);
/**
* Saves the faction data to the server.
*/
void save();
}
@@ -2,29 +2,83 @@ package noppes.npcs.api.handler.data;
public interface IFrame {
/**
* @return An array of all frame parts in this frame
*/
IFramePart[] getParts();
/**
* Adds a frame part to this frame.
* @param partConfig The frame part to add
* @return This frame for chaining
*/
IFrame addPart(IFramePart partConfig);
/**
* Removes a frame part by its name.
* @param partName The animation part name (e.g. HEAD, BODY, RIGHT_ARM, LEFT_ARM, RIGHT_LEG, LEFT_LEG, FULL_MODEL)
* @return This frame for chaining
*/
IFrame removePart(String partName);
/**
* Removes a frame part by its ordinal ID.
* @param partId The animation part ordinal ID
* @return This frame for chaining
*/
IFrame removePart(int partId);
/**
* Removes all frame parts from this frame.
* @return This frame for chaining
*/
IFrame clearParts();
/**
* @return The duration of this frame in ticks
*/
int getDuration();
/**
* Sets the duration of this frame.
* @param duration The duration in ticks
* @return This frame for chaining
*/
IFrame setDuration(int duration);
/**
* @return Whether this frame has custom speed and smooth settings that override the parent animation
*/
boolean isCustomized();
/**
* Sets whether this frame uses custom speed and smooth settings.
* @param customized True to use frame-level settings instead of the parent animation's
* @return This frame for chaining
*/
IFrame setCustomized(boolean customized);
/**
* @return The interpolation speed of this frame
*/
float getSpeed();
/**
* Sets the interpolation speed of this frame.
* @param speed The speed value
* @return This frame for chaining
*/
IFrame setSpeed(float speed);
/**
* @return The smooth interpolation type: 0 = Interpolated, 1 = Linear, 2 = None
*/
byte smoothType();
/**
* Sets the smooth interpolation type.
* @param smooth The smooth type: 0 = Interpolated, 1 = Linear, 2 = None
* @return This frame for chaining
*/
IFrame setSmooth(byte smooth);
}
Loaded 100 of 131 files, more files were not shown because too many files have changed in this diff. Show more