mirror of
https://github.com/KAMKEEL/CustomNPC-Plus-API.git
synced 2026-11-16 10:44:47 +00:00
194 files changed
+10515
-502
No files matched your search
@@ -1,14 +1,17 @@
|
||||
# CustomNPC-Plus-API
|
||||
|
||||
External API for scripting and to allow mods/plugins to hook into CustomNPC+
|
||||
|
||||
## How to use in a Mod
|
||||
Basically just download the api code and include it in your mod.
|
||||
|
||||
In your mod you can check if CustomNPC+ is installed with `NpcAPI.IsAvailable()`
|
||||
Basically just download the api code and include it in your mod.
|
||||
|
||||
In your mod you can check if CustomNPC+ is installed with `NpcAPI.IsAvailable()`
|
||||
|
||||
To use the events, register your events with `NpcAPI.Instance().events().register(youreventclass)`
|
||||
|
||||
## Extra
|
||||
|
||||
JavaDocs: https://kamkeel.github.io/CustomNPC-Plus/
|
||||
|
||||
[](https://discord.gg/pQqRTvFeJ5)
|
||||
|
||||
@@ -2,10 +2,11 @@ package net.minecraft.block.properties;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
/** This code is owned by Minecraft */
|
||||
/**
|
||||
* This code is owned by Minecraft
|
||||
*/
|
||||
|
||||
public interface IProperty<T extends Comparable<T>>
|
||||
{
|
||||
public interface IProperty<T extends Comparable<T>> {
|
||||
String getName();
|
||||
|
||||
Collection<T> getAllowedValues();
|
||||
@@ -16,4 +17,4 @@ public interface IProperty<T extends Comparable<T>>
|
||||
* Get the name for the given value.
|
||||
*/
|
||||
String getName(T value);
|
||||
}
|
||||
}
|
||||
@@ -6,10 +6,11 @@ import net.minecraft.block.properties.IProperty;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
/** This code is owned by Minecraft */
|
||||
/**
|
||||
* This code is owned by Minecraft
|
||||
*/
|
||||
|
||||
public interface IBlockState
|
||||
{
|
||||
public interface IBlockState {
|
||||
Collection<IProperty> getPropertyNames();
|
||||
|
||||
<T extends Comparable<T>> T getValue(IProperty<T> property);
|
||||
|
||||
@@ -2,31 +2,42 @@ package net.minecraft.util;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
|
||||
/** This code is owned by Minecraft */
|
||||
/**
|
||||
* This code is owned by Minecraft
|
||||
*/
|
||||
|
||||
public class Vec3i implements Comparable<Vec3i>
|
||||
{
|
||||
/** X coordinate */
|
||||
public class Vec3i implements Comparable<Vec3i> {
|
||||
/**
|
||||
* X coordinate
|
||||
*/
|
||||
private final int x;
|
||||
/** Y coordinate */
|
||||
/**
|
||||
* Y coordinate
|
||||
*/
|
||||
private final int y;
|
||||
/** Z coordinate */
|
||||
/**
|
||||
* Z coordinate
|
||||
*/
|
||||
private final int z;
|
||||
|
||||
/** Double X coordinate */
|
||||
/**
|
||||
* Double X coordinate
|
||||
*/
|
||||
private final double xd;
|
||||
/** Double Y coordinate */
|
||||
/**
|
||||
* Double Y coordinate
|
||||
*/
|
||||
private final double yd;
|
||||
/** Double Z coordinate */
|
||||
/**
|
||||
* Double Z coordinate
|
||||
*/
|
||||
private final double zd;
|
||||
|
||||
public Vec3i(int xIn, int yIn, int zIn)
|
||||
{
|
||||
public Vec3i(int xIn, int yIn, int zIn) {
|
||||
this((double) xIn, (double) yIn, (double) zIn);
|
||||
}
|
||||
|
||||
public Vec3i(double xIn, double yIn, double zIn)
|
||||
{
|
||||
public Vec3i(double xIn, double yIn, double zIn) {
|
||||
this.x = MathHelper.floor_double(xIn);
|
||||
this.y = MathHelper.floor_double(yIn);
|
||||
this.z = MathHelper.floor_double(zIn);
|
||||
@@ -35,92 +46,84 @@ public class Vec3i implements Comparable<Vec3i>
|
||||
this.zd = zIn;
|
||||
}
|
||||
|
||||
public boolean equals(Object p_equals_1_)
|
||||
{
|
||||
if (this == p_equals_1_)
|
||||
{
|
||||
public boolean equals(Object p_equals_1_) {
|
||||
if (this == p_equals_1_) {
|
||||
return true;
|
||||
}
|
||||
else if (!(p_equals_1_ instanceof Vec3i))
|
||||
{
|
||||
} else if (!(p_equals_1_ instanceof Vec3i)) {
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
Vec3i vec3I = (Vec3i)p_equals_1_;
|
||||
} else {
|
||||
Vec3i vec3I = (Vec3i) p_equals_1_;
|
||||
return this.getX() != vec3I.getX() ? false : (this.getY() != vec3I.getY() ? false : this.getZ() == vec3I.getZ());
|
||||
}
|
||||
}
|
||||
|
||||
public int hashCode()
|
||||
{
|
||||
public int hashCode() {
|
||||
return (this.getY() + this.getZ() * 31) * 31 + this.getX();
|
||||
}
|
||||
|
||||
public int compareTo(Vec3i p_compareTo_1_)
|
||||
{
|
||||
public int compareTo(Vec3i p_compareTo_1_) {
|
||||
return this.getY() == p_compareTo_1_.getY() ? (this.getZ() == p_compareTo_1_.getZ() ? this.getX() - p_compareTo_1_.getX() : this.getZ() - p_compareTo_1_.getZ()) : this.getY() - p_compareTo_1_.getY();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the X coordinate
|
||||
* @return the X component
|
||||
*/
|
||||
public int getX()
|
||||
{
|
||||
public int getX() {
|
||||
return this.x;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Y coordinate
|
||||
* @return the Y component
|
||||
*/
|
||||
public int getY()
|
||||
{
|
||||
public int getY() {
|
||||
return this.y;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Z coordinate
|
||||
* @return the Z component
|
||||
*/
|
||||
public int getZ()
|
||||
{
|
||||
public int getZ() {
|
||||
return this.z;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the X coordinate as a double
|
||||
* @return the X component as a double
|
||||
*/
|
||||
public double getXD()
|
||||
{
|
||||
public double getXD() {
|
||||
return this.xd;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Y coordinate as a double
|
||||
* @return the Y component as a double
|
||||
*/
|
||||
public double getYD()
|
||||
{
|
||||
public double getYD() {
|
||||
return this.yd;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Z coordinate as a double
|
||||
* @return the Z component as a double
|
||||
*/
|
||||
public double getZD()
|
||||
{
|
||||
public double getZD() {
|
||||
return this.zd;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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)
|
||||
{
|
||||
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());
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
public String toString() {
|
||||
return Objects.toStringHelper(this).add("x", this.getX()).add("y", this.getY()).add("z", this.getZ()).toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -17,10 +17,11 @@ import java.util.List;
|
||||
* Pasted in from 1.9, with the Vec3d constructor removed
|
||||
*/
|
||||
@Immutable
|
||||
public class BlockPos extends Vec3i
|
||||
{
|
||||
public class BlockPos extends Vec3i {
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
/** The BlockPos with all coordinates 0 */
|
||||
/**
|
||||
* The BlockPos with all coordinates 0
|
||||
*/
|
||||
public static final BlockPos ORIGIN = new BlockPos(0, 0, 0);
|
||||
private static final int NUM_X_BITS = 26; //1 + MathHelper.calculateLogBaseTwo(MathHelper.roundUpToPowerOfTwo(30000000)); //Manually calculated because of crash
|
||||
private static final int NUM_Z_BITS = NUM_X_BITS;
|
||||
@@ -31,231 +32,252 @@ public class BlockPos extends Vec3i
|
||||
private static final long Y_MASK = (1L << NUM_Y_BITS) - 1L;
|
||||
private static final long Z_MASK = (1L << NUM_Z_BITS) - 1L;
|
||||
|
||||
public BlockPos(int x, int y, int z)
|
||||
{
|
||||
public BlockPos(int x, int y, int z) {
|
||||
super(x, y, z);
|
||||
}
|
||||
|
||||
public BlockPos(double x, double y, double z)
|
||||
{
|
||||
public BlockPos(double x, double y, double z) {
|
||||
super(x, y, z);
|
||||
}
|
||||
|
||||
public BlockPos(Entity source)
|
||||
{
|
||||
public BlockPos(Entity source) {
|
||||
this(source.posX, source.posY, source.posZ);
|
||||
}
|
||||
|
||||
public BlockPos(Vec3i source)
|
||||
{
|
||||
public BlockPos(Vec3i source) {
|
||||
this(source.getXD(), source.getYD(), source.getZD());
|
||||
}
|
||||
|
||||
/**
|
||||
* 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)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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)
|
||||
{
|
||||
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());
|
||||
}
|
||||
|
||||
/**
|
||||
* Offset this BlockPos 1 block up
|
||||
*
|
||||
* @return the BlockPos one block above
|
||||
*/
|
||||
public BlockPos up()
|
||||
{
|
||||
public BlockPos up() {
|
||||
return this.up(1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Offset this BlockPos n blocks up
|
||||
*
|
||||
* @param n the distance upward
|
||||
* @return the BlockPos n blocks above
|
||||
*/
|
||||
public BlockPos up(double n)
|
||||
{
|
||||
public BlockPos up(double n) {
|
||||
return this.offset(EnumFacing.UP, n);
|
||||
}
|
||||
|
||||
/**
|
||||
* Offset this BlockPos 1 block down
|
||||
*
|
||||
* @return the BlockPos one block below
|
||||
*/
|
||||
public BlockPos down()
|
||||
{
|
||||
public BlockPos down() {
|
||||
return this.down(1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Offset this BlockPos n blocks down
|
||||
*
|
||||
* @param n the distance downward
|
||||
* @return the BlockPos n blocks below
|
||||
*/
|
||||
public BlockPos down(double n)
|
||||
{
|
||||
public BlockPos down(double n) {
|
||||
return this.offset(EnumFacing.DOWN, n);
|
||||
}
|
||||
|
||||
/**
|
||||
* Offset this BlockPos 1 block in northern direction
|
||||
*
|
||||
* @return the BlockPos one block to the north
|
||||
*/
|
||||
public BlockPos north()
|
||||
{
|
||||
public BlockPos north() {
|
||||
return this.north(1);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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)
|
||||
{
|
||||
public BlockPos north(double n) {
|
||||
return this.offset(EnumFacing.NORTH, n);
|
||||
}
|
||||
|
||||
/**
|
||||
* Offset this BlockPos 1 block in southern direction
|
||||
*
|
||||
* @return the BlockPos one block to the south
|
||||
*/
|
||||
public BlockPos south()
|
||||
{
|
||||
public BlockPos south() {
|
||||
return this.south(1);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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)
|
||||
{
|
||||
public BlockPos south(double n) {
|
||||
return this.offset(EnumFacing.SOUTH, n);
|
||||
}
|
||||
|
||||
/**
|
||||
* Offset this BlockPos 1 block in western direction
|
||||
*
|
||||
* @return the BlockPos one block to the west
|
||||
*/
|
||||
public BlockPos west()
|
||||
{
|
||||
public BlockPos west() {
|
||||
return this.west(1);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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)
|
||||
{
|
||||
public BlockPos west(double n) {
|
||||
return this.offset(EnumFacing.WEST, n);
|
||||
}
|
||||
|
||||
/**
|
||||
* Offset this BlockPos 1 block in eastern direction
|
||||
*
|
||||
* @return the BlockPos one block to the east
|
||||
*/
|
||||
public BlockPos east()
|
||||
{
|
||||
public BlockPos east() {
|
||||
return this.east(1);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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)
|
||||
{
|
||||
public BlockPos east(double n) {
|
||||
return this.offset(EnumFacing.EAST, n);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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)
|
||||
{
|
||||
public BlockPos offset(EnumFacing facing) {
|
||||
return this.offset(facing, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate the cross product of this and the given Vector
|
||||
*/
|
||||
public BlockPos crossProduct(Vec3i vec)
|
||||
{
|
||||
public BlockPos crossProduct(Vec3i vec) {
|
||||
return new BlockPos(this.getYD() * vec.getZD() - this.getZD() * vec.getYD(), this.getZD() * vec.getXD() - this.getXD() * vec.getZD(), this.getXD() * vec.getYD() - this.getYD() * vec.getXD());
|
||||
}
|
||||
|
||||
/**
|
||||
* 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;
|
||||
public long toLong() {
|
||||
return ((long) this.getX() & X_MASK) << X_SHIFT | ((long) this.getY() & Y_MASK) << Y_SHIFT | ((long) this.getZ() & Z_MASK) << 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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);
|
||||
int j = (int)(serialized << 64 - Y_SHIFT - NUM_Y_BITS >> 64 - NUM_Y_BITS);
|
||||
int k = (int)(serialized << 64 - NUM_Z_BITS >> 64 - NUM_Z_BITS);
|
||||
public static BlockPos fromLong(long serialized) {
|
||||
int i = (int) (serialized << 64 - X_SHIFT - NUM_X_BITS >> 64 - NUM_X_BITS);
|
||||
int j = (int) (serialized << 64 - Y_SHIFT - NUM_Y_BITS >> 64 - NUM_Y_BITS);
|
||||
int k = (int) (serialized << 64 - NUM_Z_BITS >> 64 - NUM_Z_BITS);
|
||||
return new BlockPos(i, j, k);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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)
|
||||
{
|
||||
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()));
|
||||
final BlockPos blockpos1 = new BlockPos(Math.max(from.getX(), to.getX()), Math.max(from.getY(), to.getY()), Math.max(from.getZ(), to.getZ()));
|
||||
return new Iterable<BlockPos>()
|
||||
{
|
||||
public Iterator<BlockPos> iterator()
|
||||
{
|
||||
return new AbstractIterator<BlockPos>()
|
||||
{
|
||||
return new Iterable<BlockPos>() {
|
||||
public Iterator<BlockPos> iterator() {
|
||||
return new AbstractIterator<BlockPos>() {
|
||||
private BlockPos lastReturned = null;
|
||||
protected BlockPos computeNext()
|
||||
{
|
||||
if (this.lastReturned == null)
|
||||
{
|
||||
|
||||
protected BlockPos computeNext() {
|
||||
if (this.lastReturned == null) {
|
||||
this.lastReturned = blockpos;
|
||||
return this.lastReturned;
|
||||
}
|
||||
else if (this.lastReturned.equals(blockpos1))
|
||||
{
|
||||
return (BlockPos)this.endOfData();
|
||||
}
|
||||
else
|
||||
{
|
||||
} else if (this.lastReturned.equals(blockpos1)) {
|
||||
return (BlockPos) this.endOfData();
|
||||
} else {
|
||||
int i = this.lastReturned.getX();
|
||||
int j = this.lastReturned.getY();
|
||||
int k = this.lastReturned.getZ();
|
||||
|
||||
if (i < blockpos1.getX())
|
||||
{
|
||||
if (i < blockpos1.getX()) {
|
||||
++i;
|
||||
}
|
||||
else if (j < blockpos1.getY())
|
||||
{
|
||||
} else if (j < blockpos1.getY()) {
|
||||
i = blockpos.getX();
|
||||
++j;
|
||||
}
|
||||
else if (k < blockpos1.getZ())
|
||||
{
|
||||
} else if (k < blockpos1.getZ()) {
|
||||
i = blockpos.getX();
|
||||
j = blockpos.getY();
|
||||
++k;
|
||||
@@ -270,27 +292,29 @@ public class BlockPos extends Vec3i
|
||||
};
|
||||
}
|
||||
|
||||
public static class MutableBlockPos extends BlockPos
|
||||
{
|
||||
/** Mutable X Coordinate */
|
||||
public static class MutableBlockPos extends BlockPos {
|
||||
/**
|
||||
* Mutable X Coordinate
|
||||
*/
|
||||
protected int x;
|
||||
/** Mutable Y Coordinate */
|
||||
/**
|
||||
* Mutable Y Coordinate
|
||||
*/
|
||||
protected int y;
|
||||
/** Mutable Z Coordinate */
|
||||
/**
|
||||
* Mutable Z Coordinate
|
||||
*/
|
||||
protected int z;
|
||||
|
||||
public MutableBlockPos()
|
||||
{
|
||||
public MutableBlockPos() {
|
||||
this(0, 0, 0);
|
||||
}
|
||||
|
||||
public MutableBlockPos(BlockPos pos)
|
||||
{
|
||||
public MutableBlockPos(BlockPos pos) {
|
||||
this(pos.getX(), pos.getY(), pos.getZ());
|
||||
}
|
||||
|
||||
public MutableBlockPos(int x_, int y_, int z_)
|
||||
{
|
||||
public MutableBlockPos(int x_, int y_, int z_) {
|
||||
super(0, 0, 0);
|
||||
this.x = x_;
|
||||
this.y = y_;
|
||||
@@ -300,60 +324,56 @@ public class BlockPos extends Vec3i
|
||||
/**
|
||||
* Gets the X coordinate.
|
||||
*/
|
||||
public int getX()
|
||||
{
|
||||
public int getX() {
|
||||
return this.x;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the Y coordinate.
|
||||
*/
|
||||
public int getY()
|
||||
{
|
||||
public int getY() {
|
||||
return this.y;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the Z coordinate.
|
||||
*/
|
||||
public int getZ()
|
||||
{
|
||||
public int getZ() {
|
||||
return this.z;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
|
||||
public BlockPos.MutableBlockPos setPos(double p_189532_1_, double p_189532_3_, double p_189532_5_)
|
||||
{
|
||||
public BlockPos.MutableBlockPos setPos(double p_189532_1_, double p_189532_3_, double p_189532_5_) {
|
||||
return this.setPos(MathHelper.floor_double(p_189532_1_), MathHelper.floor_double(p_189532_3_), MathHelper.floor_double(p_189532_5_));
|
||||
}
|
||||
|
||||
public BlockPos.MutableBlockPos setPos(Vec3i p_189533_1_)
|
||||
{
|
||||
public BlockPos.MutableBlockPos setPos(Vec3i p_189533_1_) {
|
||||
return this.setPos(p_189533_1_.getX(), p_189533_1_.getY(), p_189533_1_.getZ());
|
||||
}
|
||||
|
||||
public BlockPos.MutableBlockPos move(EnumFacing p_189536_1_)
|
||||
{
|
||||
public BlockPos.MutableBlockPos move(EnumFacing p_189536_1_) {
|
||||
return this.move(p_189536_1_, 1);
|
||||
}
|
||||
|
||||
public BlockPos.MutableBlockPos move(EnumFacing p_189534_1_, int p_189534_2_)
|
||||
{
|
||||
public BlockPos.MutableBlockPos move(EnumFacing p_189534_1_, int p_189534_2_) {
|
||||
return this.setPos(this.x + p_189534_1_.getFrontOffsetX() * p_189534_2_, this.y + p_189534_1_.getFrontOffsetY() * p_189534_2_, this.z + p_189534_1_.getFrontOffsetZ() * p_189534_2_);
|
||||
}
|
||||
|
||||
public void setY(int yIn)
|
||||
{
|
||||
public void setY(int yIn) {
|
||||
this.y = yIn;
|
||||
}
|
||||
|
||||
@@ -362,43 +382,36 @@ 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()
|
||||
{
|
||||
public BlockPos toImmutable() {
|
||||
return new BlockPos(this);
|
||||
}
|
||||
}
|
||||
|
||||
public static final class PooledMutableBlockPos extends BlockPos.MutableBlockPos
|
||||
{
|
||||
public static final class PooledMutableBlockPos extends BlockPos.MutableBlockPos {
|
||||
private boolean released;
|
||||
private static final List<BlockPos.PooledMutableBlockPos> POOL = Lists.<BlockPos.PooledMutableBlockPos>newArrayList();
|
||||
|
||||
private PooledMutableBlockPos(int xIn, int yIn, int zIn)
|
||||
{
|
||||
private PooledMutableBlockPos(int xIn, int yIn, int zIn) {
|
||||
super(xIn, yIn, zIn);
|
||||
}
|
||||
|
||||
public static BlockPos.PooledMutableBlockPos retain()
|
||||
{
|
||||
public static BlockPos.PooledMutableBlockPos retain() {
|
||||
return retain(0, 0, 0);
|
||||
}
|
||||
|
||||
public static BlockPos.PooledMutableBlockPos retain(double xIn, double yIn, double zIn)
|
||||
{
|
||||
public static BlockPos.PooledMutableBlockPos retain(double xIn, double yIn, double zIn) {
|
||||
return retain(MathHelper.floor_double(xIn), MathHelper.floor_double(yIn), MathHelper.floor_double(zIn));
|
||||
}
|
||||
|
||||
public static BlockPos.PooledMutableBlockPos retain(int xIn, int yIn, int zIn)
|
||||
{
|
||||
synchronized (POOL)
|
||||
{
|
||||
if (!POOL.isEmpty())
|
||||
{
|
||||
BlockPos.PooledMutableBlockPos blockpos$pooledmutableblockpos = (BlockPos.PooledMutableBlockPos)POOL.remove(POOL.size() - 1);
|
||||
public static BlockPos.PooledMutableBlockPos retain(int xIn, int yIn, int zIn) {
|
||||
synchronized (POOL) {
|
||||
if (!POOL.isEmpty()) {
|
||||
BlockPos.PooledMutableBlockPos blockpos$pooledmutableblockpos = (BlockPos.PooledMutableBlockPos) POOL.remove(POOL.size() - 1);
|
||||
|
||||
if (blockpos$pooledmutableblockpos != null && blockpos$pooledmutableblockpos.released)
|
||||
{
|
||||
if (blockpos$pooledmutableblockpos != null && blockpos$pooledmutableblockpos.released) {
|
||||
blockpos$pooledmutableblockpos.released = false;
|
||||
blockpos$pooledmutableblockpos.set(xIn, yIn, zIn);
|
||||
return blockpos$pooledmutableblockpos;
|
||||
@@ -409,12 +422,9 @@ public class BlockPos extends Vec3i
|
||||
return new BlockPos.PooledMutableBlockPos(xIn, yIn, zIn);
|
||||
}
|
||||
|
||||
public void release()
|
||||
{
|
||||
synchronized (POOL)
|
||||
{
|
||||
if (POOL.size() < 100)
|
||||
{
|
||||
public void release() {
|
||||
synchronized (POOL) {
|
||||
if (POOL.size() < 100) {
|
||||
POOL.add(this);
|
||||
}
|
||||
|
||||
@@ -422,35 +432,29 @@ public class BlockPos extends Vec3i
|
||||
}
|
||||
}
|
||||
|
||||
public BlockPos.PooledMutableBlockPos set(int xIn, int yIn, int zIn)
|
||||
{
|
||||
if (this.released)
|
||||
{
|
||||
public BlockPos.PooledMutableBlockPos set(int xIn, int yIn, int zIn) {
|
||||
if (this.released) {
|
||||
BlockPos.LOGGER.error("PooledMutableBlockPosition modified after it was released.", new Throwable());
|
||||
this.released = false;
|
||||
}
|
||||
|
||||
return (BlockPos.PooledMutableBlockPos)super.setPos(xIn, yIn, zIn);
|
||||
return (BlockPos.PooledMutableBlockPos) super.setPos(xIn, yIn, zIn);
|
||||
}
|
||||
|
||||
public BlockPos.PooledMutableBlockPos set(double xIn, double yIn, double zIn)
|
||||
{
|
||||
return (BlockPos.PooledMutableBlockPos)super.setPos(xIn, yIn, zIn);
|
||||
public BlockPos.PooledMutableBlockPos set(double xIn, double yIn, double zIn) {
|
||||
return (BlockPos.PooledMutableBlockPos) super.setPos(xIn, yIn, zIn);
|
||||
}
|
||||
|
||||
public BlockPos.PooledMutableBlockPos set(Vec3i vec)
|
||||
{
|
||||
return (BlockPos.PooledMutableBlockPos)super.setPos(vec);
|
||||
public BlockPos.PooledMutableBlockPos set(Vec3i vec) {
|
||||
return (BlockPos.PooledMutableBlockPos) super.setPos(vec);
|
||||
}
|
||||
|
||||
public BlockPos.PooledMutableBlockPos offsetMutable(EnumFacing facing)
|
||||
{
|
||||
return (BlockPos.PooledMutableBlockPos)super.move(facing);
|
||||
public BlockPos.PooledMutableBlockPos offsetMutable(EnumFacing facing) {
|
||||
return (BlockPos.PooledMutableBlockPos) super.move(facing);
|
||||
}
|
||||
|
||||
public BlockPos.PooledMutableBlockPos movePos(EnumFacing p_189538_1_, int p_189538_2_)
|
||||
{
|
||||
return (BlockPos.PooledMutableBlockPos)super.move(p_189538_1_, p_189538_2_);
|
||||
public BlockPos.PooledMutableBlockPos movePos(EnumFacing p_189538_1_, int p_189538_2_) {
|
||||
return (BlockPos.PooledMutableBlockPos) super.move(p_189538_1_, p_189538_2_);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,8 @@ public abstract class AbstractNpcAPI {
|
||||
|
||||
/**
|
||||
* Tempdata gets cleared when the server restarts. All worlds share the same temp data.
|
||||
* @param key The key for the data stored
|
||||
*
|
||||
* @param key The key for the data stored
|
||||
* @param value The data stored
|
||||
*/
|
||||
public abstract void setTempData(String key, Object value);
|
||||
@@ -76,7 +77,8 @@ public abstract class AbstractNpcAPI {
|
||||
|
||||
/**
|
||||
* Stored data persists through world restart. Unlike tempdata only Strings and Numbers can be saved
|
||||
* @param key The key for the data stored
|
||||
*
|
||||
* @param key The key for the data stored
|
||||
* @param value The data stored. This data can be either a Number or a String. Other data is not stored
|
||||
*/
|
||||
public abstract void setStoredData(String key, Object value);
|
||||
@@ -109,7 +111,7 @@ public abstract class AbstractNpcAPI {
|
||||
|
||||
public abstract boolean hasGlobalObject(String key);
|
||||
|
||||
public abstract HashMap<String,Object> getEngineObjects();
|
||||
public abstract HashMap<String, Object> getEngineObjects();
|
||||
|
||||
public abstract long sizeOfObject(Object obj);
|
||||
|
||||
@@ -151,6 +153,36 @@ public abstract class AbstractNpcAPI {
|
||||
|
||||
public abstract IAnimationHandler getAnimations();
|
||||
|
||||
public abstract ILinkedItemHandler getLinkedItems();
|
||||
|
||||
/**
|
||||
* Get the script hook handler for registering custom hooks.
|
||||
* Addon mods can use this to register hooks that will appear in script editor GUIs.
|
||||
*
|
||||
* @return The script hook handler
|
||||
*/
|
||||
public abstract IScriptHookHandler getScriptHooks();
|
||||
|
||||
public abstract IAbilityHandler getAbilities();
|
||||
|
||||
public abstract ITelegraphHandler getTelegraphs();
|
||||
|
||||
/**
|
||||
* Get the auction handler for managing auctions via scripts.
|
||||
*
|
||||
* @return The auction handler, or null if auctions are disabled
|
||||
*/
|
||||
public abstract IAuctionHandler getAuctions();
|
||||
|
||||
/**
|
||||
* Create a telegraph directly.
|
||||
* Convenience method equivalent to getTelegraphs().create(type).
|
||||
*
|
||||
* @param type Type name: "circle", "ring", "line", "cone", "point"
|
||||
* @return A new telegraph configuration
|
||||
*/
|
||||
public abstract ITelegraph createTelegraph(String type);
|
||||
|
||||
public abstract String[] getAllBiomeNames();
|
||||
|
||||
public abstract ICustomNpc<?> createNPC(IWorld var1);
|
||||
@@ -158,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);
|
||||
|
||||
@@ -195,8 +233,8 @@ public abstract class AbstractNpcAPI {
|
||||
* Forms a box with corners as the input IPos parameters, and returns all
|
||||
* points inside the box as a list of IPos vectors.
|
||||
*
|
||||
* @param from The starting IPos vector, first corner of the box.
|
||||
* @param to The ending IPos vector, opposite corner of the box.
|
||||
* @param from The starting IPos vector, first corner of the box.
|
||||
* @param to The ending IPos vector, opposite corner of the box.
|
||||
* @param sortByDistance Sorts the list by distance from the "from" IPos parameter.
|
||||
* @return The list of all IPos vectors inside the box.
|
||||
*/
|
||||
@@ -211,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);
|
||||
@@ -225,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);
|
||||
@@ -244,6 +285,8 @@ public abstract class AbstractNpcAPI {
|
||||
|
||||
public abstract IDamageSource getIDamageSource(IEntity<?> entity);
|
||||
|
||||
public abstract IEnergyHandler getEnergyHandler();
|
||||
|
||||
public abstract EventBus events();
|
||||
|
||||
public abstract File getGlobalDir();
|
||||
@@ -287,10 +330,11 @@ public abstract class AbstractNpcAPI {
|
||||
* 7: Aztec
|
||||
* 8: CustomNPCs Classic
|
||||
* 9: Spanish
|
||||
* @param gender The gender of the name:
|
||||
* @param gender The gender of the name:
|
||||
* 0: Random
|
||||
* 1: Male
|
||||
* 2: Female
|
||||
* @return a random name
|
||||
*/
|
||||
public abstract String getRandomName(int dictionary, int gender);
|
||||
|
||||
@@ -323,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);
|
||||
@@ -364,9 +409,9 @@ public abstract class AbstractNpcAPI {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param id The id of the custom GUI.
|
||||
* @param width The width of the GUI in pixels.
|
||||
* @param height The height of the GUI in pixels.
|
||||
* @param id The id of the custom GUI.
|
||||
* @param width The width of the GUI in pixels.
|
||||
* @param height The height of the GUI in pixels.
|
||||
* @param pauseGame Whether the GUI pauses the game or not.
|
||||
* @return A new ICustomGui object with the given attributes.
|
||||
*/
|
||||
@@ -374,12 +419,14 @@ public abstract class AbstractNpcAPI {
|
||||
|
||||
/**
|
||||
*
|
||||
* @return A new ICustomOverlay overlay object with the given ID.
|
||||
* @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);
|
||||
|
||||
@@ -19,7 +19,7 @@ public interface IBlock {
|
||||
/**
|
||||
* Moves the block to a new position in the given world. The old position is replaced with air.
|
||||
*
|
||||
* @param pos The new position of the block
|
||||
* @param pos The new position of the block
|
||||
* @param world The destination world of the block
|
||||
* @return Whether the block was successfully placed
|
||||
*/
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
@@ -31,9 +31,9 @@ public interface IContainer {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param itemStack The item stack to be searched in the container
|
||||
* @param itemStack The item stack to be searched in the container
|
||||
* @param ignoreDamage Whether damage should be ignored when searching
|
||||
* @param ignoreNBT Whether NBT values should be ignored when searching
|
||||
* @param ignoreNBT Whether NBT values should be ignored when searching
|
||||
* @return The amount of the item stack found, based on the flags given above.
|
||||
*/
|
||||
int count(IItemStack itemStack, boolean ignoreDamage, boolean ignoreNBT);
|
||||
|
||||
@@ -0,0 +1,136 @@
|
||||
package noppes.npcs.api;
|
||||
|
||||
import noppes.npcs.api.entity.*;
|
||||
import noppes.npcs.api.entity.IEnergyExplosion;
|
||||
|
||||
/**
|
||||
* Central controller for creating energy entities and routing energy damage.
|
||||
* Access via API.getEnergyController().
|
||||
*
|
||||
* All factory methods create entities that are NOT spawned in the world.
|
||||
* Configure the entity, then call fire() (projectiles) or spawn() (zones/sweepers/panels)
|
||||
* to place it in the world.
|
||||
*/
|
||||
public interface IEnergyHandler {
|
||||
|
||||
// ==================== PROJECTILE CREATION ====================
|
||||
|
||||
/**
|
||||
* 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);
|
||||
|
||||
// ==================== ZONE CREATION ====================
|
||||
|
||||
/**
|
||||
* 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);
|
||||
|
||||
// ==================== SWEEPER CREATION ====================
|
||||
|
||||
/**
|
||||
* 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);
|
||||
|
||||
// ==================== PANEL CREATION ====================
|
||||
|
||||
/**
|
||||
* 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);
|
||||
|
||||
// ==================== EXPLOSION CREATION ====================
|
||||
|
||||
/**
|
||||
* Create an energy explosion entity. Not spawned until spawn() is called.
|
||||
* Visual-only by default. Set damage > 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);
|
||||
}
|
||||
@@ -6,13 +6,13 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
* A scripted data representation of an MC NBTTagCompound object. Using these functions modifies the compound tag
|
||||
* associated with this object. Any changes made to the compound tag are made directly to its "tagMap" attribute,
|
||||
* minimizing the impact of setting/getting NBT data with this object on performance.
|
||||
*
|
||||
* <p>
|
||||
* Compound tags, unlike list tags, can contain multiple types of NBT tag types. Compound tags can even
|
||||
* contain compound tags inside them, and if that compound tag is accessed, an object like this one will also be returned!
|
||||
*
|
||||
* <p>
|
||||
* Every tag inside a compound tag has a -unique- "key". If you try to put another tag of the same key inside the
|
||||
* compound tag, it will replace the previous tag.
|
||||
*
|
||||
* <p>
|
||||
* The types and their type as an integer are as follows:
|
||||
* 1: Byte
|
||||
* 2: Short
|
||||
@@ -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,19 +84,23 @@ 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);
|
||||
|
||||
/**
|
||||
* Adds a new tag list to the compound tag with the given key.
|
||||
*
|
||||
* @param key The key for the list tag
|
||||
* @param key The key for the list tag
|
||||
* @param value The list of objects to be in the list. The type of the first element in this list becomes the tag
|
||||
* list's type, and if later objects are not of this type, they will not be added.
|
||||
*/
|
||||
@@ -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);
|
||||
|
||||
@@ -5,14 +5,14 @@ import noppes.npcs.api.entity.IEntity;
|
||||
/**
|
||||
* A particle that can be spawned in the world, complete with translation, scale, rotate, and color transformations.
|
||||
* (CNPC+ original!)
|
||||
*
|
||||
* <p>
|
||||
* To create a particle object:
|
||||
* API.createParticle(directory);
|
||||
* Then modify its attributes as you please, and call the particle's spawn functions to see it in the world.
|
||||
*
|
||||
* <p>
|
||||
* Spawning this particle in the world sends a hefty packet with all its data to the client. The particle is then
|
||||
* rendered with a custom renderer based on all the given attributes.
|
||||
*
|
||||
* <p>
|
||||
* If a particle appears to not appear at first, try increasing its scale or changing its position. The entity it's
|
||||
* being spawned on or a block in the world may be blocking it.
|
||||
*
|
||||
@@ -34,9 +34,9 @@ public interface IParticle {
|
||||
/**
|
||||
*
|
||||
* @param world Spawns the particle in the given world, at a position determined by the input parameters.
|
||||
* @param x The X position the particle will spawn in the world.
|
||||
* @param y The Y position the particle will spawn in the world.
|
||||
* @param z The Z position the particle will spawn in the world.
|
||||
* @param x The X position the particle will spawn in the world.
|
||||
* @param y The Y position the particle will spawn in the world.
|
||||
* @param z The Z position the particle will spawn in the world.
|
||||
*/
|
||||
void spawn(IWorld world, double x, double y, double z);
|
||||
|
||||
@@ -54,9 +54,11 @@ public interface IParticle {
|
||||
* @param glows If true, this particle ignores all lighting and always renders with full brightness.
|
||||
*/
|
||||
void setGlows(boolean glows);
|
||||
|
||||
boolean getGlows();
|
||||
|
||||
void setNoClip(boolean noClip);
|
||||
|
||||
boolean getNoClip();
|
||||
|
||||
/**
|
||||
@@ -64,6 +66,7 @@ public interface IParticle {
|
||||
* @param facePlayer Whether the particle is always facing the player's camera. If this is disabled, the particle will appear to be laying flat face down on the ground if its rotation is unchanged.
|
||||
*/
|
||||
void setFacePlayer(boolean facePlayer);
|
||||
|
||||
boolean getFacePlayer();
|
||||
|
||||
/**
|
||||
@@ -71,6 +74,7 @@ public interface IParticle {
|
||||
* @param directory The directory of this particle's texture. This can be any texture in a resource pack or mod, and even a URL!
|
||||
*/
|
||||
void setDirectory(String directory);
|
||||
|
||||
String getDirectory();
|
||||
|
||||
/**
|
||||
@@ -78,6 +82,7 @@ public interface IParticle {
|
||||
* @param amount The amount of multiples of this particle to spawn in the world. Not too good looking if used, but has some edge cases where it's alright.
|
||||
*/
|
||||
void setAmount(int amount);
|
||||
|
||||
int getAmount();
|
||||
|
||||
/**
|
||||
@@ -85,45 +90,56 @@ public interface IParticle {
|
||||
* @param maxAge The maximum age this particle will be around for, in MC ticks.
|
||||
*/
|
||||
void setMaxAge(int maxAge);
|
||||
|
||||
int getMaxAge();
|
||||
|
||||
/**
|
||||
* The width and height of the particle's texture you want to render in pixels. Anything more gets cut off.
|
||||
* @param width The width of the particle's texture, in pixels.
|
||||
*
|
||||
* @param width The width of the particle's texture, in pixels.
|
||||
* @param height The height of the particle's texture, in pixels.
|
||||
*/
|
||||
void setSize(int width, int height);
|
||||
|
||||
int getWidth();
|
||||
|
||||
int getHeight();
|
||||
|
||||
/**
|
||||
* The horizontal and vertical offset of the particle's texture from the top-left, starts rendering the particle at this point.
|
||||
* The horizontal and vertical offset of the particle's texture from the top-left, starts rendering the particle at this point.
|
||||
*
|
||||
* @param offsetX The horizontal offset, in pixels (u).
|
||||
* @param offsetY The vertical offset, in pixels (v).
|
||||
*/
|
||||
void setOffset(int offsetX, int offsetY);
|
||||
|
||||
int getOffsetX();
|
||||
|
||||
int getOffsetY();
|
||||
|
||||
/**
|
||||
* Enables animation on the particle. Must set a custom width and height first using the setSize(width,height) function.
|
||||
* Every frame of animation the particle goes through should be saved on a single image file.
|
||||
*
|
||||
* <p>
|
||||
* The renderer will read the frames of animation based on the given width and height of the particle, starting from the given X and Y offsets.
|
||||
* The renderer then goes rightwards (width) pixels for every frame. Once it can't go rightwards anymore,
|
||||
* the animation goes down (height) pixels, and once again keeps going rightwards if it has to.
|
||||
*
|
||||
* <p>
|
||||
* If the animation loops, once there is nowhere downward to go, the animation will start over at the X and Y offset.
|
||||
*
|
||||
* @param animRate The frame rate of the particle's animation, in MC ticks. (20 ticks = 1 second)
|
||||
* @param animLoop Whether the animation loops or not.
|
||||
* @param animRate The frame rate of the particle's animation, in MC ticks. (20 ticks = 1 second)
|
||||
* @param animLoop Whether the animation loops or not.
|
||||
* @param animStart The amount of ticks before the particle starts animating.
|
||||
* @param animEnd The amount of ticks the particle is around for before it stops animating.
|
||||
* @param animEnd The amount of ticks the particle is around for before it stops animating.
|
||||
*/
|
||||
void setAnim(int animRate, boolean animLoop, int animStart, int animEnd);
|
||||
|
||||
int getAnimRate();
|
||||
|
||||
boolean getAnimLoop();
|
||||
|
||||
int getAnimStart();
|
||||
|
||||
int getAnimEnd();
|
||||
|
||||
/**
|
||||
@@ -133,94 +149,126 @@ public interface IParticle {
|
||||
* @param z The Z position from the particle's origin the particle will spawn at.
|
||||
*/
|
||||
void setPosition(double x, double y, double z);
|
||||
|
||||
double getX();
|
||||
|
||||
double getY();
|
||||
|
||||
double getZ();
|
||||
|
||||
void setPosition(IPos pos);
|
||||
|
||||
void getPos();
|
||||
|
||||
void setMotion(double motionX, double motionY, double motionZ, float gravity);
|
||||
|
||||
double getMotionX();
|
||||
|
||||
double getMotionY();
|
||||
|
||||
double getMotionZ();
|
||||
|
||||
float getGravity();
|
||||
|
||||
/**
|
||||
*
|
||||
* @param HEXColor The starting HEX color of the particle.
|
||||
* @param HEXColor2 The ending HEX color of the particle.
|
||||
* @param HEXColorRate The rate of interpolation between the two HEX colors.
|
||||
* @param HEXColor The starting HEX color of the particle.
|
||||
* @param HEXColor2 The ending HEX color of the particle.
|
||||
* @param HEXColorRate The rate of interpolation between the two HEX colors.
|
||||
* @param HEXColorStart The amount of ticks the particle is around for before its colors begin interpolating between HEXColor and HEXColor2.
|
||||
*/
|
||||
void setHEXColor(int HEXColor, int HEXColor2, float HEXColorRate, int HEXColorStart);
|
||||
|
||||
int getHEXColor1();
|
||||
|
||||
int getHEXColor2();
|
||||
|
||||
float getHEXColorRate();
|
||||
|
||||
int getHEXColorStart();
|
||||
|
||||
/**
|
||||
*
|
||||
* @param alpha1 The starting transparency of the particle.
|
||||
* @param alpha2 The ending transparency of the particle.
|
||||
* @param alphaRate The rate of interpolation between the two transparency values.
|
||||
* @param alpha1 The starting transparency of the particle.
|
||||
* @param alpha2 The ending transparency of the particle.
|
||||
* @param alphaRate The rate of interpolation between the two transparency values.
|
||||
* @param alphaRateStart The amount of ticks the particle is around for before its colors begin interpolating between alpha1 and alpha2.
|
||||
*/
|
||||
void setAlpha(float alpha1, float alpha2, float alphaRate, int alphaRateStart);
|
||||
|
||||
float getAlpha1();
|
||||
|
||||
float getAlpha2();
|
||||
|
||||
float getAlphaRate();
|
||||
|
||||
int getAlphaRateStart();
|
||||
|
||||
/**
|
||||
*
|
||||
* @param scale1 The starting scale/size of the particle.
|
||||
* @param scale2 The ending scale/size of the particle.
|
||||
* @param scaleRate The rate of interpolation between the two scale values.
|
||||
* @param scale1 The starting scale/size of the particle.
|
||||
* @param scale2 The ending scale/size of the particle.
|
||||
* @param scaleRate The rate of interpolation between the two scale values.
|
||||
* @param scaleRateStart The amount of ticks the particle is around for before its colors begin interpolating between scale1 and scale2.
|
||||
*/
|
||||
void setScale(float scale1, float scale2, float scaleRate, int scaleRateStart);
|
||||
|
||||
void setScaleX(float scale1, float scale2, float scaleRate, int scaleRateStart);
|
||||
|
||||
float getScaleX1();
|
||||
|
||||
float getScaleX2();
|
||||
|
||||
float getScaleXRate();
|
||||
|
||||
int getScaleXRateStart();
|
||||
|
||||
void setScaleY(float scale1, float scale2, float scaleRate, int scaleRateStart);
|
||||
|
||||
float getScaleY1();
|
||||
|
||||
float getScaleY2();
|
||||
|
||||
float getScaleYRate();
|
||||
|
||||
int getScaleYRateStart();
|
||||
|
||||
/**
|
||||
* Enables rotation about the X axis.
|
||||
* If the particle is set to always face the player, this axis is a constant horizontal line on the player's camera.
|
||||
*
|
||||
* @param rotationX1 The starting X rotation of the particle.
|
||||
* @param rotationX2 The ending X rotation of the particle.
|
||||
* @param rotationXRate The rate of interpolation between the two X rotation values.
|
||||
* @param rotationX1 The starting X rotation of the particle.
|
||||
* @param rotationX2 The ending X rotation of the particle.
|
||||
* @param rotationXRate The rate of interpolation between the two X rotation values.
|
||||
* @param rotationXRateStart The amount of ticks the particle is around for before its colors begin interpolating between rotationX1 and rotationX2.
|
||||
*/
|
||||
void setRotationX(float rotationX1, float rotationX2, float rotationXRate, int rotationXRateStart);
|
||||
|
||||
float getRotationX1();
|
||||
|
||||
float getRotationX2();
|
||||
|
||||
float getRotationXRate();
|
||||
|
||||
int getRotationXRateStart();
|
||||
|
||||
/**
|
||||
* Enables rotation about the Y axis.
|
||||
* If the particle is set to always face the player, this axis is a constant vertical line on the player's camera.
|
||||
*
|
||||
* @param rotationY1 The starting Y rotation of the particle.
|
||||
* @param rotationY2 The ending Y rotation of the particle.
|
||||
* @param rotationYRate The rate of interpolation between the two Y rotation values.
|
||||
* @param rotationY1 The starting Y rotation of the particle.
|
||||
* @param rotationY2 The ending Y rotation of the particle.
|
||||
* @param rotationYRate The rate of interpolation between the two Y rotation values.
|
||||
* @param rotationYRateStart The amount of ticks the particle is around for before its colors begin interpolating between rotationY1 and rotationY2.
|
||||
*/
|
||||
void setRotationY(float rotationY1, float rotationY2, float rotationYRate, int rotationYRateStart);
|
||||
|
||||
float getRotationY1();
|
||||
|
||||
float getRotationY2();
|
||||
|
||||
float getRotationYRate();
|
||||
|
||||
int getRotationYRateStart();
|
||||
|
||||
/**
|
||||
@@ -228,15 +276,19 @@ public interface IParticle {
|
||||
* If the particle is set to always face the player, this axis is a constant line going into the player's camera.
|
||||
* You'll be using this one most often if the particle is set to face the player.
|
||||
*
|
||||
* @param rotationZ1 The starting Z rotation of the particle.
|
||||
* @param rotationZ2 The ending Z rotation of the particle.
|
||||
* @param rotationZRate The rate of interpolation between the two Z rotation values.
|
||||
* @param rotationZ1 The starting Z rotation of the particle.
|
||||
* @param rotationZ2 The ending Z rotation of the particle.
|
||||
* @param rotationZRate The rate of interpolation between the two Z rotation values.
|
||||
* @param rotationZRateStart The amount of ticks the particle is around for before its colors begin interpolating between rotationZ1 and rotationZ2.
|
||||
*/
|
||||
void setRotationZ(float rotationZ1, float rotationZ2, float rotationZRate, int rotationZRateStart);
|
||||
|
||||
float getRotationZ1();
|
||||
|
||||
float getRotationZ2();
|
||||
|
||||
float getRotationZRate();
|
||||
|
||||
int getRotationZRateStart();
|
||||
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
@@ -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();
|
||||
|
||||
@@ -137,7 +143,6 @@ public interface IPos {
|
||||
/**
|
||||
* Returns a normalized vector of this block's position, calculated by:
|
||||
*
|
||||
*
|
||||
* @return The normalized vector of this block position.
|
||||
*/
|
||||
IPos normalize();
|
||||
@@ -147,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);
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
@@ -3,61 +3,89 @@ package noppes.npcs.api;
|
||||
/**
|
||||
* A skin overlay object for both NPCs and players. Several skin overlays at a time can be layered on top of each other.
|
||||
* In an NPC's case, the old overlay texture is now the skin overlay with ID 0.
|
||||
*
|
||||
* <p>
|
||||
* Modifying these attributes, an overlay can be made to look like a powered creeper effect, just a new skin, or both!
|
||||
*/
|
||||
public interface ISkinOverlay {
|
||||
/**
|
||||
* Sets the directory texture of the overlay. Does not support URLs.
|
||||
* @param texture the texture path
|
||||
*/
|
||||
void setTexture(String texture);
|
||||
|
||||
String getTexture();
|
||||
|
||||
/**
|
||||
* Sets whether this overlay glows in the dark or not.
|
||||
* @param glow whether to glow
|
||||
*/
|
||||
void setGlow(boolean glow);
|
||||
|
||||
boolean getGlow();
|
||||
|
||||
/**
|
||||
* Sets whether this overlay blends on top of bottom textures at any alpha value.
|
||||
* @param blend whether to blend
|
||||
*/
|
||||
void setBlend(boolean blend);
|
||||
|
||||
boolean getBlend();
|
||||
|
||||
/**
|
||||
* Sets the transparency of the overlay, from 0 to 1.
|
||||
* @param alpha the alpha value
|
||||
*/
|
||||
void setAlpha(float alpha);
|
||||
|
||||
float getAlpha();
|
||||
|
||||
/**
|
||||
* 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);
|
||||
|
||||
float getSize();
|
||||
|
||||
void setColor(int color);
|
||||
|
||||
int getColor();
|
||||
|
||||
/**
|
||||
* 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);
|
||||
|
||||
float getTextureScaleX();
|
||||
|
||||
float getTextureScaleY();
|
||||
|
||||
/**
|
||||
* 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);
|
||||
|
||||
float getSpeedX();
|
||||
|
||||
float getSpeedY();
|
||||
|
||||
/**
|
||||
* 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);
|
||||
|
||||
float getOffsetX();
|
||||
|
||||
float getOffsetY();
|
||||
|
||||
float getOffsetZ();
|
||||
}
|
||||
@@ -0,0 +1,247 @@
|
||||
package noppes.npcs.api;
|
||||
|
||||
import noppes.npcs.api.entity.IEntity;
|
||||
|
||||
/**
|
||||
* A telegraph is a visual warning indicator that displays on the ground.
|
||||
* Telegraphs are commonly used to warn players of incoming attacks or mark areas of effect.
|
||||
* <p>
|
||||
* To create a telegraph:
|
||||
* <pre>
|
||||
* var telegraph = API.getTelegraphs().createCircle(5.0);
|
||||
* telegraph.setDuration(60); // 3 seconds
|
||||
* telegraph.setColor(0x80FF0000); // Semi-transparent red
|
||||
* var instance = telegraph.spawn(world, x, y, z);
|
||||
* </pre>
|
||||
* <p>
|
||||
* Telegraph types:
|
||||
* <ul>
|
||||
* <li>CIRCLE - A filled circle with a radius</li>
|
||||
* <li>RING - A ring with inner and outer radius</li>
|
||||
* <li>LINE - A rectangular line in a direction</li>
|
||||
* <li>CONE - A cone/arc shape</li>
|
||||
* <li>SQUARE - A square shape</li>
|
||||
* <li>POINT - A small point marker</li>
|
||||
* </ul>
|
||||
*/
|
||||
public interface ITelegraph {
|
||||
|
||||
// ==========================================================================
|
||||
// TYPE
|
||||
// ==========================================================================
|
||||
|
||||
/**
|
||||
* Get the telegraph type.
|
||||
*
|
||||
* @return Type name: "CIRCLE", "RING", "LINE", "CONE", "SQUARE", or "POINT"
|
||||
*/
|
||||
String getType();
|
||||
|
||||
/**
|
||||
* Set the telegraph type.
|
||||
*
|
||||
* @param type Type name: "circle", "ring", "line", "cone", "square", or "point" (case insensitive)
|
||||
*/
|
||||
void setType(String type);
|
||||
|
||||
// ==========================================================================
|
||||
// SHAPE PARAMETERS
|
||||
// ==========================================================================
|
||||
|
||||
/**
|
||||
* Get the radius (for CIRCLE, SQUARE and RING types).
|
||||
* @return the circle/ring radius in blocks
|
||||
*/
|
||||
float getRadius();
|
||||
|
||||
/**
|
||||
* Set the radius (for CIRCLE, SQUARE 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.
|
||||
*
|
||||
* @param world The world to spawn in
|
||||
* @param x X position
|
||||
* @param y Y position
|
||||
* @param z Z position
|
||||
* @return The spawned telegraph instance
|
||||
*/
|
||||
ITelegraphInstance spawn(IWorld world, double x, double y, double z);
|
||||
|
||||
/**
|
||||
* Spawn this telegraph at a position with rotation.
|
||||
*
|
||||
* @param world The world to spawn in
|
||||
* @param x X position
|
||||
* @param y Y position
|
||||
* @param z Z position
|
||||
* @param yaw Rotation yaw (for directional telegraphs like LINE/CONE)
|
||||
* @return The spawned telegraph instance
|
||||
*/
|
||||
ITelegraphInstance spawn(IWorld world, double x, double y, double z, float yaw);
|
||||
|
||||
/**
|
||||
* Spawn this telegraph following an entity.
|
||||
* The telegraph will update its position to follow the entity.
|
||||
*
|
||||
* @param entity The entity to follow
|
||||
* @return The spawned telegraph instance
|
||||
*/
|
||||
ITelegraphInstance spawn(IEntity entity);
|
||||
|
||||
/**
|
||||
* Spawn this telegraph following an entity with rotation.
|
||||
*
|
||||
* @param entity The entity to follow
|
||||
* @param yaw Rotation yaw
|
||||
* @return The spawned telegraph instance
|
||||
*/
|
||||
ITelegraphInstance spawn(IEntity entity, float yaw);
|
||||
}
|
||||
@@ -0,0 +1,128 @@
|
||||
package noppes.npcs.api;
|
||||
|
||||
import noppes.npcs.api.entity.IEntity;
|
||||
|
||||
/**
|
||||
* A runtime instance of an active telegraph in the world.
|
||||
* Represents a spawned telegraph with position, timing, and control methods.
|
||||
* <p>
|
||||
* Instances are created when you call spawn() on an ITelegraph:
|
||||
* <pre>
|
||||
* var telegraph = API.getTelegraphs().createCircle(5.0);
|
||||
* var instance = telegraph.spawn(world, x, y, z);
|
||||
*
|
||||
* // Later...
|
||||
* instance.remove(); // Remove the telegraph early
|
||||
* </pre>
|
||||
*/
|
||||
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);
|
||||
|
||||
/**
|
||||
* Stop following any entity and fix the current position.
|
||||
*/
|
||||
void stopFollowing();
|
||||
|
||||
/**
|
||||
* 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.
|
||||
* Sends a removal packet to all clients tracking it.
|
||||
*/
|
||||
void remove();
|
||||
|
||||
/**
|
||||
* Lock the telegraph at its current position.
|
||||
* Equivalent to calling stopFollowing().
|
||||
*/
|
||||
void lockPosition();
|
||||
}
|
||||
@@ -29,13 +29,18 @@ 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);
|
||||
|
||||
double getDistanceFrom(IPos pos);
|
||||
|
||||
/**
|
||||
@@ -66,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();
|
||||
}
|
||||
@@ -8,8 +8,8 @@ public interface ITimers {
|
||||
* Adds a timer to the NPC or player with the given attributes. If this function is used and there is already a
|
||||
* timer with the given ID, an exception will be thrown.
|
||||
*
|
||||
* @param id The id of the timer.
|
||||
* @param ticks The amount of ticks before the timer ends.
|
||||
* @param id The id of the timer.
|
||||
* @param ticks The amount of ticks before the timer ends.
|
||||
* @param repeat Whether this timer repeats when it reaches its maximum amount of ticks.
|
||||
*/
|
||||
void start(int id, int ticks, boolean repeat);
|
||||
@@ -18,14 +18,15 @@ public interface ITimers {
|
||||
* Adds a timer to the NPC or player with the given attributes. No exception will be thrown if there is already a
|
||||
* timer with the given ID when using this function.
|
||||
*
|
||||
* @param id The id of the timer.
|
||||
* @param ticks The amount of ticks before the timer ends.
|
||||
* @param id The id of the timer.
|
||||
* @param ticks The amount of ticks before the timer ends.
|
||||
* @param repeat Whether this timer repeats when it reaches its maximum amount of ticks.
|
||||
*/
|
||||
void forceStart(int id, int ticks, boolean repeat);
|
||||
|
||||
/**
|
||||
*
|
||||
* @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);
|
||||
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
package noppes.npcs.api;
|
||||
|
||||
import net.minecraft.world.WorldServer;
|
||||
import noppes.npcs.api.entity.IEnergyBeam;
|
||||
import noppes.npcs.api.entity.IEnergyDisc;
|
||||
import noppes.npcs.api.entity.IEnergyLaser;
|
||||
import noppes.npcs.api.entity.IEnergyOrb;
|
||||
import noppes.npcs.api.entity.IEntity;
|
||||
import noppes.npcs.api.entity.IPlayer;
|
||||
import noppes.npcs.api.handler.data.ISound;
|
||||
@@ -29,74 +33,96 @@ public interface IWorld {
|
||||
public IBlock getBlock(int x, int y, int z);
|
||||
|
||||
/**
|
||||
* @param pos
|
||||
* @return The block at the given position. Returns null if there isn't a block
|
||||
*/
|
||||
* @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);
|
||||
|
||||
IBlock getTopBlock(IPos pos);
|
||||
|
||||
boolean isBlockFreezable(IPos pos);
|
||||
|
||||
boolean isBlockFreezable(int x, int y, int z);
|
||||
|
||||
boolean isBlockFreezableNaturally(IPos pos);
|
||||
|
||||
boolean isBlockFreezableNaturally(int x, int y, int z);
|
||||
|
||||
boolean canBlockFreeze(IPos pos, boolean adjacentToWater);
|
||||
|
||||
boolean canBlockFreeze(int x, int y, int z, boolean adjacentToWater);
|
||||
|
||||
boolean canBlockFreezeBody(IPos pos, boolean adjacentToWater);
|
||||
|
||||
boolean canBlockFreezeBody(int x, int y, int z, boolean adjacentToWater);
|
||||
|
||||
boolean canSnowAt(IPos pos, boolean checkLight);
|
||||
|
||||
boolean canSnowAt(int x, int y, int z, boolean checkLight);
|
||||
|
||||
boolean canSnowAtBody(IPos pos, boolean checkLight);
|
||||
|
||||
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 & 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 & 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);
|
||||
|
||||
int getBlockMetadata(IPos pos);
|
||||
|
||||
boolean setBlockMetadataWithNotify(int x, int y, int z, int metadata, int flag);
|
||||
|
||||
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);
|
||||
|
||||
int getFullBlockLightValue(int x, int y, int z);
|
||||
|
||||
int getFullBlockLightValue(IPos pos);
|
||||
|
||||
int getBlockLightValue(int x, int y, int z);
|
||||
|
||||
int getBlockLightValue(IPos pos);
|
||||
|
||||
void playSoundAtEntity(IEntity entity, String sound, float volume, float pitch);
|
||||
@@ -120,11 +146,13 @@ public interface IWorld {
|
||||
IPlayer getClosestPlayerToEntity(IEntity entity, double range);
|
||||
|
||||
IPlayer getClosestPlayer(double x, double y, double z, double range);
|
||||
|
||||
IPlayer getClosestPlayer(IPos pos, double range);
|
||||
|
||||
IPlayer getClosestVulnerablePlayerToEntity(IEntity entity, double range);
|
||||
|
||||
IPlayer getClosestVulnerablePlayer(double x, double y, double z, double range);
|
||||
|
||||
IPlayer getClosestVulnerablePlayer(IPos pos, double range);
|
||||
|
||||
/**
|
||||
@@ -142,32 +170,49 @@ 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);
|
||||
|
||||
void setTileEntity(IPos pos, ITileEntity tileEntity);
|
||||
|
||||
/**
|
||||
* 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);
|
||||
|
||||
boolean isBlockFullCube(IPos pos);
|
||||
|
||||
long getSeed();
|
||||
|
||||
void setSpawnLocation(int x, int y, int z);
|
||||
|
||||
void setSpawnLocation(IPos pos);
|
||||
|
||||
boolean canLightningStrikeAt(int x, int y, int z);
|
||||
|
||||
boolean canLightningStrikeAt(IPos pos);
|
||||
|
||||
boolean isBlockHighHumidity(int x, int y, int z);
|
||||
|
||||
boolean isBlockHighHumidity(IPos pos);
|
||||
|
||||
/**
|
||||
@@ -178,24 +223,29 @@ public interface IWorld {
|
||||
* @since 1.7.10d
|
||||
*/
|
||||
String getSignText(int x, int y, int z);
|
||||
|
||||
String getSignText(IPos pos);
|
||||
|
||||
/**
|
||||
* @param x World position x
|
||||
* @param y World position y
|
||||
* @param z World position z
|
||||
* @param x World position x
|
||||
* @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);
|
||||
|
||||
boolean setBlock(IPos pos, IItemStack item);
|
||||
|
||||
/**
|
||||
* @param x World position x
|
||||
* @param y World position y
|
||||
* @param z World position z
|
||||
* @param block The block to be set
|
||||
*/
|
||||
/**
|
||||
* @param x World position x
|
||||
* @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);
|
||||
|
||||
boolean setBlock(IPos pos, IBlock block);
|
||||
|
||||
/**
|
||||
@@ -204,6 +254,7 @@ public interface IWorld {
|
||||
* @param z World position z
|
||||
*/
|
||||
void removeBlock(int x, int y, int z);
|
||||
|
||||
void removeBlock(IPos pos);
|
||||
|
||||
boolean isPlaceCancelled(int posX, int posY, int posZ);
|
||||
@@ -224,9 +275,13 @@ public interface IWorld {
|
||||
|
||||
/**
|
||||
* starting at the start position, draw a line in the lookVector direction until a block is detected
|
||||
* @param startPos
|
||||
* @param lookVector should be a normalized direction vector
|
||||
* @param maxDistance
|
||||
*
|
||||
* @param startPos the ray origin as [x, y, z]
|
||||
* @param lookVector should be a normalized direction vector
|
||||
* @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);
|
||||
@@ -238,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);
|
||||
@@ -288,27 +343,30 @@ public interface IWorld {
|
||||
* @param z The z position
|
||||
*/
|
||||
void thunderStrike(double x, double y, double z);
|
||||
|
||||
void thunderStrike(IPos pos);
|
||||
|
||||
/**
|
||||
* Sends a packet from the server to the client everytime its called. Probably should not use this too much.
|
||||
*
|
||||
* @param particle Particle name. Particle name list: http://minecraft.wiki/w/Particles
|
||||
* @param x The x position
|
||||
* @param y The y position
|
||||
* @param z The z position
|
||||
* @param dx Usually used for the x motion
|
||||
* @param dy Usually used for the y motion
|
||||
* @param dz Usually used for the z motion
|
||||
* @param speed Speed of the particles, usually between 0 and 1
|
||||
* @param count Particle count
|
||||
* @param x The x position
|
||||
* @param y The y position
|
||||
* @param z The z position
|
||||
* @param dx Usually used for the x motion
|
||||
* @param dy Usually used for the y motion
|
||||
* @param dz Usually used for the z motion
|
||||
* @param speed Speed of the particles, usually between 0 and 1
|
||||
* @param count Particle count
|
||||
*/
|
||||
void spawnParticle(String particle, double x, double y, double z, double dx, double dy, double dz, double speed, int count);
|
||||
|
||||
void spawnParticle(String particle, IPos pos, double dx, double dy, double dz, double speed, int count);
|
||||
|
||||
/**
|
||||
* @param id The items name
|
||||
* @param id The items name
|
||||
* @param damage The damage value
|
||||
* @param size The number of items in the item
|
||||
* @param size The number of items in the item
|
||||
* @return Returns the item
|
||||
*/
|
||||
IItemStack createItem(String id, int damage, int size);
|
||||
@@ -356,14 +414,15 @@ public interface IWorld {
|
||||
String[] getStoredDataKeys();
|
||||
|
||||
/**
|
||||
* @param x Position x
|
||||
* @param y Position y
|
||||
* @param z Position z
|
||||
* @param x Position x
|
||||
* @param y Position y
|
||||
* @param z Position z
|
||||
* @param range Range of the explosion
|
||||
* @param fire Whether or not the explosion does fire damage
|
||||
* @param fire Whether or not the explosion does fire damage
|
||||
* @param grief Whether or not the explosion does damage to blocks
|
||||
*/
|
||||
void explode(double x, double y, double z, float range, boolean fire, boolean grief);
|
||||
|
||||
void explode(IPos pos, float range, boolean fire, boolean grief);
|
||||
|
||||
IPlayer[] getAllServerPlayers();
|
||||
@@ -371,36 +430,40 @@ public interface IWorld {
|
||||
public String[] getPlayerNames();
|
||||
|
||||
/**
|
||||
* @since 1.7.10c
|
||||
* @param x Position x
|
||||
* @param z Position z
|
||||
* @return Returns the name of the biome
|
||||
* @since 1.7.10c
|
||||
*/
|
||||
String getBiomeName(int x, int z);
|
||||
|
||||
String getBiomeName(IPos pos);
|
||||
|
||||
/**
|
||||
* Lets you spawn a server side cloned entity
|
||||
* @param x The x position the clone will be spawned at
|
||||
* @param y The y position the clone will be spawned at
|
||||
* @param z The z position the clone will be spawned at
|
||||
* @param tab The tab in which the clone is
|
||||
* @param name Name of the cloned entity
|
||||
*
|
||||
* @param x The x position the clone will be spawned at
|
||||
* @param y The y position the clone will be spawned at
|
||||
* @param z The z position the clone will be spawned at
|
||||
* @param tab The tab in which the clone is
|
||||
* @param name Name of the cloned entity
|
||||
* @param ignoreProtection Whether the spawning of this clone skips protection checks.
|
||||
* @return Returns the entity which was spawned
|
||||
*/
|
||||
IEntity spawnClone(int x, int y, int z, int tab, String name, boolean ignoreProtection);
|
||||
|
||||
IEntity spawnClone(IPos pos, int tab, String name, boolean ignoreProtection);
|
||||
|
||||
IEntity spawnClone(int x, int y, int z, int tab, String name);
|
||||
|
||||
IEntity spawnClone(IPos pos, int tab, String name);
|
||||
|
||||
IScoreboard getScoreboard();
|
||||
|
||||
/**
|
||||
* @return Returns minecraft world object
|
||||
* @since 1.7.10c
|
||||
* Expert use only
|
||||
* @return Returns minecraft world object
|
||||
*/
|
||||
WorldServer getMCWorld();
|
||||
|
||||
@@ -410,5 +473,55 @@ public interface IWorld {
|
||||
*/
|
||||
int getDimensionID();
|
||||
|
||||
/**
|
||||
* Creates an energy orb projectile. Not spawned until fire() is called.
|
||||
*
|
||||
* @param owner The entity that owns this projectile
|
||||
* @param x Spawn X position
|
||||
* @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);
|
||||
|
||||
/**
|
||||
* Creates an energy beam projectile. Not spawned until fire() is called.
|
||||
*
|
||||
* @param owner The entity that owns this projectile
|
||||
* @param x Spawn X position
|
||||
* @param y Spawn Y position
|
||||
* @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);
|
||||
|
||||
/**
|
||||
* Creates an energy disc projectile. Not spawned until fire() is called.
|
||||
*
|
||||
* @param owner The entity that owns this projectile
|
||||
* @param x Spawn X position
|
||||
* @param y Spawn Y position
|
||||
* @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);
|
||||
|
||||
/**
|
||||
* Creates an energy laser projectile. Not spawned until fire() is called.
|
||||
*
|
||||
* @param owner The entity that owns this projectile
|
||||
* @param x Spawn X position
|
||||
* @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);
|
||||
|
||||
void broadcast(String message);
|
||||
}
|
||||
@@ -0,0 +1,374 @@
|
||||
package noppes.npcs.api.ability;
|
||||
|
||||
import noppes.npcs.api.INbt;
|
||||
import noppes.npcs.api.handler.data.IMagicData;
|
||||
|
||||
/**
|
||||
* Interface for NPC abilities.
|
||||
* Abilities are special attacks or actions that NPCs can perform during combat.
|
||||
*/
|
||||
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();
|
||||
|
||||
/**
|
||||
* Set the unique ID of this ability instance.
|
||||
* @param id Unique ability ID.
|
||||
*/
|
||||
void setId(String id);
|
||||
|
||||
/**
|
||||
* Get the unique identifier/name of this ability (used for file naming, commands, search).
|
||||
*/
|
||||
String getName();
|
||||
|
||||
/**
|
||||
* Set the unique identifier/name of this ability.
|
||||
* @param name Unique identifier.
|
||||
*/
|
||||
void setName(String name);
|
||||
|
||||
/**
|
||||
* Get the display name (cosmetic). Falls back to getName() if not set.
|
||||
* @return the display name
|
||||
*/
|
||||
String getDisplayName();
|
||||
|
||||
/**
|
||||
* Set the display name (cosmetic). Pass empty string to use getName() as display.
|
||||
* @param displayName Display name, or empty string for default.
|
||||
*/
|
||||
void setDisplayName(String displayName);
|
||||
|
||||
/**
|
||||
* Get the type ID of this ability (e.g., "cnpc:slam", "cnpc:beam").
|
||||
* @return the type ID
|
||||
*/
|
||||
String getTypeId();
|
||||
|
||||
/**
|
||||
* Check if this ability is enabled.
|
||||
*/
|
||||
boolean isEnabled();
|
||||
|
||||
/**
|
||||
* Enable or disable this ability.
|
||||
* @param enabled Whether the ability is enabled.
|
||||
*/
|
||||
void setEnabled(boolean enabled);
|
||||
|
||||
/**
|
||||
* Get the selection weight for random ability selection.
|
||||
* Higher weight = more likely to be selected.
|
||||
*/
|
||||
int getWeight();
|
||||
|
||||
/**
|
||||
* Set the selection weight.
|
||||
* @param weight Selection weight (higher = more likely).
|
||||
*/
|
||||
void setWeight(int weight);
|
||||
|
||||
/**
|
||||
* Get the minimum range at which this ability can be used.
|
||||
*/
|
||||
float getMinRange();
|
||||
|
||||
/**
|
||||
* Set the minimum range.
|
||||
* @param range Minimum range in blocks.
|
||||
*/
|
||||
void setMinRange(float range);
|
||||
|
||||
/**
|
||||
* Get the maximum range at which this ability can be used.
|
||||
*/
|
||||
float getMaxRange();
|
||||
|
||||
/**
|
||||
* Set the maximum range.
|
||||
* @param range Maximum range in blocks.
|
||||
*/
|
||||
void setMaxRange(float range);
|
||||
|
||||
/**
|
||||
* Get the cooldown time in ticks.
|
||||
*/
|
||||
int getCooldownTicks();
|
||||
|
||||
/**
|
||||
* Set the cooldown time in ticks.
|
||||
* @param ticks Cooldown duration in ticks.
|
||||
*/
|
||||
void setCooldownTicks(int ticks);
|
||||
|
||||
/**
|
||||
* Get the wind-up time in ticks (telegraph phase).
|
||||
* @return wind-up time in ticks
|
||||
*/
|
||||
int getWindUpTicks();
|
||||
|
||||
/**
|
||||
* Set the wind-up time in ticks.
|
||||
* @param ticks Wind-up duration in ticks.
|
||||
*/
|
||||
void setWindUpTicks(int ticks);
|
||||
|
||||
/**
|
||||
* Get the dazed time in ticks (stun after interrupt during WINDUP).
|
||||
* @return dazed time in ticks
|
||||
*/
|
||||
int getDazedTicks();
|
||||
|
||||
/**
|
||||
* Set the dazed time in ticks.
|
||||
* @param ticks Dazed duration in ticks.
|
||||
*/
|
||||
void setDazedTicks(int ticks);
|
||||
|
||||
/**
|
||||
* Check if this ability can be interrupted by damage.
|
||||
* @return true if interruptible
|
||||
*/
|
||||
boolean isInterruptible();
|
||||
|
||||
/**
|
||||
* Set whether this ability can be interrupted.
|
||||
* @param interruptible Whether the ability is interruptible.
|
||||
*/
|
||||
void setInterruptible(boolean interruptible);
|
||||
|
||||
/**
|
||||
* Check if this ability ignores target invulnerability frames (hurt resistance).
|
||||
* @return true if ignoring invulnerability frames
|
||||
*/
|
||||
boolean isIgnoreIFrames();
|
||||
|
||||
/**
|
||||
* Set whether this ability ignores target invulnerability frames (hurt resistance).
|
||||
* @param ignore Whether to ignore invulnerability frames.
|
||||
*/
|
||||
void setIgnoreIFrames(boolean ignore);
|
||||
|
||||
/**
|
||||
* Get the lock movement type for this ability.
|
||||
*
|
||||
* @return 0=NO, 1=WINDUP, 2=ACTIVE, 3=WINDUP_AND_ACTIVE
|
||||
*/
|
||||
int getLockMovementType();
|
||||
|
||||
/**
|
||||
* Set the lock movement type for this ability.
|
||||
*
|
||||
* @param type 0=NO, 1=WINDUP, 2=ACTIVE, 3=WINDUP_AND_ACTIVE
|
||||
*/
|
||||
void setLockMovementType(int type);
|
||||
|
||||
/**
|
||||
* Get the rotation mode for this ability.
|
||||
*
|
||||
* @return 0=FREE, 1=LOCKED, 2=TRACK
|
||||
*/
|
||||
int getRotationModeType();
|
||||
|
||||
/**
|
||||
* Set the rotation mode for this ability.
|
||||
*
|
||||
* @param type 0=FREE, 1=LOCKED, 2=TRACK
|
||||
*/
|
||||
void setRotationModeType(int type);
|
||||
|
||||
/**
|
||||
* Get the rotation phase for this ability (when rotation mode applies).
|
||||
*
|
||||
* @return 0=NO, 1=WINDUP, 2=ACTIVE, 3=WINDUP_AND_ACTIVE
|
||||
*/
|
||||
int getRotationPhaseType();
|
||||
|
||||
/**
|
||||
* Set the rotation phase for this ability.
|
||||
*
|
||||
* @param type 0=NO, 1=WINDUP, 2=ACTIVE, 3=WINDUP_AND_ACTIVE
|
||||
*/
|
||||
void setRotationPhaseType(int type);
|
||||
|
||||
/**
|
||||
* 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();
|
||||
|
||||
/**
|
||||
* Set track speed for TRACK rotation mode (blocks/second).
|
||||
*
|
||||
* @param speed 0 = instant tracking. ~4 = dodgeable while sprinting. ~6 = barely undodgeable.
|
||||
*/
|
||||
void setTrackSpeedValue(float speed);
|
||||
|
||||
/**
|
||||
* 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();
|
||||
|
||||
/**
|
||||
* Get the allowed user type for this ability.
|
||||
*
|
||||
* @return 0=NPC_ONLY, 1=PLAYER_ONLY, 2=BOTH
|
||||
*/
|
||||
int getAllowedByType();
|
||||
|
||||
/**
|
||||
* Set the allowed user type for this ability.
|
||||
*
|
||||
* @param type 0=NPC_ONLY, 1=PLAYER_ONLY, 2=BOTH
|
||||
*/
|
||||
void setAllowedByType(int type);
|
||||
|
||||
/**
|
||||
* Check if this ability ignores cooldowns.
|
||||
* @return true if ignoring cooldowns
|
||||
*/
|
||||
boolean isIgnoreCooldown();
|
||||
|
||||
/**
|
||||
* Set whether this ability ignores cooldowns.
|
||||
* @param ignore Whether to ignore cooldowns.
|
||||
*/
|
||||
void setIgnoreCooldown(boolean ignore);
|
||||
|
||||
/**
|
||||
* 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();
|
||||
|
||||
/**
|
||||
* Set whether this ability uses per-ability cooldown.
|
||||
* @param perAbility Whether to use per-ability cooldown.
|
||||
*/
|
||||
void setPerAbilityCooldown(boolean perAbility);
|
||||
|
||||
/**
|
||||
* Get this ability's data as NBT.
|
||||
* @return the ability's NBT data
|
||||
*/
|
||||
INbt getNbt();
|
||||
|
||||
/**
|
||||
* Set this ability's data from NBT.
|
||||
* @param nbt NBT data to load.
|
||||
*/
|
||||
void setNbt(INbt nbt);
|
||||
|
||||
// Burst system
|
||||
|
||||
/** @return Whether burst firing is enabled (fires multiple instances in rapid succession). */
|
||||
boolean isBurstEnabled();
|
||||
|
||||
/** @param enabled Whether burst firing is enabled. */
|
||||
void setBurstEnabled(boolean enabled);
|
||||
|
||||
/** @return Number of times the ability fires per burst. */
|
||||
int getBurstAmount();
|
||||
|
||||
/** @param amount Number of shots per burst. */
|
||||
void setBurstAmount(int amount);
|
||||
|
||||
/** @return Delay in ticks between each burst shot. */
|
||||
int getBurstDelay();
|
||||
|
||||
/** @param delay Delay in ticks between burst shots. */
|
||||
void setBurstDelay(int delay);
|
||||
|
||||
/** @return Whether animations replay for each burst shot. */
|
||||
boolean isBurstReplayAnimations();
|
||||
|
||||
/** @param replay Whether to replay animations per burst shot. */
|
||||
void setBurstReplayAnimations(boolean replay);
|
||||
|
||||
/** @return Whether burst shots can overlap (fire before previous shot ends). */
|
||||
boolean isBurstOverlap();
|
||||
|
||||
/** @param overlap Whether burst shots can overlap. */
|
||||
void setBurstOverlap(boolean overlap);
|
||||
|
||||
// Toggle system
|
||||
|
||||
/**
|
||||
* 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();
|
||||
|
||||
/**
|
||||
* Set the number of toggle states.
|
||||
* 0 = not toggleable, 1 = binary on/off, 2+ = multi-state cycling.
|
||||
* @param states Number of toggle states.
|
||||
*/
|
||||
void setToggleStates(int states);
|
||||
|
||||
/**
|
||||
* Get the display label for a specific toggle state (1-indexed).
|
||||
* @param state Toggle state number (1-indexed).
|
||||
* @return the label, or null if none set.
|
||||
*/
|
||||
String getToggleStateLabel(int state);
|
||||
|
||||
/**
|
||||
* Get this ability's magic data. Defines magic types, damage splits,
|
||||
* and flat magic damage for this ability. Inherited by spawned energy entities.
|
||||
* @return the ability's magic data
|
||||
*/
|
||||
IMagicData getMagicData();
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package noppes.npcs.api.ability;
|
||||
|
||||
/**
|
||||
* Common API interface for all combat actions (abilities and chained abilities).
|
||||
* Both {@link IAbility} and {@link IChainedAbility} extend this interface.
|
||||
*/
|
||||
public interface IAbilityAction {
|
||||
|
||||
/** @return The unique identifier/name of this action. */
|
||||
String getName();
|
||||
|
||||
/** @return Whether this action is enabled. */
|
||||
boolean isEnabled();
|
||||
|
||||
/** @return Selection weight for random ability selection (higher = more likely). */
|
||||
int getWeight();
|
||||
|
||||
/** @return Cooldown duration in ticks after this action is used. */
|
||||
int getCooldownTicks();
|
||||
|
||||
/** @return Minimum range in blocks at which this action can be used. */
|
||||
float getMinRange();
|
||||
|
||||
/** @return Maximum range in blocks at which this action can be used. */
|
||||
float getMaxRange();
|
||||
|
||||
/** @return Whether this action is a chained ability (sequence) vs an individual ability. */
|
||||
boolean isChain();
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package noppes.npcs.api.ability;
|
||||
|
||||
/**
|
||||
* Handler for ability registration and creation.
|
||||
* Use this to register custom ability types from external mods.
|
||||
*/
|
||||
public interface IAbilityHandler {
|
||||
|
||||
/**
|
||||
* Register a custom ability type.
|
||||
* Call during FMLInitializationEvent.
|
||||
*
|
||||
* @param typeId The unique type ID (e.g., "mymod:custom_ability")
|
||||
* @param abilityClass The class that implements the ability
|
||||
*/
|
||||
void registerType(String typeId, Class<? extends IAbility> abilityClass);
|
||||
|
||||
/**
|
||||
* 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);
|
||||
|
||||
/**
|
||||
* Register a pre-configured ability by name.
|
||||
* These abilities are resolved by name and can be referenced by NPCs and players.
|
||||
* Call during FMLInitializationEvent.
|
||||
*
|
||||
* @param name The unique name for the ability
|
||||
* @param ability The ability instance
|
||||
*/
|
||||
void registerAbility(String name, IAbility ability);
|
||||
|
||||
/**
|
||||
* Check if a registered ability exists by name.
|
||||
*
|
||||
* @param name The ability name
|
||||
* @return true if the ability exists
|
||||
*/
|
||||
boolean hasAbility(String name);
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package noppes.npcs.api.ability;
|
||||
|
||||
/**
|
||||
* API interface for chained abilities - ordered sequences of ability references
|
||||
* that execute one after another with configurable delays.
|
||||
*/
|
||||
public interface IChainedAbility extends IAbilityAction {
|
||||
|
||||
/** @return Whether all entries wind up simultaneously before execution begins. */
|
||||
boolean isWindUpAll();
|
||||
|
||||
/** @return The number of ability entries in this chain. */
|
||||
int getEntryCount();
|
||||
|
||||
/**
|
||||
* @param index Entry index in the chain.
|
||||
* @return The ability reference ID at the given index.
|
||||
*/
|
||||
String getEntryReference(int index);
|
||||
|
||||
/**
|
||||
* @param index Entry index in the chain.
|
||||
* @return The delay in ticks before executing this entry.
|
||||
*/
|
||||
int getEntryDelay(int index);
|
||||
|
||||
/**
|
||||
* @param index Entry index in the chain.
|
||||
* @return Whether this entry executes inline (overlapping with previous).
|
||||
*/
|
||||
boolean isEntryInline(int index);
|
||||
}
|
||||
@@ -0,0 +1,130 @@
|
||||
package noppes.npcs.api.ability;
|
||||
|
||||
/**
|
||||
* A custom (script-driven) ability whose behavior is entirely defined by script event hooks.
|
||||
* Supports both instant execution mode and toggle mode.
|
||||
*/
|
||||
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);
|
||||
|
||||
/**
|
||||
* Get the telegraph shape type ordinal.
|
||||
* @return ordinal of TelegraphType: 0=CIRCLE, 1=RING, 2=LINE, 3=CONE, 4=POINT, 5=SQUARE, 6=NONE
|
||||
*/
|
||||
int getTelegraphShapeType();
|
||||
|
||||
/**
|
||||
* Set the telegraph shape type by ordinal.
|
||||
* @param type ordinal of TelegraphType
|
||||
*/
|
||||
void setTelegraphShapeType(int type);
|
||||
|
||||
/**
|
||||
* Get the targeting mode ordinal.
|
||||
* @return ordinal of TargetingMode: 0=AGGRO_TARGET, 1=SELF, 2=AOE_SELF, 3=AOE_TARGET
|
||||
*/
|
||||
int getTargetingModeType();
|
||||
|
||||
/**
|
||||
* Set the targeting mode by ordinal.
|
||||
* @param type ordinal of TargetingMode
|
||||
*/
|
||||
void setTargetingModeType(int type);
|
||||
|
||||
/**
|
||||
* 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);
|
||||
}
|
||||
@@ -0,0 +1,204 @@
|
||||
package noppes.npcs.api.ability;
|
||||
|
||||
/**
|
||||
* Interface for an NPC's ability data manager.
|
||||
* Provides access to the NPC's abilities and execution state.
|
||||
*/
|
||||
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);
|
||||
|
||||
/**
|
||||
* Clear all abilities from this NPC.
|
||||
*/
|
||||
void clearAbilities();
|
||||
|
||||
/**
|
||||
* 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();
|
||||
|
||||
/**
|
||||
* Interrupt the current ability if one is executing.
|
||||
*/
|
||||
void interruptCurrentAbility();
|
||||
|
||||
/**
|
||||
* Signal the current ability to complete immediately.
|
||||
*/
|
||||
void completeCurrentAbility();
|
||||
|
||||
/**
|
||||
* 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);
|
||||
|
||||
/**
|
||||
* Reset all ability cooldowns.
|
||||
*/
|
||||
void resetCooldowns();
|
||||
|
||||
/**
|
||||
* Force start an ability on this NPC.
|
||||
* If an ability is currently executing, it will be cancelled.
|
||||
*
|
||||
* @param abilityId The ID of the ability to start
|
||||
* @return true if the ability was started successfully
|
||||
*/
|
||||
boolean forceStartAbility(String abilityId);
|
||||
|
||||
/**
|
||||
* Force start an ability on this NPC with a specific target.
|
||||
* If an ability is currently executing, it will be cancelled.
|
||||
*
|
||||
* @param abilityId The ID of the ability to start
|
||||
* @param target The target entity (can be null for self-targeted abilities)
|
||||
* @return true if the ability was started successfully
|
||||
*/
|
||||
boolean forceStartAbility(String abilityId, Object target);
|
||||
|
||||
/**
|
||||
* Execute an ability on this NPC by key (built-in name or custom UUID).
|
||||
* The NPC does NOT need to have this ability assigned.
|
||||
* If an ability is currently executing, it will be cancelled.
|
||||
*
|
||||
* @param key The ability key (built-in name or custom UUID)
|
||||
* @return true if the ability was started successfully
|
||||
*/
|
||||
boolean executeAbility(String key);
|
||||
|
||||
/**
|
||||
* Execute an ability on this NPC with a specific target.
|
||||
* The NPC does NOT need to have this ability assigned.
|
||||
* If an ability is currently executing, it will be cancelled.
|
||||
*
|
||||
* @param key The ability key (built-in name or custom UUID)
|
||||
* @param target The target entity (can be null for self-targeted abilities)
|
||||
* @return true if the ability was started successfully
|
||||
*/
|
||||
boolean executeAbility(String key, Object target);
|
||||
|
||||
/**
|
||||
* Create a new ability instance by type ID.
|
||||
* The ability is not assigned to this NPC - use addAbility() to assign it.
|
||||
*
|
||||
* @param typeId The type ID (e.g., "cnpc:slam", "cnpc:projectile")
|
||||
* @return The new ability, or null if the type is unknown
|
||||
*/
|
||||
IAbility createAbility(String typeId);
|
||||
|
||||
/**
|
||||
* Get the live source reference of an ability by ID.
|
||||
* Unlike {@link #getAbility(String)} which returns a safe copy,
|
||||
* this returns the actual ability object. Modifications will permanently
|
||||
* affect the NPC's ability configuration.
|
||||
*
|
||||
* @param abilityId The ID of the ability
|
||||
* @return The live ability reference, or null if not found
|
||||
*/
|
||||
IAbility getSourceAbility(String abilityId);
|
||||
|
||||
/**
|
||||
* Get the live source reference of the currently executing ability.
|
||||
* Unlike {@link #getCurrentAbility()} which returns a safe copy,
|
||||
* this returns the actual ability object. Modifications will permanently
|
||||
* affect the NPC's ability configuration.
|
||||
*
|
||||
* @return The live ability reference, or null if no ability is executing
|
||||
*/
|
||||
IAbility getSourceCurrentAbility();
|
||||
}
|
||||
@@ -0,0 +1,175 @@
|
||||
package noppes.npcs.api.ability;
|
||||
|
||||
/**
|
||||
* Interface for managing player abilities.
|
||||
* Players reference abilities by key (built-in names or custom UUIDs).
|
||||
* <p>
|
||||
* Access via IPlayerData.getAbilityData()
|
||||
*/
|
||||
public interface IPlayerAbilityData {
|
||||
|
||||
/**
|
||||
* Get all unlocked ability keys.
|
||||
*
|
||||
* @return array of ability keys
|
||||
*/
|
||||
String[] getUnlockedAbilities();
|
||||
|
||||
/**
|
||||
* Unlock an ability for this player.
|
||||
*
|
||||
* @param key The ability key (built-in name or custom UUID)
|
||||
*/
|
||||
void unlockAbility(String key);
|
||||
|
||||
/**
|
||||
* 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();
|
||||
|
||||
/**
|
||||
* Select the next ability in the list.
|
||||
*/
|
||||
void selectNext();
|
||||
|
||||
/**
|
||||
* Select the previous ability in the list.
|
||||
*/
|
||||
void selectPrevious();
|
||||
|
||||
/**
|
||||
* 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();
|
||||
|
||||
/**
|
||||
* Interrupt the currently executing ability.
|
||||
*/
|
||||
void interruptCurrentAbility();
|
||||
|
||||
/**
|
||||
* Signal the current ability to complete immediately.
|
||||
*/
|
||||
void completeCurrentAbility();
|
||||
|
||||
/**
|
||||
* Check if the player is on universal cooldown.
|
||||
*
|
||||
* @return true if on cooldown
|
||||
*/
|
||||
boolean isOnCooldown();
|
||||
|
||||
/**
|
||||
* Check if a specific ability is on cooldown.
|
||||
*
|
||||
* @param key The ability key
|
||||
* @return true if on cooldown
|
||||
*/
|
||||
boolean isOnCooldown(String key);
|
||||
|
||||
/**
|
||||
* Reset the universal cooldown.
|
||||
*/
|
||||
void resetCooldown();
|
||||
|
||||
/**
|
||||
* Reset cooldown for a specific ability key.
|
||||
*
|
||||
* @param key The ability key
|
||||
*/
|
||||
void resetCooldown(String key);
|
||||
|
||||
/**
|
||||
* Reset all cooldowns.
|
||||
*/
|
||||
void resetAllCooldowns();
|
||||
|
||||
/**
|
||||
* 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);
|
||||
|
||||
// Toggle system
|
||||
|
||||
/**
|
||||
* Cycle a toggle ability to its next state.
|
||||
* Off -> State 1 -> State 2 -> ... -> State N -> 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).
|
||||
*
|
||||
* @param key the ability key
|
||||
* @return true if toggled on
|
||||
*/
|
||||
boolean isAbilityToggled(String key);
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package noppes.npcs.api.ability.data;
|
||||
|
||||
/**
|
||||
* Configuration for the anchor point of an energy ability projectile.
|
||||
* Controls where the projectile spawns relative to the caster.
|
||||
*/
|
||||
public interface IEnergyAnchorData {
|
||||
/** @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=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). */
|
||||
float getAnchorOffsetX();
|
||||
|
||||
/** @param anchorOffsetX X offset from anchor (positive = right). */
|
||||
void setAnchorOffsetX(float anchorOffsetX);
|
||||
|
||||
/** @return Y offset from the anchor point (positive = up). */
|
||||
float getAnchorOffsetY();
|
||||
|
||||
/** @param anchorOffsetY Y offset from anchor (positive = up). */
|
||||
void setAnchorOffsetY(float anchorOffsetY);
|
||||
|
||||
/** @return Z offset from the anchor point (positive = forward). */
|
||||
float getAnchorOffsetZ();
|
||||
|
||||
/** @param anchorOffsetZ Z offset from anchor (positive = forward). */
|
||||
void setAnchorOffsetZ(float anchorOffsetZ);
|
||||
|
||||
/** @return Whether the projectile launches from the anchor position instead of the default eye/look-vector position. */
|
||||
boolean getLaunchFromAnchor();
|
||||
|
||||
/** @param launchFromAnchor When true, the projectile launches from its anchor position; when false, it snaps to the default eye/look-vector position. */
|
||||
void setLaunchFromAnchor(boolean launchFromAnchor);
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package noppes.npcs.api.ability.data;
|
||||
|
||||
/**
|
||||
* Combat properties for energy ability projectiles.
|
||||
* Controls damage, knockback, and explosion behavior.
|
||||
*/
|
||||
public interface IEnergyCombatData {
|
||||
/** @return Base damage dealt on hit. */
|
||||
float getDamage();
|
||||
|
||||
/** @param damage Base damage on hit. */
|
||||
void setDamage(float damage);
|
||||
|
||||
/** @return Horizontal knockback strength applied on hit. */
|
||||
float getKnockback();
|
||||
|
||||
/** @param knockback Horizontal knockback strength. */
|
||||
void setKnockback(float knockback);
|
||||
|
||||
/** @return Vertical knockback strength applied on hit. */
|
||||
float getKnockbackUp();
|
||||
|
||||
/** @param knockbackUp Vertical knockback strength. */
|
||||
void setKnockbackUp(float knockbackUp);
|
||||
|
||||
/** @return Whether the projectile explodes on impact. */
|
||||
boolean isExplosive();
|
||||
|
||||
/** @param explosive Whether to explode on impact. */
|
||||
void setExplosive(boolean explosive);
|
||||
|
||||
/** @return Explosion radius in blocks. */
|
||||
float getExplosionRadius();
|
||||
|
||||
/** @param explosionRadius Explosion radius in blocks. */
|
||||
void setExplosionRadius(float explosionRadius);
|
||||
|
||||
/** @return Damage falloff multiplier over distance (0.0-1.0). */
|
||||
float getExplosionDamageFalloff();
|
||||
|
||||
/** @param explosionDamageFalloff Damage falloff multiplier (0.0-1.0). */
|
||||
void setExplosionDamageFalloff(float explosionDamageFalloff);
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package noppes.npcs.api.ability.data;
|
||||
|
||||
/**
|
||||
* Visual display properties for energy ability projectiles.
|
||||
* Controls colors, transparency, and rotation speed.
|
||||
*/
|
||||
public interface IEnergyDisplayData {
|
||||
/** @return Inner (core) color as a packed RGB integer. */
|
||||
int getInnerColor();
|
||||
|
||||
/** @param innerColor Inner color as a packed RGB integer. */
|
||||
void setInnerColor(int innerColor);
|
||||
|
||||
/** @return Outer (glow) color as a packed RGB integer. */
|
||||
int getOuterColor();
|
||||
|
||||
/** @param outerColor Outer color as a packed RGB integer. */
|
||||
void setOuterColor(int outerColor);
|
||||
|
||||
/** @return Whether the outer color layer is rendered. */
|
||||
boolean isOuterColorEnabled();
|
||||
|
||||
/** @param outerColorEnabled Whether to render the outer color layer. */
|
||||
void setOuterColorEnabled(boolean outerColorEnabled);
|
||||
|
||||
/** @return Width of the outer color layer relative to the projectile size. */
|
||||
float getOuterColorWidth();
|
||||
|
||||
/** @param outerColorWidth Outer color layer width. */
|
||||
void setOuterColorWidth(float outerColorWidth);
|
||||
|
||||
/** @return Alpha (opacity) of the outer color layer (0.0-1.0). */
|
||||
float getOuterColorAlpha();
|
||||
|
||||
/** @param outerColorAlpha Outer color opacity (0.0-1.0). */
|
||||
void setOuterColorAlpha(float outerColorAlpha);
|
||||
|
||||
/** @return Alpha (opacity) of the inner color layer (0.0-1.0). */
|
||||
float getInnerAlpha();
|
||||
|
||||
/** @param innerAlpha Inner color opacity (0.0-1.0). */
|
||||
void setInnerAlpha(float innerAlpha);
|
||||
|
||||
/** @return Visual rotation speed in degrees per tick. */
|
||||
float getRotationSpeed();
|
||||
|
||||
/** @param rotationSpeed Rotation speed in degrees per tick. */
|
||||
void setRotationSpeed(float rotationSpeed);
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package noppes.npcs.api.ability.data;
|
||||
|
||||
/**
|
||||
* Homing and speed properties for energy ability projectiles.
|
||||
* Controls projectile velocity and target-seeking behavior.
|
||||
*/
|
||||
public interface IEnergyHomingData {
|
||||
/** @return Projectile travel speed in blocks per tick. */
|
||||
float getSpeed();
|
||||
|
||||
/** @param speed Travel speed in blocks per tick. */
|
||||
void setSpeed(float speed);
|
||||
|
||||
/** @return Whether the projectile tracks its target. */
|
||||
boolean isHoming();
|
||||
|
||||
/** @param homing Whether to track the target. */
|
||||
void setHoming(boolean homing);
|
||||
|
||||
/** @return Homing turn strength (higher = tighter turns). */
|
||||
float getHomingStrength();
|
||||
|
||||
/** @param homingStrength Homing turn strength. */
|
||||
void setHomingStrength(float homingStrength);
|
||||
|
||||
/** @return Maximum distance at which homing activates, in blocks. */
|
||||
float getHomingRange();
|
||||
|
||||
/** @param homingRange Maximum homing activation range in blocks. */
|
||||
void setHomingRange(float homingRange);
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package noppes.npcs.api.ability.data;
|
||||
|
||||
/**
|
||||
* Lifespan properties for energy ability projectiles.
|
||||
* Controls how far and how long a projectile can travel before expiring.
|
||||
*/
|
||||
public interface IEnergyLifespanData {
|
||||
/** @return Maximum travel distance in blocks before the projectile expires. */
|
||||
float getMaxDistance();
|
||||
|
||||
/** @param maxDistance Maximum travel distance in blocks. */
|
||||
void setMaxDistance(float maxDistance);
|
||||
|
||||
/** @return Maximum lifetime in ticks before the projectile expires. */
|
||||
int getMaxLifetime();
|
||||
|
||||
/** @param maxLifetime Maximum lifetime in ticks. */
|
||||
void setMaxLifetime(int maxLifetime);
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package noppes.npcs.api.ability.data;
|
||||
|
||||
/**
|
||||
* Lightning visual effect properties for energy ability projectiles.
|
||||
* Controls the electric arc effect rendered around the projectile.
|
||||
*/
|
||||
public interface IEnergyLightningData {
|
||||
/** @return Whether the lightning visual effect is enabled. */
|
||||
boolean isLightningEffect();
|
||||
|
||||
/** @param lightningEffect Whether to enable the lightning effect. */
|
||||
void setLightningEffect(boolean lightningEffect);
|
||||
|
||||
/** @return Density of lightning arcs (higher = more arcs). */
|
||||
float getLightningDensity();
|
||||
|
||||
/** @param lightningDensity Lightning arc density. */
|
||||
void setLightningDensity(float lightningDensity);
|
||||
|
||||
/** @return Radius of the lightning effect around the projectile, in blocks. */
|
||||
float getLightningRadius();
|
||||
|
||||
/** @param lightningRadius Lightning effect radius in blocks. */
|
||||
void setLightningRadius(float lightningRadius);
|
||||
|
||||
/** @return Fade-out time for lightning arcs in ticks. */
|
||||
int getLightningFadeTime();
|
||||
|
||||
/** @param lightningFadeTime Fade-out time in ticks. */
|
||||
void setLightningFadeTime(int lightningFadeTime);
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package noppes.npcs.api.ability.type;
|
||||
|
||||
import noppes.npcs.api.ability.IAbility;
|
||||
|
||||
/**
|
||||
* API interface for Charge abilities.
|
||||
* Rush forward attack.
|
||||
*/
|
||||
public interface IAbilityCharge extends IAbility {
|
||||
|
||||
/** @return Movement speed during the charge in blocks per tick. */
|
||||
float getChargeSpeed();
|
||||
|
||||
/** @param speed Movement speed in blocks per tick. */
|
||||
void setChargeSpeed(float speed);
|
||||
|
||||
/** @return Damage dealt to entities hit during the charge. */
|
||||
float getDamage();
|
||||
|
||||
/** @param damage Damage on charge impact. */
|
||||
void setDamage(float damage);
|
||||
|
||||
/** @return Knockback strength applied to entities hit during the charge. */
|
||||
float getKnockback();
|
||||
|
||||
/** @param knockback Knockback strength on impact. */
|
||||
void setKnockback(float knockback);
|
||||
|
||||
/** @return Width of the charge hit area in blocks. */
|
||||
float getHitWidth();
|
||||
|
||||
/** @param width Hit area width in blocks. */
|
||||
void setHitWidth(float width);
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package noppes.npcs.api.ability.type;
|
||||
|
||||
/**
|
||||
* API interface for Counter abilities.
|
||||
* Absorbs incoming damage and counter-attacks the attacker.
|
||||
*/
|
||||
public interface IAbilityCounter extends IAbilityDefend {
|
||||
|
||||
/** @return Counter-attack type ordinal (determines how counter damage is calculated). */
|
||||
int getCounterType();
|
||||
|
||||
/** @param type Counter-attack type ordinal. */
|
||||
void setCounterType(int type);
|
||||
|
||||
/** @return Counter-attack value (meaning depends on counter type, e.g. flat damage or multiplier). */
|
||||
float getCounterValue();
|
||||
|
||||
/** @param value Counter-attack value (flat damage or multiplier). */
|
||||
void setCounterValue(float value);
|
||||
|
||||
/** @return Animation ID played when the counter-attack triggers, or -1 for none. */
|
||||
int getCounterAnimationId();
|
||||
|
||||
/** @param animationId Animation ID for the counter-attack, or -1 for none. */
|
||||
void setCounterAnimationId(int animationId);
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package noppes.npcs.api.ability.type;
|
||||
|
||||
import noppes.npcs.api.ability.IAbility;
|
||||
|
||||
/**
|
||||
* API interface for Cutter abilities.
|
||||
* Sweeping fan attack in an arc.
|
||||
*/
|
||||
public interface IAbilityCutter extends IAbility {
|
||||
|
||||
/** @return Arc angle of the sweep in degrees. */
|
||||
float getArcAngle();
|
||||
|
||||
/** @param angle Arc angle in degrees. */
|
||||
void setArcAngle(float angle);
|
||||
|
||||
/** @return Range of the sweep attack in blocks. */
|
||||
float getRange();
|
||||
|
||||
/** @param range Sweep range in blocks. */
|
||||
void setRange(float range);
|
||||
|
||||
/** @return Damage dealt to entities hit by the sweep. */
|
||||
float getDamage();
|
||||
|
||||
/** @param damage Sweep damage amount. */
|
||||
void setDamage(float damage);
|
||||
|
||||
/** @return Knockback strength applied to entities hit. */
|
||||
float getKnockback();
|
||||
|
||||
/** @param knockback Knockback strength. */
|
||||
void setKnockback(float knockback);
|
||||
|
||||
/** @return Sweep mode ordinal (0=SWIPE, 1=SPIN). */
|
||||
int getSweepMode();
|
||||
|
||||
/** @param mode Sweep mode ordinal (0=SWIPE, 1=SPIN). */
|
||||
void setSweepMode(int mode);
|
||||
|
||||
/** @return Speed of the sweep animation. */
|
||||
float getSweepSpeed();
|
||||
|
||||
/** @param speed Sweep animation speed. */
|
||||
void setSweepSpeed(float speed);
|
||||
|
||||
/** @return Duration of the spin in ticks (only used in SPIN mode). */
|
||||
int getSpinDurationTicks();
|
||||
|
||||
/** @param ticks Spin duration in ticks. */
|
||||
void setSpinDurationTicks(int ticks);
|
||||
|
||||
/** @return Whether the sweep hits through multiple targets. */
|
||||
boolean isPiercing();
|
||||
|
||||
/** @param piercing Whether the sweep pierces through targets. */
|
||||
void setPiercing(boolean piercing);
|
||||
|
||||
/** @return Inner radius of the sweep arc in blocks (creates a donut-shaped hitbox). */
|
||||
float getInnerRadius();
|
||||
|
||||
/** @param radius Inner radius in blocks. */
|
||||
void setInnerRadius(float radius);
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package noppes.npcs.api.ability.type;
|
||||
|
||||
import noppes.npcs.api.ability.IAbility;
|
||||
|
||||
/**
|
||||
* API interface for Dash abilities.
|
||||
* Quick evasive sidestep movement.
|
||||
*/
|
||||
public interface IAbilityDash extends IAbility {
|
||||
|
||||
/** @return Dash mode ordinal (0=AGGRESSIVE, 1=DEFENSIVE, 2=DIRECTIONAL). */
|
||||
int getDashMode();
|
||||
|
||||
/** @param mode Dash mode ordinal (0=AGGRESSIVE, 1=DEFENSIVE, 2=DIRECTIONAL). */
|
||||
void setDashMode(int mode);
|
||||
|
||||
/** @return Distance covered by the dash in blocks. */
|
||||
float getDashDistance();
|
||||
|
||||
/** @param distance Dash distance in blocks. */
|
||||
void setDashDistance(float distance);
|
||||
|
||||
/** @return Speed of the dash movement. */
|
||||
float getDashSpeed();
|
||||
|
||||
/** @param speed Dash movement speed. */
|
||||
void setDashSpeed(float speed);
|
||||
|
||||
/** @return Angle offset of the dash direction in degrees. */
|
||||
float getDashAngle();
|
||||
|
||||
/** @param dashAngle Direction angle offset in degrees. */
|
||||
void setDashAngle(float dashAngle);
|
||||
|
||||
/** @return Dash direction ordinal (determines lateral movement direction). */
|
||||
int getDashDirection();
|
||||
|
||||
/** @param mode Dash direction ordinal. */
|
||||
void setDashDirection(int mode);
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package noppes.npcs.api.ability.type;
|
||||
|
||||
import noppes.npcs.api.ability.IAbility;
|
||||
|
||||
/**
|
||||
* API interface for defensive abilities (Guard, Counter, Dodge).
|
||||
*/
|
||||
public interface IAbilityDefend extends IAbility {
|
||||
|
||||
/** @return Maximum duration of the defensive stance in ticks. */
|
||||
int getDurationTicks();
|
||||
|
||||
/** @param ticks Maximum duration in ticks. */
|
||||
void setDurationTicks(int ticks);
|
||||
|
||||
/** @return Maximum number of hits that can be absorbed before the defense breaks. */
|
||||
int getMaxHitAmount();
|
||||
|
||||
/** @param amount Maximum hit count before breaking. */
|
||||
void setMaxHitAmount(int amount);
|
||||
|
||||
/** @return Whether the entity is currently in a defensive stance. */
|
||||
boolean isDefending();
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
package noppes.npcs.api.ability.type;
|
||||
|
||||
/**
|
||||
* API interface for Disc abilities.
|
||||
* Flat spinning disc projectile with optional boomerang.
|
||||
*/
|
||||
public interface IAbilityDisc extends IAbilityEnergyProjectile {
|
||||
|
||||
/** @return Travel speed of the disc in blocks per tick. */
|
||||
float getSpeed();
|
||||
|
||||
/** @param speed Travel speed in blocks per tick. */
|
||||
void setSpeed(float speed);
|
||||
|
||||
/** @return Visual radius of the disc in blocks. */
|
||||
float getDiscRadius();
|
||||
|
||||
/** @param radius Disc radius in blocks. */
|
||||
void setDiscRadius(float radius);
|
||||
|
||||
/** @return Thickness of the disc in blocks. */
|
||||
float getDiscThickness();
|
||||
|
||||
/** @param thickness Disc thickness in blocks. */
|
||||
void setDiscThickness(float thickness);
|
||||
|
||||
/** @return Whether the disc spins on a vertical axis (blade-like). */
|
||||
boolean isVertical();
|
||||
|
||||
/** @param vertical Whether the disc spins vertically. */
|
||||
void setVertical(boolean vertical);
|
||||
|
||||
/** @return Whether the disc returns to the caster after reaching max distance. */
|
||||
boolean isBoomerang();
|
||||
|
||||
/** @param boomerang Whether the disc returns to the caster. */
|
||||
void setBoomerang(boolean boomerang);
|
||||
|
||||
/** @return Delay in ticks before the disc begins returning. */
|
||||
int getBoomerangDelay();
|
||||
|
||||
/** @param ticks Boomerang return delay in ticks. */
|
||||
void setBoomerangDelay(int ticks);
|
||||
|
||||
/** @return Whether the disc tracks its target. */
|
||||
boolean isHoming();
|
||||
|
||||
/** @param homing Whether to track the target. */
|
||||
void setHoming(boolean homing);
|
||||
|
||||
/** @return Homing turn strength (higher = tighter turns). */
|
||||
float getHomingStrength();
|
||||
|
||||
/** @param strength Homing turn strength. */
|
||||
void setHomingStrength(float strength);
|
||||
|
||||
/** @return Maximum distance at which homing activates, in blocks. */
|
||||
float getHomingRange();
|
||||
|
||||
/** @param range Maximum homing activation range in blocks. */
|
||||
void setHomingRange(float range);
|
||||
|
||||
/** @return Visual rotation speed of the disc in degrees per tick. */
|
||||
float getRotationSpeed();
|
||||
|
||||
/** @param speed Rotation speed in degrees per tick. */
|
||||
void setRotationSpeed(float speed);
|
||||
|
||||
/** @return Number of disc projectiles fired per use. */
|
||||
int getProjectileCount();
|
||||
|
||||
/** @param count Number of projectiles per use. */
|
||||
void setProjectileCount(int count);
|
||||
|
||||
/** @return Delay in ticks between each projectile in a multi-projectile volley. */
|
||||
int getFireDelay();
|
||||
|
||||
/** @param delay Delay in ticks between projectiles. */
|
||||
void setFireDelay(int delay);
|
||||
|
||||
// Indexed accessors (per-projectile overrides)
|
||||
|
||||
/**
|
||||
* @param projectileIndex Projectile index.
|
||||
* @return Inner color as a packed RGB integer.
|
||||
*/
|
||||
int getInnerColor(int projectileIndex);
|
||||
|
||||
/**
|
||||
* @param projectileIndex Projectile index.
|
||||
* @param color Inner color as a packed RGB integer.
|
||||
*/
|
||||
void setInnerColor(int projectileIndex, int color);
|
||||
|
||||
/**
|
||||
* @param projectileIndex Projectile index.
|
||||
* @return Outer color as a packed RGB integer.
|
||||
*/
|
||||
int getOuterColor(int projectileIndex);
|
||||
|
||||
/**
|
||||
* @param projectileIndex Projectile index.
|
||||
* @param color Outer color as a packed RGB integer.
|
||||
*/
|
||||
void setOuterColor(int projectileIndex, int color);
|
||||
|
||||
/**
|
||||
* @param projectileIndex Projectile index.
|
||||
* @return Anchor point ordinal.
|
||||
*/
|
||||
int getAnchorPoint(int projectileIndex);
|
||||
|
||||
/**
|
||||
* @param projectileIndex Projectile index.
|
||||
* @param point Anchor point ordinal.
|
||||
*/
|
||||
void setAnchorPoint(int projectileIndex, int point);
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package noppes.npcs.api.ability.type;
|
||||
|
||||
/**
|
||||
* API interface for Dodge abilities.
|
||||
* Cancels the incoming attack event entirely and plays a random dodge animation.
|
||||
*/
|
||||
public interface IAbilityDodge extends IAbilityDefend {
|
||||
|
||||
/** @return Animation ID for dodge variant 1, or -1 for none. */
|
||||
int getDodgeAnimation1Id();
|
||||
|
||||
/** @param animationId Animation ID, or -1 for none. */
|
||||
void setDodgeAnimation1Id(int animationId);
|
||||
|
||||
/** @return Animation ID for dodge variant 2, or -1 for none. */
|
||||
int getDodgeAnimation2Id();
|
||||
|
||||
/** @param animationId Animation ID, or -1 for none. */
|
||||
void setDodgeAnimation2Id(int animationId);
|
||||
|
||||
/** @return Animation ID for dodge variant 3, or -1 for none. */
|
||||
int getDodgeAnimation3Id();
|
||||
|
||||
/** @param animationId Animation ID, or -1 for none. */
|
||||
void setDodgeAnimation3Id(int animationId);
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package noppes.npcs.api.ability.type;
|
||||
|
||||
import noppes.npcs.api.ability.IAbility;
|
||||
|
||||
/**
|
||||
* API interface for Effect abilities.
|
||||
* Applies healing, potion effects, custom effects, and mod-registered effect actions
|
||||
* to self or nearby entities.
|
||||
*/
|
||||
public interface IAbilityEffect extends IAbility {
|
||||
|
||||
/** @return Duration of the effect in ticks. */
|
||||
int getDurationTicks();
|
||||
/** @param ticks Effect duration in ticks. */
|
||||
void setDurationTicks(int ticks);
|
||||
|
||||
/** @return Flat heal amount per tick (body HP). */
|
||||
float getHealAmount();
|
||||
/** @param amount Flat heal amount per tick. */
|
||||
void setHealAmount(float amount);
|
||||
|
||||
/** @return Heal amount as a percentage of max health per tick (0.0-100.0). */
|
||||
float getHealPercent();
|
||||
/** @param percent Heal percentage per tick (0.0-100.0). */
|
||||
void setHealPercent(float percent);
|
||||
|
||||
/** @return Whether the caster is also affected by the effect. */
|
||||
boolean isIncludeSelf();
|
||||
/** @param includeSelf Whether to include the caster. */
|
||||
void setIncludeSelf(boolean includeSelf);
|
||||
|
||||
/** @return Area-of-effect radius in blocks. */
|
||||
float getRadius();
|
||||
/** @param radius AoE radius in blocks. */
|
||||
void setRadius(float radius);
|
||||
|
||||
/** @return Whether healing is applied all at once instead of over time. */
|
||||
boolean isInstantHeal();
|
||||
/** @param instant Whether healing is instant. */
|
||||
void setInstantHeal(boolean instant);
|
||||
|
||||
/**
|
||||
* @return Target filter type ordinal: 0=ALLIES, 1=ENEMIES, 2=ALL
|
||||
*/
|
||||
int getTargetFilterType();
|
||||
|
||||
/**
|
||||
* @param filter Target filter type ordinal: 0=ALLIES, 1=ENEMIES, 2=ALL
|
||||
*/
|
||||
void setTargetFilterType(int filter);
|
||||
|
||||
/**
|
||||
* @return Number of configured custom effects (from CustomEffectController)
|
||||
*/
|
||||
int getCustomEffectCount();
|
||||
|
||||
/**
|
||||
* @return Number of configured mod-registered effect actions
|
||||
*/
|
||||
int getEffectActionCount();
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
package noppes.npcs.api.ability.type;
|
||||
|
||||
/**
|
||||
* API interface for Energy Beam abilities.
|
||||
* Homing beam head with trailing path attached to origin.
|
||||
*/
|
||||
public interface IAbilityEnergyBeam extends IAbilityEnergyProjectile {
|
||||
|
||||
/** @return Travel speed of the beam head in blocks per tick. */
|
||||
float getSpeed();
|
||||
|
||||
/** @param speed Travel speed in blocks per tick. */
|
||||
void setSpeed(float speed);
|
||||
|
||||
/** @return Width of the beam trail in blocks. */
|
||||
float getBeamWidth();
|
||||
|
||||
/** @param width Beam trail width in blocks. */
|
||||
void setBeamWidth(float width);
|
||||
|
||||
/** @return Size of the beam head sphere in blocks. */
|
||||
float getHeadSize();
|
||||
|
||||
/** @param size Beam head size in blocks. */
|
||||
void setHeadSize(float size);
|
||||
|
||||
/** @return Whether the beam head tracks its target. */
|
||||
boolean isHoming();
|
||||
|
||||
/** @param homing Whether to track the target. */
|
||||
void setHoming(boolean homing);
|
||||
|
||||
/** @return Homing turn strength (higher = tighter turns). */
|
||||
float getHomingStrength();
|
||||
|
||||
/** @param strength Homing turn strength. */
|
||||
void setHomingStrength(float strength);
|
||||
|
||||
/** @return Maximum distance at which homing activates, in blocks. */
|
||||
float getHomingRange();
|
||||
|
||||
/** @param range Maximum homing activation range in blocks. */
|
||||
void setHomingRange(float range);
|
||||
|
||||
/** @return Visual rotation speed of the beam head in degrees per tick. */
|
||||
float getRotationSpeed();
|
||||
|
||||
/** @param speed Rotation speed in degrees per tick. */
|
||||
void setRotationSpeed(float speed);
|
||||
|
||||
/** @return Number of beam projectiles fired per use. */
|
||||
int getProjectileCount();
|
||||
|
||||
/** @param count Number of projectiles per use. */
|
||||
void setProjectileCount(int count);
|
||||
|
||||
/** @return Delay in ticks between each projectile in a multi-projectile volley. */
|
||||
int getFireDelay();
|
||||
|
||||
/** @param delay Delay in ticks between projectiles. */
|
||||
void setFireDelay(int delay);
|
||||
|
||||
// Indexed accessors (per-projectile overrides)
|
||||
|
||||
/**
|
||||
* @param projectileIndex Projectile index.
|
||||
* @return Inner color as a packed RGB integer.
|
||||
*/
|
||||
int getInnerColor(int projectileIndex);
|
||||
|
||||
/**
|
||||
* @param projectileIndex Projectile index.
|
||||
* @param color Inner color as a packed RGB integer.
|
||||
*/
|
||||
void setInnerColor(int projectileIndex, int color);
|
||||
|
||||
/**
|
||||
* @param projectileIndex Projectile index.
|
||||
* @return Outer color as a packed RGB integer.
|
||||
*/
|
||||
int getOuterColor(int projectileIndex);
|
||||
|
||||
/**
|
||||
* @param projectileIndex Projectile index.
|
||||
* @param color Outer color as a packed RGB integer.
|
||||
*/
|
||||
void setOuterColor(int projectileIndex, int color);
|
||||
|
||||
/**
|
||||
* @param projectileIndex Projectile index.
|
||||
* @return Anchor point ordinal.
|
||||
*/
|
||||
int getAnchorPoint(int projectileIndex);
|
||||
|
||||
/**
|
||||
* @param projectileIndex Projectile index.
|
||||
* @param point Anchor point ordinal.
|
||||
*/
|
||||
void setAnchorPoint(int projectileIndex, int point);
|
||||
}
|
||||
@@ -0,0 +1,146 @@
|
||||
package noppes.npcs.api.ability.type;
|
||||
|
||||
import noppes.npcs.api.ability.IAbility;
|
||||
|
||||
/**
|
||||
* Shared API interface for energy projectile abilities (Orb, Disc, Beam, LaserShot).
|
||||
* Contains methods common to all energy projectile types.
|
||||
*/
|
||||
public interface IAbilityEnergyProjectile extends IAbility {
|
||||
|
||||
// ==================== COMBAT ====================
|
||||
|
||||
/** @return Base damage dealt on hit. */
|
||||
float getDamage();
|
||||
|
||||
/** @param damage Base damage on hit. */
|
||||
void setDamage(float damage);
|
||||
|
||||
/** @return Horizontal knockback strength applied on hit. */
|
||||
float getKnockback();
|
||||
|
||||
/** @param knockback Horizontal knockback strength. */
|
||||
void setKnockback(float knockback);
|
||||
|
||||
/** @return Vertical knockback strength applied on hit. */
|
||||
float getKnockbackUp();
|
||||
|
||||
/** @param knockback Vertical knockback strength. */
|
||||
void setKnockbackUp(float knockback);
|
||||
|
||||
/** @return Whether the projectile explodes on impact. */
|
||||
boolean isExplosive();
|
||||
|
||||
/** @param explosive Whether to explode on impact. */
|
||||
void setExplosive(boolean explosive);
|
||||
|
||||
/** @return Explosion radius in blocks. */
|
||||
float getExplosionRadius();
|
||||
|
||||
/** @param radius Explosion radius in blocks. */
|
||||
void setExplosionRadius(float radius);
|
||||
|
||||
/** @return Damage falloff multiplier over explosion distance (0.0-1.0). */
|
||||
float getExplosionDamageFalloff();
|
||||
|
||||
/** @param falloff Damage falloff multiplier (0.0-1.0). */
|
||||
void setExplosionDamageFalloff(float falloff);
|
||||
|
||||
/** @return Hit type ordinal (determines how repeated hits are handled). */
|
||||
int getHitType();
|
||||
|
||||
/** @param hitType Hit type ordinal. */
|
||||
void setHitType(int hitType);
|
||||
|
||||
/** @return Delay in ticks between repeated hits on the same target. */
|
||||
int getMultiHitDelayTicks();
|
||||
|
||||
/** @param delayTicks Delay in ticks between repeated hits. */
|
||||
void setMultiHitDelayTicks(int delayTicks);
|
||||
|
||||
/** @return Maximum number of times this projectile can hit the same target. */
|
||||
int getMaxHits();
|
||||
|
||||
/** @param maxHits Maximum hit count per target. */
|
||||
void setMaxHits(int maxHits);
|
||||
|
||||
// ==================== LIFESPAN ====================
|
||||
|
||||
/** @return Maximum travel distance in blocks before the projectile expires. */
|
||||
float getMaxDistance();
|
||||
|
||||
/** @param distance Maximum travel distance in blocks. */
|
||||
void setMaxDistance(float distance);
|
||||
|
||||
/** @return Maximum lifetime in ticks before the projectile expires. */
|
||||
int getMaxLifetime();
|
||||
|
||||
/** @param ticks Maximum lifetime in ticks. */
|
||||
void setMaxLifetime(int ticks);
|
||||
|
||||
// ==================== COLORS ====================
|
||||
|
||||
/** @return Inner (core) color as a packed RGB integer. */
|
||||
int getInnerColor();
|
||||
|
||||
/** @param color Inner color as a packed RGB integer. */
|
||||
void setInnerColor(int color);
|
||||
|
||||
/** @return Outer (glow) color as a packed RGB integer. */
|
||||
int getOuterColor();
|
||||
|
||||
/** @param color Outer color as a packed RGB integer. */
|
||||
void setOuterColor(int color);
|
||||
|
||||
/** @return Whether the outer color layer is rendered. */
|
||||
boolean isOuterColorEnabled();
|
||||
|
||||
/** @param enabled Whether to render the outer color layer. */
|
||||
void setOuterColorEnabled(boolean enabled);
|
||||
|
||||
/** @return Width of the outer color layer relative to the projectile size. */
|
||||
float getOuterColorWidth();
|
||||
|
||||
/** @param width Outer color layer width. */
|
||||
void setOuterColorWidth(float width);
|
||||
|
||||
/** @return Alpha (opacity) of the outer color layer (0.0-1.0). */
|
||||
float getOuterColorAlpha();
|
||||
|
||||
/** @param alpha Outer color opacity (0.0-1.0). */
|
||||
void setOuterColorAlpha(float alpha);
|
||||
|
||||
// ==================== LIGHTNING ====================
|
||||
|
||||
/** @return Whether the lightning visual effect is enabled. */
|
||||
boolean hasLightningEffect();
|
||||
|
||||
/** @param enabled Whether to enable the lightning effect. */
|
||||
void setLightningEffect(boolean enabled);
|
||||
|
||||
/** @return Density of lightning arcs (higher = more arcs). */
|
||||
float getLightningDensity();
|
||||
|
||||
/** @param density Lightning arc density. */
|
||||
void setLightningDensity(float density);
|
||||
|
||||
/** @return Radius of the lightning effect around the projectile, in blocks. */
|
||||
float getLightningRadius();
|
||||
|
||||
/** @param radius Lightning effect radius in blocks. */
|
||||
void setLightningRadius(float radius);
|
||||
|
||||
// ==================== ANCHOR ====================
|
||||
|
||||
/** @return Anchor point ordinal (0=FEET, 1=CENTER, 2=RIGHT_HAND, 3=LEFT_HAND, 4=HEAD, 5=FRONT, 6=ABOVE_HEAD). */
|
||||
int getAnchorPoint();
|
||||
|
||||
/** @param point Anchor point ordinal (0=FEET, 1=CENTER, 2=RIGHT_HAND, 3=LEFT_HAND, 4=HEAD, 5=FRONT, 6=ABOVE_HEAD). */
|
||||
void setAnchorPoint(int point);
|
||||
|
||||
/** @return Whether the projectile launches from its anchor position instead of the default eye/look-vector position. */
|
||||
boolean getLaunchFromAnchor();
|
||||
|
||||
/** @param launchFromAnchor When true, the projectile launches from its configured anchor position. */
|
||||
void setLaunchFromAnchor(boolean launchFromAnchor);
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package noppes.npcs.api.ability.type;
|
||||
|
||||
/**
|
||||
* API interface for Guard abilities.
|
||||
* Defensive stance that reduces incoming damage.
|
||||
*/
|
||||
public interface IAbilityGuard extends IAbilityDefend {
|
||||
|
||||
/** @return Damage reduction multiplier while guarding (0.0 = full block, 1.0 = no reduction). */
|
||||
float getDamageReduction();
|
||||
|
||||
/** @param reduction Damage reduction multiplier (0.0 = full block, 1.0 = no reduction). */
|
||||
void setDamageReduction(float reduction);
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package noppes.npcs.api.ability.type;
|
||||
|
||||
/**
|
||||
* API interface for Hazard abilities.
|
||||
* Persistent ground effect zones placed around the caster.
|
||||
*/
|
||||
public interface IAbilityHazard extends IAbilityZone {
|
||||
|
||||
/** @return Damage radius of the hazard zone in blocks. */
|
||||
float getRadius();
|
||||
|
||||
/** @param radius Damage radius in blocks. */
|
||||
void setRadius(float radius);
|
||||
|
||||
/** @return Damage dealt per damage interval tick. */
|
||||
float getDamagePerSecond();
|
||||
|
||||
/** @param damage Damage per interval. */
|
||||
void setDamagePerSecond(float damage);
|
||||
|
||||
/** @return Interval in ticks between damage applications. */
|
||||
int getDamageInterval();
|
||||
|
||||
/** @param interval Damage interval in ticks. */
|
||||
void setDamageInterval(int interval);
|
||||
|
||||
/** @return Whether the hazard also damages the caster. */
|
||||
boolean isAffectsCaster();
|
||||
|
||||
/** @param affects Whether the hazard affects the caster. */
|
||||
void setAffectsCaster(boolean affects);
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package noppes.npcs.api.ability.type;
|
||||
|
||||
import noppes.npcs.api.ability.IAbility;
|
||||
|
||||
/**
|
||||
* API interface for Heavy Hit abilities.
|
||||
* AOE rectangle melee attack in front of the caster.
|
||||
*/
|
||||
public interface IAbilityHeavyHit extends IAbility {
|
||||
|
||||
/** @return Damage dealt to entities in the hit area. */
|
||||
float getDamage();
|
||||
|
||||
/** @param damage Damage amount. */
|
||||
void setDamage(float damage);
|
||||
|
||||
/** @return Knockback strength applied to entities hit. */
|
||||
float getKnockback();
|
||||
|
||||
/** @param knockback Knockback strength. */
|
||||
void setKnockback(float knockback);
|
||||
|
||||
/** @return Length of the rectangular hit area in blocks (forward from caster). */
|
||||
float getHitLength();
|
||||
|
||||
/** @param hitLength Hit area length in blocks. */
|
||||
void setHitLength(float hitLength);
|
||||
|
||||
/** @return Width of the rectangular hit area in blocks. */
|
||||
float getHitWidth();
|
||||
|
||||
/** @param hitWidth Hit area width in blocks. */
|
||||
void setHitWidth(float hitWidth);
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package noppes.npcs.api.ability.type;
|
||||
|
||||
/**
|
||||
* API interface for Laser abilities.
|
||||
* Sweeping beam that follows the caster's look vector.
|
||||
*/
|
||||
public interface IAbilityLaser extends IAbilityEnergyProjectile {
|
||||
|
||||
/** @return Width of the laser beam in blocks. */
|
||||
float getLaserWidth();
|
||||
|
||||
/** @param width Laser beam width in blocks. */
|
||||
void setLaserWidth(float width);
|
||||
|
||||
/** @return Speed at which the laser extends to its max length, in blocks per tick. */
|
||||
float getExpansionSpeed();
|
||||
|
||||
/** @param speed Expansion speed in blocks per tick. */
|
||||
void setExpansionSpeed(float speed);
|
||||
|
||||
/** @return Maximum length the laser can reach in blocks. */
|
||||
float getMaxLength();
|
||||
|
||||
/** @param maxLength Maximum laser length in blocks. */
|
||||
void setMaxLength(float maxLength);
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
package noppes.npcs.api.ability.type;
|
||||
|
||||
/**
|
||||
* API interface for Orb abilities.
|
||||
* Homing projectile sphere.
|
||||
*/
|
||||
public interface IAbilityOrb extends IAbilityEnergyProjectile {
|
||||
|
||||
/** @return Travel speed of the orb in blocks per tick. */
|
||||
float getOrbSpeed();
|
||||
|
||||
/** @param speed Travel speed in blocks per tick. */
|
||||
void setOrbSpeed(float speed);
|
||||
|
||||
/** @return Visual size (radius) of the orb in blocks. */
|
||||
float getOrbSize();
|
||||
|
||||
/** @param size Orb size in blocks. */
|
||||
void setOrbSize(float size);
|
||||
|
||||
/** @return Whether the orb tracks its target. */
|
||||
boolean isHoming();
|
||||
|
||||
/** @param homing Whether to track the target. */
|
||||
void setHoming(boolean homing);
|
||||
|
||||
/** @return Homing turn strength (higher = tighter turns). */
|
||||
float getHomingStrength();
|
||||
|
||||
/** @param strength Homing turn strength. */
|
||||
void setHomingStrength(float strength);
|
||||
|
||||
/** @return Maximum distance at which homing activates, in blocks. */
|
||||
float getHomingRange();
|
||||
|
||||
/** @param range Maximum homing activation range in blocks. */
|
||||
void setHomingRange(float range);
|
||||
|
||||
/** @return Visual rotation speed of the orb in degrees per tick. */
|
||||
float getRotationSpeed();
|
||||
|
||||
/** @param speed Rotation speed in degrees per tick. */
|
||||
void setRotationSpeed(float speed);
|
||||
|
||||
/** @return Number of orb projectiles fired per use. */
|
||||
int getProjectileCount();
|
||||
|
||||
/** @param count Number of projectiles per use. */
|
||||
void setProjectileCount(int count);
|
||||
|
||||
/** @return Delay in ticks between each projectile in a multi-projectile volley. */
|
||||
int getFireDelay();
|
||||
|
||||
/** @param delay Delay in ticks between projectiles. */
|
||||
void setFireDelay(int delay);
|
||||
|
||||
// Indexed accessors (per-projectile overrides)
|
||||
|
||||
/**
|
||||
* @param projectileIndex Projectile index.
|
||||
* @return Inner color as a packed RGB integer.
|
||||
*/
|
||||
int getInnerColor(int projectileIndex);
|
||||
|
||||
/**
|
||||
* @param projectileIndex Projectile index.
|
||||
* @param color Inner color as a packed RGB integer.
|
||||
*/
|
||||
void setInnerColor(int projectileIndex, int color);
|
||||
|
||||
/**
|
||||
* @param projectileIndex Projectile index.
|
||||
* @return Outer color as a packed RGB integer.
|
||||
*/
|
||||
int getOuterColor(int projectileIndex);
|
||||
|
||||
/**
|
||||
* @param projectileIndex Projectile index.
|
||||
* @param color Outer color as a packed RGB integer.
|
||||
*/
|
||||
void setOuterColor(int projectileIndex, int color);
|
||||
|
||||
/**
|
||||
* @param projectileIndex Projectile index.
|
||||
* @return Anchor point ordinal.
|
||||
*/
|
||||
int getAnchorPoint(int projectileIndex);
|
||||
|
||||
/**
|
||||
* @param projectileIndex Projectile index.
|
||||
* @param point Anchor point ordinal.
|
||||
*/
|
||||
void setAnchorPoint(int projectileIndex, int point);
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package noppes.npcs.api.ability.type;
|
||||
|
||||
import noppes.npcs.api.ability.IAbility;
|
||||
|
||||
/**
|
||||
* API interface for Projectile abilities.
|
||||
* Ranged projectile attacks.
|
||||
*/
|
||||
public interface IAbilityProjectile extends IAbility {
|
||||
|
||||
/** @return Base damage dealt on hit. */
|
||||
float getDamage();
|
||||
|
||||
/** @param damage Base damage on hit. */
|
||||
void setDamage(float damage);
|
||||
|
||||
/** @return Travel speed of the projectile in blocks per tick. */
|
||||
float getSpeed();
|
||||
|
||||
/** @param speed Travel speed in blocks per tick. */
|
||||
void setSpeed(float speed);
|
||||
|
||||
/** @return Knockback strength applied on hit. */
|
||||
float getKnockback();
|
||||
|
||||
/** @param knockback Knockback strength. */
|
||||
void setKnockback(float knockback);
|
||||
|
||||
/** @return The projectile type identifier (e.g. arrow, snowball). */
|
||||
String getProjectileType();
|
||||
|
||||
/** @param type Projectile type identifier. */
|
||||
void setProjectileType(String type);
|
||||
|
||||
/** @return Whether the projectile explodes on impact. */
|
||||
boolean isExplosive();
|
||||
|
||||
/** @param explosive Whether to explode on impact. */
|
||||
void setExplosive(boolean explosive);
|
||||
|
||||
/** @return Explosion radius in blocks. */
|
||||
float getExplosionRadius();
|
||||
|
||||
/** @param radius Explosion radius in blocks. */
|
||||
void setExplosionRadius(float radius);
|
||||
|
||||
/** @return Whether the projectile tracks its target. */
|
||||
boolean isHoming();
|
||||
|
||||
/** @param homing Whether to track the target. */
|
||||
void setHoming(boolean homing);
|
||||
|
||||
/** @return Homing turn strength (higher = tighter turns). */
|
||||
float getHomingStrength();
|
||||
|
||||
/** @param strength Homing turn strength. */
|
||||
void setHomingStrength(float strength);
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package noppes.npcs.api.ability.type;
|
||||
|
||||
import noppes.npcs.api.ability.IAbility;
|
||||
|
||||
/**
|
||||
* API interface for Shockwave abilities.
|
||||
* Pushes targets away from the caster.
|
||||
*/
|
||||
public interface IAbilityShockwave extends IAbility {
|
||||
|
||||
/** @return Radius of the push effect in blocks. */
|
||||
float getPushRadius();
|
||||
|
||||
/** @param radius Push radius in blocks. */
|
||||
void setPushRadius(float radius);
|
||||
|
||||
/** @return Strength of the outward push force. */
|
||||
float getPushStrength();
|
||||
|
||||
/** @param strength Push force strength. */
|
||||
void setPushStrength(float strength);
|
||||
|
||||
/** @return Damage dealt to entities caught in the shockwave. */
|
||||
float getDamage();
|
||||
|
||||
/** @param damage Shockwave damage. */
|
||||
void setDamage(float damage);
|
||||
|
||||
/** @return Whether the shockwave hits all entities in radius (true) or only the target (false). */
|
||||
boolean isAoe();
|
||||
|
||||
/** @param aoe Whether the shockwave is area-of-effect. */
|
||||
void setAoe(boolean aoe);
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package noppes.npcs.api.ability.type;
|
||||
|
||||
import noppes.npcs.api.ability.IAbility;
|
||||
|
||||
/**
|
||||
* API interface for Slam abilities.
|
||||
* Ground-pound AOE attack with leap.
|
||||
*/
|
||||
public interface IAbilitySlam extends IAbility {
|
||||
|
||||
/** @return Damage dealt on ground impact. */
|
||||
float getDamage();
|
||||
|
||||
/** @param damage Impact damage amount. */
|
||||
void setDamage(float damage);
|
||||
|
||||
/** @return Radius of the impact area in blocks. */
|
||||
float getRadius();
|
||||
|
||||
/** @param radius Impact radius in blocks. */
|
||||
void setRadius(float radius);
|
||||
|
||||
/** @return Knockback strength applied to entities in the impact area. */
|
||||
float getKnockbackStrength();
|
||||
|
||||
/** @param knockback Knockback strength. */
|
||||
void setKnockbackStrength(float knockback);
|
||||
|
||||
/** @return Horizontal speed of the leap toward the target. */
|
||||
float getLeapSpeed();
|
||||
|
||||
/** @param speed Leap speed. */
|
||||
void setLeapSpeed(float speed);
|
||||
|
||||
/** @return Vertical height of the leap in blocks. */
|
||||
float getLeapHeight();
|
||||
|
||||
/** @param height Leap height in blocks. */
|
||||
void setLeapHeight(float height);
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
package noppes.npcs.api.ability.type;
|
||||
|
||||
import noppes.npcs.api.ability.IAbility;
|
||||
|
||||
/**
|
||||
* API interface for Sweeper abilities.
|
||||
* Low sweeping beam that rotates around the NPC.
|
||||
*/
|
||||
public interface IAbilitySweeper extends IAbility {
|
||||
|
||||
/** @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);
|
||||
|
||||
/** @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 interval Damage interval in ticks. */
|
||||
void setDamageInterval(int interval);
|
||||
|
||||
/** @return Whether the beam can hit through multiple targets. */
|
||||
boolean isPiercing();
|
||||
|
||||
/** @param piercing Whether the beam pierces through targets. */
|
||||
void setPiercing(boolean piercing);
|
||||
|
||||
/** @return Rotation speed of the sweep in degrees per tick. */
|
||||
float getSweepSpeed();
|
||||
|
||||
/** @param speed Sweep rotation speed in degrees per tick. */
|
||||
void setSweepSpeed(float speed);
|
||||
|
||||
/** @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);
|
||||
|
||||
/** @return Inner (core) color of the beam as a packed RGB integer. */
|
||||
int getInnerColor();
|
||||
|
||||
/** @param color Inner color as a packed RGB integer. */
|
||||
void setInnerColor(int color);
|
||||
|
||||
/** @return Outer (glow) color of the beam as a packed RGB integer. */
|
||||
int getOuterColor();
|
||||
|
||||
/** @param color Outer color as a packed RGB integer. */
|
||||
void setOuterColor(int color);
|
||||
|
||||
/** @return Width of the outer color layer relative to the beam width. */
|
||||
float getOuterColorWidth();
|
||||
|
||||
/** @param width Outer color layer width. */
|
||||
void setOuterColorWidth(float width);
|
||||
|
||||
/** @return Whether the outer color layer is rendered. */
|
||||
boolean isOuterColorEnabled();
|
||||
|
||||
/** @param enabled Whether to render the outer color layer. */
|
||||
void setOuterColorEnabled(boolean enabled);
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
package noppes.npcs.api.ability.type;
|
||||
|
||||
import noppes.npcs.api.ability.IAbility;
|
||||
|
||||
/**
|
||||
* API interface for Teleport abilities.
|
||||
* Instant repositioning with various modes.
|
||||
*/
|
||||
public interface IAbilityTeleport extends IAbility {
|
||||
|
||||
/** @return Teleport mode ordinal (0=BLINK, 1=BEHIND, 2=SINGLE). */
|
||||
int getMode();
|
||||
|
||||
/** @param mode Teleport mode ordinal (0=BLINK, 1=BEHIND, 2=SINGLE). */
|
||||
void setMode(int mode);
|
||||
|
||||
/** @return Number of rapid blink teleports in BLINK mode. */
|
||||
int getBlinkCount();
|
||||
|
||||
/** @param count Number of blink teleports. */
|
||||
void setBlinkCount(int count);
|
||||
|
||||
/** @return Delay in ticks between blink teleports. */
|
||||
int getBlinkDelayTicks();
|
||||
|
||||
/** @param ticks Delay in ticks between blinks. */
|
||||
void setBlinkDelayTicks(int ticks);
|
||||
|
||||
/** @return Maximum random offset radius for blink teleports in blocks. */
|
||||
float getBlinkRadius();
|
||||
|
||||
/** @param radius Blink offset radius in blocks. */
|
||||
void setBlinkRadius(float radius);
|
||||
|
||||
/** @return Distance behind the target to teleport to in BEHIND mode. */
|
||||
float getBehindDistance();
|
||||
|
||||
/** @param distance Behind-target distance in blocks. */
|
||||
void setBehindDistance(float distance);
|
||||
|
||||
/** @return Whether the teleport requires clear line of sight to the destination. */
|
||||
boolean isRequireLineOfSight();
|
||||
|
||||
/** @param require Whether line of sight is required. */
|
||||
void setRequireLineOfSight(boolean require);
|
||||
|
||||
/** @return Whether damage is dealt at the departure location. */
|
||||
boolean isDamageAtStart();
|
||||
|
||||
/** @param damage Whether to deal damage at departure. */
|
||||
void setDamageAtStart(boolean damage);
|
||||
|
||||
/** @return Whether damage is dealt at the arrival location. */
|
||||
boolean isDamageAtEnd();
|
||||
|
||||
/** @param damage Whether to deal damage at arrival. */
|
||||
void setDamageAtEnd(boolean damage);
|
||||
|
||||
/** @return Damage dealt at teleport locations. */
|
||||
float getDamage();
|
||||
|
||||
/** @param damage Teleport damage amount. */
|
||||
void setDamage(float damage);
|
||||
|
||||
/** @return Radius of the damage area at teleport locations in blocks. */
|
||||
float getDamageRadius();
|
||||
|
||||
/** @param radius Damage area radius in blocks. */
|
||||
void setDamageRadius(float radius);
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package noppes.npcs.api.ability.type;
|
||||
|
||||
/**
|
||||
* API interface for Trap abilities.
|
||||
* Proximity-triggered traps placed around the caster.
|
||||
*/
|
||||
public interface IAbilityTrap extends IAbilityZone {
|
||||
|
||||
/** @return Radius in blocks at which entities trigger the trap. */
|
||||
float getTriggerRadius();
|
||||
|
||||
/** @param radius Trigger detection radius in blocks. */
|
||||
void setTriggerRadius(float radius);
|
||||
|
||||
/** @return Time in ticks before the trap becomes active after placement. */
|
||||
int getArmTime();
|
||||
|
||||
/** @param ticks Arming time in ticks. */
|
||||
void setArmTime(int ticks);
|
||||
|
||||
/** @return Maximum number of times the trap can trigger before expiring. */
|
||||
int getMaxTriggers();
|
||||
|
||||
/** @param max Maximum trigger count. */
|
||||
void setMaxTriggers(int max);
|
||||
|
||||
/** @return Cooldown in ticks between consecutive triggers. */
|
||||
int getTriggerCooldown();
|
||||
|
||||
/** @param cooldown Trigger cooldown in ticks. */
|
||||
void setTriggerCooldown(int cooldown);
|
||||
|
||||
/** @return Damage dealt when the trap triggers. */
|
||||
float getDamage();
|
||||
|
||||
/** @param damage Trigger damage amount. */
|
||||
void setDamage(float damage);
|
||||
|
||||
/** @return Radius of the damage area when triggered, in blocks. */
|
||||
float getDamageRadius();
|
||||
|
||||
/** @param radius Damage area radius in blocks. */
|
||||
void setDamageRadius(float radius);
|
||||
|
||||
/** @return Knockback strength applied to entities caught in the trigger. */
|
||||
float getKnockback();
|
||||
|
||||
/** @param knockback Knockback strength. */
|
||||
void setKnockback(float knockback);
|
||||
|
||||
/** @return Whether the trap is visible to entities. */
|
||||
boolean isVisible();
|
||||
|
||||
/** @param visible Whether the trap is visible. */
|
||||
void setVisible(boolean visible);
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package noppes.npcs.api.ability.type;
|
||||
|
||||
import noppes.npcs.api.ability.IAbility;
|
||||
|
||||
/**
|
||||
* API interface for Vortex abilities.
|
||||
* Pulls targets toward the caster.
|
||||
*/
|
||||
public interface IAbilityVortex extends IAbility {
|
||||
|
||||
/** @return Radius of the pull effect in blocks. */
|
||||
float getPullRadius();
|
||||
|
||||
/** @param radius Pull effect radius in blocks. */
|
||||
void setPullRadius(float radius);
|
||||
|
||||
/** @return Strength of the inward pull force. */
|
||||
float getPullStrength();
|
||||
|
||||
/** @param strength Pull force strength. */
|
||||
void setPullStrength(float strength);
|
||||
|
||||
/** @return Damage dealt on initial vortex hit. */
|
||||
float getDamage();
|
||||
|
||||
/** @param damage Initial hit damage. */
|
||||
void setDamage(float damage);
|
||||
|
||||
/** @return Knockback strength applied on initial hit. */
|
||||
float getKnockback();
|
||||
|
||||
/** @param knockback Knockback strength. */
|
||||
void setKnockback(float knockback);
|
||||
|
||||
/** @return Whether the vortex hits all entities in radius (true) or only the target (false). */
|
||||
boolean isAoe();
|
||||
|
||||
/** @param aoe Whether the vortex is area-of-effect. */
|
||||
void setAoe(boolean aoe);
|
||||
|
||||
/** @return Whether continuous damage is dealt while pulling entities. */
|
||||
boolean isDamageOnPull();
|
||||
|
||||
/** @param damage Whether to deal damage during pull. */
|
||||
void setDamageOnPull(boolean damage);
|
||||
|
||||
/** @return Damage dealt per tick while pulling entities. */
|
||||
float getPullDamage();
|
||||
|
||||
/** @param damage Per-tick pull damage. */
|
||||
void setPullDamage(float damage);
|
||||
}
|
||||
@@ -0,0 +1,170 @@
|
||||
package noppes.npcs.api.ability.type;
|
||||
|
||||
import noppes.npcs.api.ability.IAbility;
|
||||
|
||||
/**
|
||||
* API interface for zone-based abilities (Trap, Hazard).
|
||||
* Shared zone properties: duration, shape, spawn, visual layers, colors.
|
||||
*/
|
||||
public interface IAbilityZone extends IAbility {
|
||||
|
||||
/** @return Duration of the zone in ticks. */
|
||||
int getDurationTicks();
|
||||
|
||||
/** @param ticks Zone duration in ticks. */
|
||||
void setDurationTicks(int ticks);
|
||||
|
||||
/** @return Zone shape ordinal (0=CIRCLE, 1=SQUARE). */
|
||||
int getZoneShapeOrdinal();
|
||||
|
||||
/** @param shape Zone shape ordinal (0=CIRCLE, 1=SQUARE). */
|
||||
void setZoneShapeOrdinal(int shape);
|
||||
|
||||
/** @return Spawn offset radius from the caster in blocks. */
|
||||
float getSpawnRadius();
|
||||
|
||||
/** @param radius Spawn offset radius in blocks. */
|
||||
void setSpawnRadius(float radius);
|
||||
|
||||
/** @return Number of zones spawned per use. */
|
||||
int getZoneCount();
|
||||
|
||||
/** @param count Number of zones to spawn. */
|
||||
void setZoneCount(int count);
|
||||
|
||||
/** @return Visual height of the zone in blocks. */
|
||||
float getZoneHeight();
|
||||
|
||||
/** @param height Zone height in blocks. */
|
||||
void setZoneHeight(float height);
|
||||
|
||||
/** @return Density of particles in the zone effect. */
|
||||
float getParticleDensity();
|
||||
|
||||
/** @param density Particle density. */
|
||||
void setParticleDensity(float density);
|
||||
|
||||
/** @return Scale of individual particles. */
|
||||
float getParticleScale();
|
||||
|
||||
/** @param scale Particle scale. */
|
||||
void setParticleScale(float scale);
|
||||
|
||||
/** @return Animation speed multiplier for zone visual effects. */
|
||||
float getAnimSpeed();
|
||||
|
||||
/** @param speed Animation speed multiplier. */
|
||||
void setAnimSpeed(float speed);
|
||||
|
||||
/** @return Density of lightning arcs in the zone. */
|
||||
float getLightningDensity();
|
||||
|
||||
/** @param density Lightning arc density. */
|
||||
void setLightningDensity(float density);
|
||||
|
||||
// ==================== COLORS ====================
|
||||
|
||||
/** @return Inner (core) color as a packed RGB integer. */
|
||||
int getInnerColor();
|
||||
|
||||
/** @param color Inner color as a packed RGB integer. */
|
||||
void setInnerColor(int color);
|
||||
|
||||
/** @return Outer (glow) color as a packed RGB integer. */
|
||||
int getOuterColor();
|
||||
|
||||
/** @param color Outer color as a packed RGB integer. */
|
||||
void setOuterColor(int color);
|
||||
|
||||
/** @return Whether the outer color layer is rendered. */
|
||||
boolean isOuterColorEnabled();
|
||||
|
||||
/** @param enabled Whether to render the outer color layer. */
|
||||
void setOuterColorEnabled(boolean enabled);
|
||||
|
||||
// ==================== VISUAL LAYERS ====================
|
||||
|
||||
/** @return Whether the ground fill layer is rendered. */
|
||||
boolean isGroundFill();
|
||||
|
||||
/** @param enabled Whether to render the ground fill. */
|
||||
void setGroundFill(boolean enabled);
|
||||
|
||||
/** @return Alpha (opacity) of the ground fill layer (0.0-1.0). */
|
||||
float getGroundAlpha();
|
||||
|
||||
/** @param alpha Ground fill opacity (0.0-1.0). */
|
||||
void setGroundAlpha(float alpha);
|
||||
|
||||
/** @return Whether ring decorations are rendered. */
|
||||
boolean isRings();
|
||||
|
||||
/** @param enabled Whether to render rings. */
|
||||
void setRings(boolean enabled);
|
||||
|
||||
/** @return Number of concentric rings in the zone. */
|
||||
int getRingCount();
|
||||
|
||||
/** @param count Number of rings. */
|
||||
void setRingCount(int count);
|
||||
|
||||
/** @return Whether the border outline is rendered. */
|
||||
boolean isBorder();
|
||||
|
||||
/** @param enabled Whether to render the border. */
|
||||
void setBorder(boolean enabled);
|
||||
|
||||
/** @return Rotation speed of the border in degrees per tick. */
|
||||
float getBorderSpeed();
|
||||
|
||||
/** @param speed Border rotation speed. */
|
||||
void setBorderSpeed(float speed);
|
||||
|
||||
/** @return Whether accent decorations are rendered. */
|
||||
boolean isAccents();
|
||||
|
||||
/** @param enabled Whether to render accents. */
|
||||
void setAccents(boolean enabled);
|
||||
|
||||
/** @return Accent style ordinal (0=STATIC, 1=SWAYING, 2=FLICKERING). */
|
||||
int getAccentStyle();
|
||||
|
||||
/** @param style Accent style ordinal (0=STATIC, 1=SWAYING, 2=FLICKERING). */
|
||||
void setAccentStyle(int style);
|
||||
|
||||
/** @return Whether lightning arcs are rendered in the zone. */
|
||||
boolean isLightning();
|
||||
|
||||
/** @param enabled Whether to render lightning. */
|
||||
void setLightning(boolean enabled);
|
||||
|
||||
/** @return Whether particles are rendered in the zone. */
|
||||
boolean isParticles();
|
||||
|
||||
/** @param enabled Whether to render particles. */
|
||||
void setParticles(boolean enabled);
|
||||
|
||||
/** @return Particle motion style ordinal (0=RISING, 1=DRIFTING, 2=SPARKS). */
|
||||
int getParticleMotion();
|
||||
|
||||
/** @param motion Particle motion style ordinal (0=RISING, 1=DRIFTING, 2=SPARKS). */
|
||||
void setParticleMotion(int motion);
|
||||
|
||||
/** @return Resource directory path for custom particle textures. */
|
||||
String getParticleDir();
|
||||
|
||||
/** @param directory Resource directory path for particle textures. */
|
||||
void setParticleDir(String directory);
|
||||
|
||||
/** @return Size of individual particles in pixels. */
|
||||
int getParticleSize();
|
||||
|
||||
/** @param size Particle size in pixels. */
|
||||
void setParticleSize(int size);
|
||||
|
||||
/** @return Whether particles use the glow (fullbright) render mode. */
|
||||
boolean isParticleGlow();
|
||||
|
||||
/** @param glow Whether particles glow. */
|
||||
void setParticleGlow(boolean glow);
|
||||
}
|
||||
@@ -72,17 +72,20 @@ public interface IBlockScripted extends IBlock {
|
||||
* Use /gamerule commandBlockOutput false/true to turn off/on command block feedback <br>
|
||||
* Setting NpcUseOpCommands to true in the CustomNPCs.cfg should allow the npc to run op commands, be warned this could be a major security risk, use at own risk <br>
|
||||
* For permission plugins the commands are run under uuid:c9c843f8-4cb1-4c82-aa61-e264291b7bd6 and name:[customnpcs]
|
||||
*
|
||||
* @param command The command to be executed
|
||||
*/
|
||||
void executeCommand(String command);
|
||||
|
||||
/**
|
||||
* 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);
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
@@ -3,10 +3,17 @@ package noppes.npcs.api.entity;
|
||||
import net.minecraft.entity.EntityCreature;
|
||||
import noppes.npcs.api.IPos;
|
||||
import noppes.npcs.api.ITimers;
|
||||
import noppes.npcs.api.ability.IDataAbilities;
|
||||
import noppes.npcs.api.entity.data.IHitboxData;
|
||||
import noppes.npcs.api.entity.data.IModelData;
|
||||
import noppes.npcs.api.entity.data.ITintData;
|
||||
import noppes.npcs.api.handler.IActionManager;
|
||||
import noppes.npcs.api.handler.IOverlayHandler;
|
||||
import noppes.npcs.api.handler.data.*;
|
||||
import noppes.npcs.api.handler.data.IAnimationData;
|
||||
import noppes.npcs.api.handler.data.IDialog;
|
||||
import noppes.npcs.api.handler.data.IFaction;
|
||||
import noppes.npcs.api.handler.data.ILines;
|
||||
import noppes.npcs.api.handler.data.IMagicData;
|
||||
import noppes.npcs.api.item.IItemStack;
|
||||
import noppes.npcs.api.jobs.IJob;
|
||||
import noppes.npcs.api.roles.IRole;
|
||||
@@ -291,6 +298,20 @@ public interface ICustomNpc<T extends EntityCreature> extends IEntityLiving<T>,
|
||||
*/
|
||||
boolean getProjectilesKeepTerrain();
|
||||
|
||||
/**
|
||||
* Sets whether the NPC has projectile invincibility frames.
|
||||
*
|
||||
* @param invincible true to enable projectile invincibility, false to disable.
|
||||
*/
|
||||
void setProjectileInvincibility(boolean invincible);
|
||||
|
||||
/**
|
||||
* Returns whether the NPC has projectile invincibility frames.
|
||||
*
|
||||
* @return true if projectile invincibility is enabled, false otherwise.
|
||||
*/
|
||||
boolean getProjectileInvincibility();
|
||||
|
||||
/**
|
||||
* Makes the NPC broadcast a message.
|
||||
*
|
||||
@@ -373,6 +394,104 @@ public interface ICustomNpc<T extends EntityCreature> extends IEntityLiving<T>,
|
||||
*/
|
||||
ILines getKillLines();
|
||||
|
||||
/**
|
||||
* Returns whether NPC dialog lines are played in order.
|
||||
*
|
||||
* @return true if lines are ordered, false if random.
|
||||
*/
|
||||
boolean getOrderedLines();
|
||||
|
||||
/**
|
||||
* Sets whether NPC dialog lines are played in order.
|
||||
*
|
||||
* @param ordered true for ordered, false for random.
|
||||
*/
|
||||
void setOrderedLines(boolean ordered);
|
||||
|
||||
/**
|
||||
* Returns the NPC's idle sound resource path.
|
||||
*
|
||||
* @return the idle sound path, or empty string if none.
|
||||
*/
|
||||
String getIdleSound();
|
||||
|
||||
/**
|
||||
* Sets the NPC's idle sound resource path.
|
||||
*
|
||||
* @param sound the idle sound path.
|
||||
*/
|
||||
void setIdleSound(String sound);
|
||||
|
||||
/**
|
||||
* Returns the NPC's angry/aggro sound resource path.
|
||||
*
|
||||
* @return the angry sound path, or empty string if none.
|
||||
*/
|
||||
String getAngrySound();
|
||||
|
||||
/**
|
||||
* Sets the NPC's angry/aggro sound resource path.
|
||||
*
|
||||
* @param sound the angry sound path.
|
||||
*/
|
||||
void setAngrySound(String sound);
|
||||
|
||||
/**
|
||||
* Returns the NPC's hurt sound resource path.
|
||||
*
|
||||
* @return the hurt sound path.
|
||||
*/
|
||||
String getHurtSound();
|
||||
|
||||
/**
|
||||
* Sets the NPC's hurt sound resource path.
|
||||
*
|
||||
* @param sound the hurt sound path.
|
||||
*/
|
||||
void setHurtSound(String sound);
|
||||
|
||||
/**
|
||||
* Returns the NPC's death sound resource path.
|
||||
*
|
||||
* @return the death sound path.
|
||||
*/
|
||||
String getDeathSound();
|
||||
|
||||
/**
|
||||
* Sets the NPC's death sound resource path.
|
||||
*
|
||||
* @param sound the death sound path.
|
||||
*/
|
||||
void setDeathSound(String sound);
|
||||
|
||||
/**
|
||||
* Returns the NPC's step/footstep sound resource path.
|
||||
*
|
||||
* @return the step sound path, or empty string if none.
|
||||
*/
|
||||
String getStepSound();
|
||||
|
||||
/**
|
||||
* Sets the NPC's step/footstep sound resource path.
|
||||
*
|
||||
* @param sound the step sound path.
|
||||
*/
|
||||
void setStepSound(String sound);
|
||||
|
||||
/**
|
||||
* Returns whether pitch variation is disabled for NPC sounds.
|
||||
*
|
||||
* @return true if pitch is disabled (fixed pitch), false otherwise.
|
||||
*/
|
||||
boolean getDisablePitch();
|
||||
|
||||
/**
|
||||
* Sets whether pitch variation is disabled for NPC sounds.
|
||||
*
|
||||
* @param disablePitch true to disable pitch variation, false to allow.
|
||||
*/
|
||||
void setDisablePitch(boolean disablePitch);
|
||||
|
||||
/**
|
||||
* Kills the NPC without despawning it.
|
||||
*/
|
||||
@@ -494,7 +613,7 @@ public interface ICustomNpc<T extends EntityCreature> extends IEntityLiving<T>,
|
||||
/**
|
||||
* Gets the Aim Type for an NPC
|
||||
*
|
||||
* @return 0: No, 1: Yes, 2: On Shot
|
||||
* @return 0: No, 1: Yes, 2: On Shot
|
||||
*/
|
||||
byte getAimType();
|
||||
|
||||
@@ -707,6 +826,14 @@ public interface ICustomNpc<T extends EntityCreature> extends IEntityLiving<T>,
|
||||
*/
|
||||
boolean getCanDrown();
|
||||
|
||||
/**
|
||||
* Sets whether the NPC can drown.
|
||||
* Shorthand: sets drowning type to 1 (drowns in water) if true, 0 (never drowns) if false.
|
||||
*
|
||||
* @param canDrown true to allow drowning, false to prevent.
|
||||
*/
|
||||
void setCanDrown(boolean canDrown);
|
||||
|
||||
/**
|
||||
* Sets the drowning behavior of the NPC.
|
||||
*
|
||||
@@ -798,6 +925,286 @@ public interface ICustomNpc<T extends EntityCreature> extends IEntityLiving<T>,
|
||||
*/
|
||||
int getTacticalRadius();
|
||||
|
||||
/**
|
||||
* Returns the tactical behavior chance (1 in N).
|
||||
*
|
||||
* @return the tactical chance.
|
||||
*/
|
||||
int getTacticalChance();
|
||||
|
||||
/**
|
||||
* Sets the tactical behavior chance (1 in N).
|
||||
*
|
||||
* @param chance the tactical chance.
|
||||
*/
|
||||
void setTacticalChance(int chance);
|
||||
|
||||
/**
|
||||
* Returns whether the NPC can swim.
|
||||
*
|
||||
* @return true if the NPC can swim, false otherwise.
|
||||
*/
|
||||
boolean getCanSwim();
|
||||
|
||||
/**
|
||||
* Sets whether the NPC can swim.
|
||||
*
|
||||
* @param canSwim true to enable swimming, false to disable.
|
||||
*/
|
||||
void setCanSwim(boolean canSwim);
|
||||
|
||||
/**
|
||||
* Returns whether the NPC reacts to fire.
|
||||
*
|
||||
* @return true if the NPC reacts to fire, false otherwise.
|
||||
*/
|
||||
boolean getReactsToFire();
|
||||
|
||||
/**
|
||||
* Sets whether the NPC reacts to fire.
|
||||
*
|
||||
* @param reactsToFire true to react, false otherwise.
|
||||
*/
|
||||
void setReactsToFire(boolean reactsToFire);
|
||||
|
||||
/**
|
||||
* Returns whether the NPC avoids water.
|
||||
*
|
||||
* @return true if the NPC avoids water, false otherwise.
|
||||
*/
|
||||
boolean getAvoidsWater();
|
||||
|
||||
/**
|
||||
* Sets whether the NPC avoids water.
|
||||
*
|
||||
* @param avoidsWater true to avoid water, false otherwise.
|
||||
*/
|
||||
void setAvoidsWater(boolean avoidsWater);
|
||||
|
||||
/**
|
||||
* Returns whether the NPC avoids sunlight.
|
||||
*
|
||||
* @return true if the NPC avoids the sun, false otherwise.
|
||||
*/
|
||||
boolean getAvoidsSun();
|
||||
|
||||
/**
|
||||
* Sets whether the NPC avoids sunlight.
|
||||
*
|
||||
* @param avoidsSun true to avoid sunlight, false otherwise.
|
||||
*/
|
||||
void setAvoidsSun(boolean avoidsSun);
|
||||
|
||||
/**
|
||||
* Returns whether the NPC requires direct line-of-sight to attack.
|
||||
*
|
||||
* @return true if direct LOS is required, false otherwise.
|
||||
*/
|
||||
boolean getDirectLOS();
|
||||
|
||||
/**
|
||||
* Sets whether the NPC requires direct line-of-sight to attack.
|
||||
*
|
||||
* @param directLOS true to require LOS, false otherwise.
|
||||
*/
|
||||
void setDirectLOS(boolean directLOS);
|
||||
|
||||
/**
|
||||
* Returns the NPC's leap attack type.
|
||||
*
|
||||
* @return the leap type.
|
||||
*/
|
||||
int getLeapType();
|
||||
|
||||
/**
|
||||
* Sets the NPC's leap attack type.
|
||||
*
|
||||
* @param leapType the leap type.
|
||||
*/
|
||||
void setLeapType(int leapType);
|
||||
|
||||
/**
|
||||
* Returns whether the NPC can sprint.
|
||||
*
|
||||
* @return true if sprinting is enabled, false otherwise.
|
||||
*/
|
||||
boolean getCanSprint();
|
||||
|
||||
/**
|
||||
* Sets whether the NPC can sprint.
|
||||
*
|
||||
* @param canSprint true to enable sprinting, false to disable.
|
||||
*/
|
||||
void setCanSprint(boolean canSprint);
|
||||
|
||||
/**
|
||||
* Returns whether the NPC stops moving to interact with players.
|
||||
*
|
||||
* @return true if the NPC stops to interact, false otherwise.
|
||||
*/
|
||||
boolean getStopAndInteract();
|
||||
|
||||
/**
|
||||
* Sets whether the NPC stops moving to interact with players.
|
||||
*
|
||||
* @param stopAndInteract true to stop and interact, false otherwise.
|
||||
*/
|
||||
void setStopAndInteract(boolean stopAndInteract);
|
||||
|
||||
/**
|
||||
* Returns the NPC's door interaction behavior.
|
||||
*
|
||||
* @return the door interaction mode (0: Break, 1: Open, 2: Disabled).
|
||||
*/
|
||||
int getDoorInteract();
|
||||
|
||||
/**
|
||||
* Sets the NPC's door interaction behavior.
|
||||
*
|
||||
* @param doorInteract the door interaction mode (0: Break, 1: Open, 2: Disabled).
|
||||
*/
|
||||
void setDoorInteract(int doorInteract);
|
||||
|
||||
/**
|
||||
* Returns the NPC's walking range (wander radius).
|
||||
*
|
||||
* @return the walking range.
|
||||
*/
|
||||
int getWalkingRange();
|
||||
|
||||
/**
|
||||
* Sets the NPC's walking range (wander radius).
|
||||
*
|
||||
* @param range the walking range.
|
||||
*/
|
||||
void setWalkingRange(int range);
|
||||
|
||||
/**
|
||||
* Returns whether the NPC interacts with other NPCs.
|
||||
*
|
||||
* @return true if NPC interaction is enabled, false otherwise.
|
||||
*/
|
||||
boolean getNpcInteracting();
|
||||
|
||||
/**
|
||||
* Sets whether the NPC interacts with other NPCs.
|
||||
*
|
||||
* @param npcInteracting true to enable, false to disable.
|
||||
*/
|
||||
void setNpcInteracting(boolean npcInteracting);
|
||||
|
||||
/**
|
||||
* Returns whether the NPC pauses at path points.
|
||||
*
|
||||
* @return true if the NPC pauses at path points, false otherwise.
|
||||
*/
|
||||
boolean getMovingPause();
|
||||
|
||||
/**
|
||||
* Sets whether the NPC pauses at path points.
|
||||
*
|
||||
* @param movingPause true to pause, false otherwise.
|
||||
*/
|
||||
void setMovingPause(boolean movingPause);
|
||||
|
||||
/**
|
||||
* Returns the NPC's path movement pattern.
|
||||
*
|
||||
* @return the moving pattern (0: Looping, 1: Backtracking).
|
||||
*/
|
||||
int getMovingPattern();
|
||||
|
||||
/**
|
||||
* Sets the NPC's path movement pattern.
|
||||
*
|
||||
* @param pattern the moving pattern (0: Looping, 1: Backtracking).
|
||||
*/
|
||||
void setMovingPattern(int pattern);
|
||||
|
||||
/**
|
||||
* Returns whether the NPC fires indirect (arcing) projectiles.
|
||||
*
|
||||
* @return the indirect fire mode.
|
||||
*/
|
||||
int getCanFireIndirect();
|
||||
|
||||
/**
|
||||
* Sets whether the NPC fires indirect (arcing) projectiles.
|
||||
*
|
||||
* @param canFireIndirect the indirect fire mode.
|
||||
*/
|
||||
void setCanFireIndirect(int canFireIndirect);
|
||||
|
||||
/**
|
||||
* Returns the NPC's use-range-melee mode.
|
||||
*
|
||||
* @return the use-range-melee mode.
|
||||
*/
|
||||
int getUseRangeMelee();
|
||||
|
||||
/**
|
||||
* Sets the NPC's use-range-melee mode.
|
||||
*
|
||||
* @param useRangeMelee the use-range-melee mode.
|
||||
*/
|
||||
void setUseRangeMelee(int useRangeMelee);
|
||||
|
||||
/**
|
||||
* Returns the distance at which the NPC switches from ranged to melee.
|
||||
*
|
||||
* @return the distance to melee.
|
||||
*/
|
||||
int getDistanceToMelee();
|
||||
|
||||
/**
|
||||
* Sets the distance at which the NPC switches from ranged to melee.
|
||||
*
|
||||
* @param distance the distance to melee.
|
||||
*/
|
||||
void setDistanceToMelee(int distance);
|
||||
|
||||
/**
|
||||
* Returns the NPC's body X offset.
|
||||
*
|
||||
* @return the body X offset.
|
||||
*/
|
||||
float getBodyOffsetX();
|
||||
|
||||
/**
|
||||
* Sets the NPC's body X offset.
|
||||
*
|
||||
* @param offsetX the body X offset.
|
||||
*/
|
||||
void setBodyOffsetX(float offsetX);
|
||||
|
||||
/**
|
||||
* Returns the NPC's body Y offset.
|
||||
*
|
||||
* @return the body Y offset.
|
||||
*/
|
||||
float getBodyOffsetY();
|
||||
|
||||
/**
|
||||
* Sets the NPC's body Y offset.
|
||||
*
|
||||
* @param offsetY the body Y offset.
|
||||
*/
|
||||
void setBodyOffsetY(float offsetY);
|
||||
|
||||
/**
|
||||
* Returns the NPC's body Z offset.
|
||||
*
|
||||
* @return the body Z offset.
|
||||
*/
|
||||
float getBodyOffsetZ();
|
||||
|
||||
/**
|
||||
* Sets the NPC's body Z offset.
|
||||
*
|
||||
* @param offsetZ the body Z offset.
|
||||
*/
|
||||
void setBodyOffsetZ(float offsetZ);
|
||||
|
||||
/**
|
||||
* Sets whether the NPC ignores cobwebs.
|
||||
*
|
||||
@@ -1168,6 +1575,20 @@ public interface ICustomNpc<T extends EntityCreature> extends IEntityLiving<T>,
|
||||
*/
|
||||
IModelData getModelData();
|
||||
|
||||
/**
|
||||
* Returns the hitbox data associated with the NPC.
|
||||
*
|
||||
* @return the hitbox data.
|
||||
*/
|
||||
IHitboxData getHitboxData();
|
||||
|
||||
/**
|
||||
* Returns the tint data associated with the NPC.
|
||||
*
|
||||
* @return the tint data.
|
||||
*/
|
||||
ITintData getTintData();
|
||||
|
||||
/**
|
||||
* (Deprecated) Sets the head scale of the NPC.
|
||||
*
|
||||
@@ -1264,6 +1685,104 @@ public interface ICustomNpc<T extends EntityCreature> extends IEntityLiving<T>,
|
||||
*/
|
||||
double getKnockbackResistance();
|
||||
|
||||
/**
|
||||
* Returns whether all damage to this NPC is disabled.
|
||||
*
|
||||
* @return true if damage is disabled, false otherwise.
|
||||
*/
|
||||
boolean getDamageDisabled();
|
||||
|
||||
/**
|
||||
* Sets whether all damage to this NPC is disabled.
|
||||
*
|
||||
* @param disabled true to disable all damage, false otherwise.
|
||||
*/
|
||||
void setDamageDisabled(boolean disabled);
|
||||
|
||||
/**
|
||||
* Returns whether the NPC takes no fall damage.
|
||||
*
|
||||
* @return true if fall damage is disabled, false otherwise.
|
||||
*/
|
||||
boolean getNoFallDamage();
|
||||
|
||||
/**
|
||||
* Sets whether the NPC takes no fall damage.
|
||||
*
|
||||
* @param noFallDamage true to disable fall damage, false to enable.
|
||||
*/
|
||||
void setNoFallDamage(boolean noFallDamage);
|
||||
|
||||
/**
|
||||
* Returns whether the NPC is immune to fire.
|
||||
*
|
||||
* @return true if immune to fire, false otherwise.
|
||||
*/
|
||||
boolean getImmuneToFire();
|
||||
|
||||
/**
|
||||
* Sets whether the NPC is immune to fire.
|
||||
*
|
||||
* @param immuneToFire true to make immune, false otherwise.
|
||||
*/
|
||||
void setImmuneToFire(boolean immuneToFire);
|
||||
|
||||
/**
|
||||
* Returns whether the NPC is immune to potion effects.
|
||||
*
|
||||
* @return true if potion immune, false otherwise.
|
||||
*/
|
||||
boolean getPotionImmune();
|
||||
|
||||
/**
|
||||
* Sets whether the NPC is immune to potion effects.
|
||||
*
|
||||
* @param potionImmune true to make immune, false otherwise.
|
||||
*/
|
||||
void setPotionImmune(boolean potionImmune);
|
||||
|
||||
/**
|
||||
* Returns whether the NPC burns in sunlight.
|
||||
*
|
||||
* @return true if the NPC burns in the sun, false otherwise.
|
||||
*/
|
||||
boolean getBurnInSun();
|
||||
|
||||
/**
|
||||
* Sets whether the NPC burns in sunlight.
|
||||
*
|
||||
* @param burnInSun true to burn in sunlight, false otherwise.
|
||||
*/
|
||||
void setBurnInSun(boolean burnInSun);
|
||||
|
||||
/**
|
||||
* Returns whether the NPC can attack invisible targets.
|
||||
*
|
||||
* @return true if the NPC attacks invisible entities, false otherwise.
|
||||
*/
|
||||
boolean getAttackInvisible();
|
||||
|
||||
/**
|
||||
* Sets whether the NPC can attack invisible targets.
|
||||
*
|
||||
* @param attackInvisible true to allow attacking invisible entities, false otherwise.
|
||||
*/
|
||||
void setAttackInvisible(boolean attackInvisible);
|
||||
|
||||
/**
|
||||
* Returns the NPC's creature type.
|
||||
*
|
||||
* @return the creature type ordinal (0: Undefined, 1: Undead, 2: Arthropod).
|
||||
*/
|
||||
int getCreatureType();
|
||||
|
||||
/**
|
||||
* Sets the NPC's creature type.
|
||||
*
|
||||
* @param type the creature type ordinal (0: Undefined, 1: Undead, 2: Arthropod).
|
||||
*/
|
||||
void setCreatureType(int type);
|
||||
|
||||
/**
|
||||
* Sets the NPC's retaliation type.
|
||||
*
|
||||
@@ -1457,6 +1976,20 @@ public interface ICustomNpc<T extends EntityCreature> extends IEntityLiving<T>,
|
||||
*/
|
||||
String getOverlayTexture();
|
||||
|
||||
/**
|
||||
* Returns the NPC's glow texture path.
|
||||
*
|
||||
* @return the glow texture path, or empty string if none.
|
||||
*/
|
||||
String getGlowTexture();
|
||||
|
||||
/**
|
||||
* Sets the NPC's glow texture path.
|
||||
*
|
||||
* @param texture the glow texture path.
|
||||
*/
|
||||
void setGlowTexture(String texture);
|
||||
|
||||
/**
|
||||
* Returns the NPC's overlay handler.
|
||||
*
|
||||
@@ -1501,4 +2034,20 @@ public interface ICustomNpc<T extends EntityCreature> extends IEntityLiving<T>,
|
||||
* @return Magic data
|
||||
*/
|
||||
IMagicData getMagicData();
|
||||
|
||||
/**
|
||||
* Returns the Ability Data of an NPC.
|
||||
* Allows access to the NPC's abilities system including
|
||||
* force-starting abilities and executing preset abilities.
|
||||
*
|
||||
* @return Ability data
|
||||
*/
|
||||
IDataAbilities getAbilityData();
|
||||
|
||||
/**
|
||||
* Returns all active energy projectiles fired by this NPC.
|
||||
*
|
||||
* @return Array of active energy projectiles, empty array if none
|
||||
*/
|
||||
IEnergyProjectile[] getActiveEnergyProjectiles();
|
||||
}
|
||||
@@ -0,0 +1,127 @@
|
||||
package noppes.npcs.api.entity;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import noppes.npcs.api.INbt;
|
||||
import noppes.npcs.api.handler.data.IMagicData;
|
||||
|
||||
/**
|
||||
* Base interface for all energy ability entities (Projectiles, Barriers).
|
||||
* Contains shared display, lightning, owner, and charging properties.
|
||||
*/
|
||||
public interface IEnergyAbility<T extends Entity> extends IEntity<T> {
|
||||
|
||||
// ==================== OWNER ====================
|
||||
|
||||
/** @return Entity ID of the caster who spawned this energy ability. */
|
||||
int getOwnerEntityId();
|
||||
|
||||
/** @return The caster entity who spawned this energy ability, or null if not found. */
|
||||
IEntity getOwner();
|
||||
|
||||
// ==================== DISPLAY ====================
|
||||
|
||||
/** @return Inner (core) color as a packed RGB integer. */
|
||||
int getInnerColor();
|
||||
|
||||
/** @param color Inner color as a packed RGB integer. */
|
||||
void setInnerColor(int color);
|
||||
|
||||
/** @return Alpha (opacity) of the inner color layer (0.0-1.0). */
|
||||
float getInnerAlpha();
|
||||
|
||||
/** @param alpha Inner color opacity (0.0-1.0). */
|
||||
void setInnerAlpha(float alpha);
|
||||
|
||||
/** @return Outer (glow) color as a packed RGB integer. */
|
||||
int getOuterColor();
|
||||
|
||||
/** @param color Outer color as a packed RGB integer. */
|
||||
void setOuterColor(int color);
|
||||
|
||||
/** @return Whether the outer color layer is rendered. */
|
||||
boolean isOuterColorEnabled();
|
||||
|
||||
/** @param enabled Whether to render the outer color layer. */
|
||||
void setOuterColorEnabled(boolean enabled);
|
||||
|
||||
/** @return Width of the outer color layer relative to the entity size. */
|
||||
float getOuterColorWidth();
|
||||
|
||||
/** @param width Outer color layer width. */
|
||||
void setOuterColorWidth(float width);
|
||||
|
||||
/** @return Alpha (opacity) of the outer color layer (0.0-1.0). */
|
||||
float getOuterColorAlpha();
|
||||
|
||||
/** @param alpha Outer color opacity (0.0-1.0). */
|
||||
void setOuterColorAlpha(float alpha);
|
||||
|
||||
// ==================== LIGHTNING ====================
|
||||
|
||||
/** @return Whether the lightning visual effect is enabled. */
|
||||
boolean hasLightningEffect();
|
||||
|
||||
/** @param enabled Whether to render the lightning effect. */
|
||||
void setLightningEffect(boolean enabled);
|
||||
|
||||
/** @return Density of lightning arcs (higher = more arcs). */
|
||||
float getLightningDensity();
|
||||
|
||||
/** @param density Lightning arc density. */
|
||||
void setLightningDensity(float density);
|
||||
|
||||
/** @return Radius of the lightning effect around the entity, in blocks. */
|
||||
float getLightningRadius();
|
||||
|
||||
/** @param radius Lightning effect radius in blocks. */
|
||||
void setLightningRadius(float radius);
|
||||
|
||||
/** @return Fade-out time for lightning arcs in ticks. */
|
||||
int getLightningFadeTime();
|
||||
|
||||
/** @param ticks Lightning fade-out time in ticks. */
|
||||
void setLightningFadeTime(int ticks);
|
||||
|
||||
// ==================== STATE ====================
|
||||
|
||||
/** @return Whether this energy ability is currently in its charging phase. */
|
||||
boolean isCharging();
|
||||
|
||||
/** @return Charge progress as a fraction (0.0-1.0). */
|
||||
float getChargeProgress();
|
||||
|
||||
/** @return Whether this entity ignores target invulnerability frames when dealing damage. */
|
||||
boolean isIgnoreIFrames();
|
||||
|
||||
/** @param ignore Whether this entity should ignore target invulnerability frames when dealing damage. */
|
||||
void setIgnoreIFrames(boolean ignore);
|
||||
|
||||
// ==================== CUSTOM DAMAGE DATA ====================
|
||||
|
||||
/**
|
||||
* Get the custom damage data attached to this energy entity.
|
||||
* Used by addon handlers (e.g. DBC Addon) to carry damage configuration
|
||||
* directly on the entity, enabling DBC damage scaling without a sourceAbility.
|
||||
* @return Custom damage data as INbt, or null if none set.
|
||||
*/
|
||||
INbt getDamageData();
|
||||
|
||||
/**
|
||||
* Set custom damage data on this energy entity.
|
||||
* @param data Custom damage data as INbt. Pass null to clear.
|
||||
*/
|
||||
void setDamageData(INbt data);
|
||||
|
||||
/**
|
||||
* Get this entity's magic data. Defines magic types for outgoing damage splits
|
||||
* or barrier defense interactions. Inherited from the source ability on spawn.
|
||||
* @return the entity's magic data
|
||||
*/
|
||||
IMagicData getMagicData();
|
||||
|
||||
/**
|
||||
* Set magic data on this energy entity. Overrides any inherited ability magic.
|
||||
* @param data Magic data to set.
|
||||
*/
|
||||
void setMagicData(IMagicData data);
|
||||
}
|
||||
@@ -0,0 +1,149 @@
|
||||
package noppes.npcs.api.entity;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
|
||||
/**
|
||||
* Base interface for energy barrier entities (Dome, Panel).
|
||||
* Barriers are defensive structures that block incoming energy projectiles.
|
||||
* Extends IEnergyAbility for shared display/lightning/owner/charging methods.
|
||||
*/
|
||||
public interface IEnergyBarrier<T extends Entity> extends IEnergyAbility<T> {
|
||||
|
||||
// ==================== HEALTH ====================
|
||||
|
||||
float getCurrentHealth();
|
||||
|
||||
void setCurrentHealth(float health);
|
||||
|
||||
float getHealthPercent();
|
||||
|
||||
float getMaxHealth();
|
||||
|
||||
void setMaxHealth(float maxHealth);
|
||||
|
||||
boolean isUseHealth();
|
||||
|
||||
void setUseHealth(boolean useHealth);
|
||||
|
||||
// ==================== DURATION ====================
|
||||
|
||||
int getDuration();
|
||||
|
||||
void setDuration(int ticks);
|
||||
|
||||
boolean isUseDuration();
|
||||
|
||||
void setUseDuration(boolean useDuration);
|
||||
|
||||
// ==================== STATE (BARRIER-SPECIFIC) ====================
|
||||
|
||||
int getTicksAlive();
|
||||
|
||||
// ==================== BARRIER ====================
|
||||
|
||||
float getDefaultMultiplier();
|
||||
|
||||
void setDefaultMultiplier(float multiplier);
|
||||
|
||||
boolean isSolid();
|
||||
|
||||
void setSolid(boolean solid);
|
||||
|
||||
boolean isKnockbackEnabled();
|
||||
|
||||
void setKnockbackEnabled(boolean enabled);
|
||||
|
||||
float getKnockbackStrength();
|
||||
|
||||
void setKnockbackStrength(float strength);
|
||||
|
||||
/**
|
||||
* Returns whether this barrier absorbs damage on behalf of its owner.
|
||||
* When absorbing is enabled, incoming damage to the barrier's owner is redirected
|
||||
* to the barrier instead, subject to the absorb radius check.
|
||||
*
|
||||
* @return {@code true} if the barrier absorbs the owner's incoming damage
|
||||
* @see #getAbsorbRadius()
|
||||
*/
|
||||
boolean isAbsorbing();
|
||||
|
||||
/**
|
||||
* Sets whether this barrier absorbs damage on behalf of its owner.
|
||||
* When absorbing is enabled, incoming damage to the barrier's owner is redirected
|
||||
* to the barrier instead, subject to the absorb radius check.
|
||||
*
|
||||
* @param absorbing {@code true} to enable damage absorption for the owner
|
||||
* @see #setAbsorbRadius(float)
|
||||
*/
|
||||
void setAbsorbing(boolean absorbing);
|
||||
|
||||
/**
|
||||
* Gets the absorb radius for this barrier.
|
||||
* The absorb radius determines the maximum distance from the barrier's current
|
||||
* position at which the owner's incoming damage will still be redirected to the barrier.
|
||||
* This check uses the barrier entity's live position, so it works correctly with
|
||||
* moving barriers (following domes, moving walls, shields, etc.).
|
||||
*
|
||||
* <ul>
|
||||
* <li>{@code -1} = No distance limit. Damage is always absorbed regardless of distance.</li>
|
||||
* <li>{@code 0} = Uses the barrier's own geometric extent as the effective radius.
|
||||
* <ul>
|
||||
* <li>Domes: the dome radius (sphere radius in blocks).</li>
|
||||
* <li>Panels: {@code (max(width, height) * 0.5 + 1.0) * 3}
|
||||
* (i.e. {@code max(width, height) * 1.5 + 3.0} blocks).</li>
|
||||
* </ul>
|
||||
* </li>
|
||||
* <li>Positive values = The owner must be within this many blocks of the barrier entity.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @return the absorb radius in blocks, or {@code -1} for unlimited, or {@code 0} for barrier extent
|
||||
*/
|
||||
float getAbsorbRadius();
|
||||
|
||||
/**
|
||||
* Sets the absorb radius for this barrier.
|
||||
* The absorb radius determines the maximum distance from the barrier's current
|
||||
* position at which the owner's incoming damage will still be redirected to the barrier.
|
||||
* This check uses the barrier entity's live position, so it works correctly with
|
||||
* moving barriers (following domes, moving walls, shields, etc.).
|
||||
*
|
||||
* <ul>
|
||||
* <li>{@code -1} = No distance limit. Damage is always absorbed regardless of distance.</li>
|
||||
* <li>{@code 0} = Uses the barrier's own geometric extent as the effective radius.
|
||||
* <ul>
|
||||
* <li>Domes: the dome radius (sphere radius in blocks).</li>
|
||||
* <li>Panels: {@code (max(width, height) * 0.5 + 1.0) * 3}
|
||||
* (i.e. {@code max(width, height) * 1.5 + 3.0} blocks).</li>
|
||||
* </ul>
|
||||
* </li>
|
||||
* <li>Positive values = The owner must be within this many blocks of the barrier entity.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @param radius the absorb radius in blocks, or {@code -1} for unlimited, or {@code 0} for barrier extent
|
||||
*/
|
||||
void setAbsorbRadius(float radius);
|
||||
|
||||
/**
|
||||
* Returns the barrier type: 0=Dome, 1=Panel
|
||||
* @return the barrier type ordinal
|
||||
*/
|
||||
int getBarrierType();
|
||||
|
||||
// ==================== SYNC ====================
|
||||
|
||||
/**
|
||||
* Sends all current visual and barrier-specific data to tracking clients.
|
||||
* <p>
|
||||
* Call this <b>after</b> making batch changes to properties like colors, alpha,
|
||||
* lightning, dome radius, panel dimensions, etc. This sends a single packet
|
||||
* instead of one per setter call.
|
||||
* <p>
|
||||
* Example:
|
||||
* <pre>
|
||||
* dome.setInnerColor(0xFF0000);
|
||||
* dome.setDomeRadius(5.0);
|
||||
* dome.syncClient(); // one packet for all changes
|
||||
* </pre>
|
||||
*/
|
||||
void syncClient();
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package noppes.npcs.api.entity;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
|
||||
/**
|
||||
* A directional beam projectile with a trailing path and optional head orb.
|
||||
* <p>
|
||||
* Beams travel forward from their origin, dealing damage along their length.
|
||||
* They can optionally stay attached to their owner and follow the owner's movement.
|
||||
* <p>
|
||||
* Beams use {@code startFiring} internally rather than {@code startMoving} —
|
||||
* this is handled automatically by the fire methods.
|
||||
*/
|
||||
public interface IEnergyBeam<T extends Entity> extends IEnergyProjectile<T> {
|
||||
|
||||
/**
|
||||
* Width of the beam trail.
|
||||
* @return the beam width in blocks
|
||||
*/
|
||||
float getBeamWidth();
|
||||
|
||||
void setBeamWidth(float width);
|
||||
|
||||
float getHeadSize();
|
||||
|
||||
void setHeadSize(float size);
|
||||
|
||||
boolean isAttachedToOwner();
|
||||
|
||||
void setAttachedToOwner(boolean attached);
|
||||
|
||||
boolean shouldRenderTailOrb();
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package noppes.npcs.api.entity;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
|
||||
/**
|
||||
* A flat spinning disc projectile with optional boomerang behavior.
|
||||
* <p>
|
||||
* Discs can be oriented vertically or horizontally, and can return to their owner
|
||||
* like a boomerang after a configurable delay.
|
||||
*/
|
||||
public interface IEnergyDisc<T extends Entity> extends IEnergyProjectile<T> {
|
||||
|
||||
/**
|
||||
* Radius of the disc.
|
||||
* @return the disc radius in blocks
|
||||
*/
|
||||
float getDiscRadius();
|
||||
|
||||
void setDiscRadius(float radius);
|
||||
|
||||
float getDiscThickness();
|
||||
|
||||
void setDiscThickness(float thickness);
|
||||
|
||||
boolean isVertical();
|
||||
|
||||
void setVertical(boolean vertical);
|
||||
|
||||
boolean isBoomerang();
|
||||
|
||||
void setBoomerang(boolean boomerang);
|
||||
|
||||
int getBoomerangDelay();
|
||||
|
||||
void setBoomerangDelay(int ticks);
|
||||
|
||||
boolean isReturning();
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package noppes.npcs.api.entity;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
|
||||
/**
|
||||
* Represents an energy dome barrier - a spherical shield centered on the caster.
|
||||
*/
|
||||
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);
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package noppes.npcs.api.entity;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import noppes.npcs.api.IEnergyHandler;
|
||||
|
||||
/**
|
||||
* Represents a standalone energy explosion entity.
|
||||
* Created via {@link IEnergyHandler#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
|
||||
* with distance-based falloff, routing through energy damage handlers for addon integration.
|
||||
*/
|
||||
public interface IEnergyExplosion<T extends Entity> extends IEnergyAbility<T> {
|
||||
|
||||
// ==================== RADIUS & DURATION ====================
|
||||
|
||||
/** @return The maximum explosion radius in blocks. */
|
||||
float getRadius();
|
||||
|
||||
/** @param radius Maximum explosion radius in blocks (clamped 0.5-50). Duration auto-scales. */
|
||||
void setRadius(float radius);
|
||||
|
||||
/** @return Duration of the explosion visual in ticks (auto-calculated from radius). */
|
||||
int getDuration();
|
||||
|
||||
// ==================== DAMAGE ====================
|
||||
|
||||
/** @return Base damage dealt at the center. 0 means visual-only. */
|
||||
float getDamage();
|
||||
|
||||
/** @param damage Base damage at the center. Setting > 0 enables damage. */
|
||||
void setDamage(float damage);
|
||||
|
||||
/** @return Base knockback strength. */
|
||||
float getKnockback();
|
||||
|
||||
/** @param knockback Base knockback strength. */
|
||||
void setKnockback(float knockback);
|
||||
|
||||
/** @return Upward knockback component. */
|
||||
float getKnockbackUp();
|
||||
|
||||
/** @param knockbackUp Upward knockback component. */
|
||||
void setKnockbackUp(float knockbackUp);
|
||||
|
||||
/** @return Damage falloff factor (0=no falloff, 1=full falloff at edge). */
|
||||
float getDamageFalloff();
|
||||
|
||||
/** @param falloff Damage falloff factor (0-1). At 0.5, edge damage = 50% of center. */
|
||||
void setDamageFalloff(float falloff);
|
||||
|
||||
// ==================== SPAWNING ====================
|
||||
|
||||
/**
|
||||
* Spawn this explosion entity into the world.
|
||||
* Sends the visual to nearby clients and, if damage > 0, applies area damage on the first tick.
|
||||
*/
|
||||
void spawn();
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package noppes.npcs.api.entity;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
|
||||
/**
|
||||
* A continuous laser beam that extends outward from its origin along a direction vector.
|
||||
* <p>
|
||||
* Unlike other projectiles, lasers don't move through the world — they extend from their
|
||||
* origin point along a direction, hitting everything in their path up to {@link #getMaxLength()}.
|
||||
* The direction can be set explicitly via {@link #setDirection(double, double, double)}.
|
||||
* <p>
|
||||
* The coordinate-based {@code fireAt(x, y, z)} calculates and sets the direction vector
|
||||
* automatically, then uses the laser's internal launch sequence.
|
||||
*/
|
||||
public interface IEnergyLaser<T extends Entity> extends IEnergyProjectile<T> {
|
||||
|
||||
/**
|
||||
* Width of the laser beam.
|
||||
* @return the laser width in blocks
|
||||
*/
|
||||
float getLaserWidth();
|
||||
|
||||
void setLaserWidth(float width);
|
||||
|
||||
float getExpansionSpeed();
|
||||
|
||||
void setExpansionSpeed(float speed);
|
||||
|
||||
float getMaxLength();
|
||||
|
||||
void setMaxLength(float maxLength);
|
||||
|
||||
float getCurrentLength();
|
||||
|
||||
boolean isFullyExtended();
|
||||
|
||||
double getDirX();
|
||||
|
||||
double getDirY();
|
||||
|
||||
double getDirZ();
|
||||
|
||||
void setDirection(double x, double y, double z);
|
||||
|
||||
double getEndX();
|
||||
|
||||
double getEndY();
|
||||
|
||||
double getEndZ();
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package noppes.npcs.api.entity;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
|
||||
/**
|
||||
* A spherical homing energy ball.
|
||||
* <p>
|
||||
* Orbs travel in a straight line toward their target and can optionally home in on living entities.
|
||||
* Use the base {@link IEnergyProjectile} methods for size, speed, damage, homing, and launch control.
|
||||
* <p>
|
||||
* Example usage:
|
||||
* <pre>
|
||||
* // Fire from a specific position toward a target
|
||||
* var orb = API.getEnergyController().createOrb(world, player, x, y, z, 1.0);
|
||||
* orb.setDamage(10);
|
||||
* orb.setHoming(true);
|
||||
* orb.fireAt(target); // launches from (x,y,z) toward target
|
||||
*
|
||||
* // Fire from the caster's eye position using look-vector snap
|
||||
* var orb2 = API.getEnergyController().createOrb(world, player, 0, 0, 0, 1.0);
|
||||
* orb2.fireFrom(player, target); // repositions to player's eye, then fires toward target
|
||||
* </pre>
|
||||
*/
|
||||
public interface IEnergyOrb<T extends Entity> extends IEnergyProjectile<T> {
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package noppes.npcs.api.entity;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
|
||||
/**
|
||||
* Represents an energy panel barrier - a flat rectangular shield (Wall or Shield mode).
|
||||
*/
|
||||
public interface IEnergyPanel<T extends Entity> extends IEnergyBarrier<T> {
|
||||
|
||||
float getPanelWidth();
|
||||
|
||||
void setPanelWidth(float width);
|
||||
|
||||
float getPanelHeight();
|
||||
|
||||
void setPanelHeight(float height);
|
||||
|
||||
float getPanelYaw();
|
||||
|
||||
void setPanelYaw(float yaw);
|
||||
|
||||
/**
|
||||
* Panel mode: 0=PLACED, 1=HELD, 2=LAUNCHED
|
||||
* @return the panel mode ordinal
|
||||
*/
|
||||
int getPanelMode();
|
||||
|
||||
void setPanelMode(int mode);
|
||||
|
||||
boolean isLaunched();
|
||||
|
||||
/** Spawn this panel entity into the world. */
|
||||
void spawn();
|
||||
}
|
||||
@@ -0,0 +1,280 @@
|
||||
package noppes.npcs.api.entity;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
|
||||
/**
|
||||
* Base interface for all energy projectile entities (Orb, Beam, Disc, Laser, Slicer).
|
||||
* <p>
|
||||
* Extends {@link IEnergyAbility} for shared display, lightning, owner, and charging methods.
|
||||
* <p>
|
||||
* <b>Fire methods — launch from current position (no repositioning):</b>
|
||||
* <ul>
|
||||
* <li>{@link #fireAt(IEntity)} — toward an entity</li>
|
||||
* <li>{@link #fireAt(double, double, double)} — toward world coordinates</li>
|
||||
* <li>{@link #fireDirection(float, float)} — in a yaw/pitch direction</li>
|
||||
* </ul>
|
||||
* <b>FireFrom methods — reposition to caster's eye, then launch (look-vector snap):</b>
|
||||
* <ul>
|
||||
* <li>{@link #fireFrom(IEntityLivingBase)} — fire along caster's look direction</li>
|
||||
* <li>{@link #fireFrom(IEntityLivingBase, IEntity)} — fire toward a target entity</li>
|
||||
* </ul>
|
||||
*/
|
||||
public interface IEnergyProjectile<T extends Entity> extends IEnergyAbility<T> {
|
||||
|
||||
// ==================== OWNER & TARGET ====================
|
||||
|
||||
/**
|
||||
* 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 */
|
||||
int getTargetEntityId();
|
||||
|
||||
/** @return the current homing/tracking target entity, or null if none */
|
||||
IEntity getTarget();
|
||||
|
||||
/**
|
||||
* Sets the homing/tracking target entity. Pass null to clear.
|
||||
* @param target the entity to home towards
|
||||
*/
|
||||
void setTarget(IEntity target);
|
||||
|
||||
// ==================== SIZE ====================
|
||||
|
||||
/** @return the projectile's visual and collision size */
|
||||
float getSize();
|
||||
|
||||
/**
|
||||
* Sets the projectile's visual and collision size.
|
||||
* @param size the projectile size
|
||||
*/
|
||||
void setSize(float size);
|
||||
|
||||
// ==================== DISPLAY (PROJECTILE-SPECIFIC) ====================
|
||||
|
||||
/** @return the visual rotation speed (degrees per tick) */
|
||||
float getRotationSpeed();
|
||||
|
||||
void setRotationSpeed(float speed);
|
||||
|
||||
// ==================== INTERPOLATION (READ-ONLY) ====================
|
||||
|
||||
float getInterpolatedRotationX(float partialTicks);
|
||||
|
||||
float getInterpolatedRotationY(float partialTicks);
|
||||
|
||||
float getInterpolatedRotationZ(float partialTicks);
|
||||
|
||||
float getInterpolatedSize(float partialTicks);
|
||||
|
||||
// ==================== LIFESPAN ====================
|
||||
|
||||
/** @return maximum travel distance before the projectile despawns (0 = unlimited) */
|
||||
float getMaxDistance();
|
||||
|
||||
void setMaxDistance(float distance);
|
||||
|
||||
/** @return maximum lifetime in ticks before the projectile despawns (0 = unlimited) */
|
||||
int getMaxLifetime();
|
||||
|
||||
void setMaxLifetime(int ticks);
|
||||
|
||||
// ==================== COMBAT ====================
|
||||
|
||||
/** @return base damage dealt on hit */
|
||||
float getDamage();
|
||||
|
||||
void setDamage(float damage);
|
||||
|
||||
/** @return horizontal knockback strength */
|
||||
float getKnockback();
|
||||
|
||||
void setKnockback(float knockback);
|
||||
|
||||
/** @return upward knockback strength */
|
||||
float getKnockbackUp();
|
||||
|
||||
void setKnockbackUp(float knockbackUp);
|
||||
|
||||
/** @return true if the projectile explodes on impact */
|
||||
boolean isExplosive();
|
||||
|
||||
void setExplosive(boolean explosive);
|
||||
|
||||
/** @return explosion radius (only used if {@link #isExplosive()} is true) */
|
||||
float getExplosionRadius();
|
||||
|
||||
void setExplosionRadius(float radius);
|
||||
|
||||
/** @return damage falloff multiplier over explosion radius (0 = no falloff, 1 = full falloff) */
|
||||
float getExplosionDamageFalloff();
|
||||
|
||||
void setExplosionDamageFalloff(float falloff);
|
||||
|
||||
/** @return hit behavior type (0 = single hit, 1 = pierce, 2 = multi-hit with delay) */
|
||||
int getHitType();
|
||||
|
||||
void setHitType(int hitType);
|
||||
|
||||
/** @return ticks between multi-hit damage ticks on the same entity */
|
||||
int getMultiHitDelayTicks();
|
||||
|
||||
void setMultiHitDelayTicks(int delayTicks);
|
||||
|
||||
/** @return maximum number of entities this projectile can hit (0 = unlimited) */
|
||||
int getMaxHits();
|
||||
|
||||
void setMaxHits(int maxHits);
|
||||
|
||||
// ==================== MOVEMENT ====================
|
||||
|
||||
/** @return travel speed (blocks per tick) */
|
||||
float getSpeed();
|
||||
|
||||
void setSpeed(float speed);
|
||||
|
||||
/** @return true if the projectile homes toward its target */
|
||||
boolean isHoming();
|
||||
|
||||
void setHoming(boolean homing);
|
||||
|
||||
/** @return how aggressively the projectile turns toward its target (higher = tighter turns) */
|
||||
float getHomingStrength();
|
||||
|
||||
void setHomingStrength(float strength);
|
||||
|
||||
/** @return maximum range at which homing will acquire/track a target */
|
||||
float getHomingRange();
|
||||
|
||||
void setHomingRange(float range);
|
||||
|
||||
// ==================== ANCHOR ====================
|
||||
|
||||
/** @return anchor point type used during the charge/windup phase */
|
||||
int getAnchor();
|
||||
|
||||
float getAnchorOffsetX();
|
||||
|
||||
float getAnchorOffsetY();
|
||||
|
||||
float getAnchorOffsetZ();
|
||||
|
||||
// ==================== POSITION ====================
|
||||
|
||||
/** @return X coordinate where the projectile was launched from */
|
||||
double getStartX();
|
||||
|
||||
/** @return Y coordinate where the projectile was launched from */
|
||||
double getStartY();
|
||||
|
||||
/** @return Z coordinate where the projectile was launched from */
|
||||
double getStartZ();
|
||||
|
||||
// ==================== STATE ====================
|
||||
|
||||
/** @return true if the projectile has hit something */
|
||||
boolean hasHit();
|
||||
|
||||
/**
|
||||
* Returns the energy projectile sub-type.
|
||||
* @return 0=Orb, 1=Beam, 2=Disc, 3=Laser, 4=Slicer
|
||||
*/
|
||||
int getEnergyType();
|
||||
|
||||
// ==================== SYNC ====================
|
||||
|
||||
/**
|
||||
* Sends all current visual, movement, and position data to tracking clients.
|
||||
* <p>
|
||||
* Call this <b>after</b> making batch changes to properties like size, speed,
|
||||
* homing, colors, or type-specific fields (beam width, disc radius, etc.).
|
||||
* This avoids sending a separate packet for every setter call.
|
||||
* <p>
|
||||
* <b>Note:</b> {@code fireAt()}, {@code fireDirection()}, and {@code fireFrom()}
|
||||
* automatically sync motion when called on an already-spawned projectile,
|
||||
* so you do not need to call {@code syncClient()} after firing.
|
||||
* Use this method when changing properties that affect rendering or movement
|
||||
* behavior without re-firing.
|
||||
* <p>
|
||||
* Example:
|
||||
* <pre>
|
||||
* orb.setSize(2.0);
|
||||
* orb.setSpeed(0.5);
|
||||
* orb.setInnerColor(0xFF0000);
|
||||
* orb.syncClient(); // one packet for all changes
|
||||
* </pre>
|
||||
*/
|
||||
void syncClient();
|
||||
|
||||
// ==================== FIRE / LAUNCH ====================
|
||||
|
||||
/**
|
||||
* Spawns the projectile and launches it from its <b>current position</b> toward the target entity.
|
||||
* <p>
|
||||
* No look-vector repositioning occurs — the projectile fires from exactly where it was
|
||||
* placed by {@code createOrb}/{@code createBeam}/etc. If the target is a living entity,
|
||||
* it is also set as the homing target for projectiles with homing enabled.
|
||||
* <p>
|
||||
* To launch from the owner's eye position with look-vector snapping, use
|
||||
* {@link #fireFrom(IEntityLivingBase, IEntity)} instead.
|
||||
*
|
||||
* @param target the entity to fire toward (can be null for untargeted launch)
|
||||
*/
|
||||
void fireAt(IEntity target);
|
||||
|
||||
/**
|
||||
* Spawns the projectile and launches it toward the specified world coordinates.
|
||||
* <p>
|
||||
* The projectile fires from its <b>current position</b> — no look-vector repositioning occurs.
|
||||
* Motion is calculated as a normalized direction vector scaled by the projectile's speed.
|
||||
*
|
||||
* @param x target X coordinate
|
||||
* @param y target Y coordinate
|
||||
* @param z target Z coordinate
|
||||
*/
|
||||
void fireAt(double x, double y, double z);
|
||||
|
||||
/**
|
||||
* Spawns the projectile and launches it in the specified yaw/pitch direction.
|
||||
* <p>
|
||||
* The projectile fires from its <b>current position</b> — no look-vector repositioning occurs.
|
||||
*
|
||||
* @param yaw horizontal angle in degrees (0 = south, 90 = west, like Minecraft yaw)
|
||||
* @param pitch vertical angle in degrees (negative = up, positive = down)
|
||||
*/
|
||||
void fireDirection(float yaw, float pitch);
|
||||
|
||||
/**
|
||||
* Sets the owner, positions the projectile at the caster's eye level, and launches it
|
||||
* using the entity's full launch sequence ({@code startMoving}/{@code startFiring}).
|
||||
* <p>
|
||||
* For player-owned projectiles, this <b>snaps the projectile to the owner's look-vector
|
||||
* position</b> and fires in the caster's look direction. This is the intended method for
|
||||
* "cast from self" behavior. The projectile's position set by {@code createOrb}/etc. is
|
||||
* overridden.
|
||||
* <p>
|
||||
* Use {@link #fireAt(IEntity)} or {@link #fireAt(double, double, double)} instead if you
|
||||
* want to launch from a specific custom position.
|
||||
*
|
||||
* @param caster the entity to fire from
|
||||
*/
|
||||
void fireFrom(IEntityLivingBase caster);
|
||||
|
||||
/**
|
||||
* Sets the owner, positions the projectile at the caster's eye level, and launches it
|
||||
* toward the target entity using the entity's full launch sequence.
|
||||
* <p>
|
||||
* For player-owned projectiles, this <b>snaps the projectile to the owner's look-vector
|
||||
* position</b> before firing toward the target. The projectile's position set by
|
||||
* {@code createOrb}/etc. is overridden.
|
||||
* <p>
|
||||
* Use {@link #fireAt(IEntity)} instead if you want to launch from a specific custom position.
|
||||
*
|
||||
* @param caster the entity to fire from
|
||||
* @param target the entity to fire toward
|
||||
*/
|
||||
void fireFrom(IEntityLivingBase caster, IEntity target);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package noppes.npcs.api.entity;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
|
||||
/**
|
||||
* A thin, wide blade projectile that slices through targets.
|
||||
* <p>
|
||||
* Slicers travel in a straight line, cutting through entities in their path.
|
||||
*/
|
||||
public interface IEnergySlicer<T extends Entity> extends IEnergyProjectile<T> {
|
||||
|
||||
/**
|
||||
* Width of the slicer blade.
|
||||
* @return the width of each slice in blocks
|
||||
*/
|
||||
float getSliceWidth();
|
||||
|
||||
void setSliceWidth(float width);
|
||||
|
||||
float getSliceThickness();
|
||||
|
||||
void setSliceThickness(float thickness);
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
package noppes.npcs.api.entity;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
|
||||
/**
|
||||
* Entity-level interface for sweeper beam entities.
|
||||
* Created via IEnergyHandler.createSweeper().
|
||||
* Configure properties, then call spawn() to place in the world.
|
||||
*/
|
||||
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 ====================
|
||||
|
||||
/** Spawn this sweeper entity into the world. */
|
||||
void spawn();
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
package noppes.npcs.api.entity;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
|
||||
/**
|
||||
* Entity-level interface for zone entities (Hazard and Trap).
|
||||
* Created via IEnergyHandler.createHazard() or createTrap().
|
||||
* Configure properties, then call spawn() to place in the world.
|
||||
*/
|
||||
public interface IEnergyZone<T extends Entity> extends IEntity<T> {
|
||||
|
||||
// ==================== ZONE TYPE ====================
|
||||
|
||||
/** @return Zone type: 0=Trap, 1=Hazard */
|
||||
int getZoneType();
|
||||
|
||||
// ==================== COMMON ZONE PROPERTIES ====================
|
||||
|
||||
/** @return Zone shape: 0=Circle, 1=Square */
|
||||
int getZoneShape();
|
||||
void setZoneShape(int shape);
|
||||
|
||||
float getRadius();
|
||||
void setRadius(float radius);
|
||||
|
||||
float getZoneHeight();
|
||||
void setZoneHeight(float height);
|
||||
|
||||
int getDuration();
|
||||
void setDuration(int ticks);
|
||||
|
||||
// ==================== COLORS ====================
|
||||
|
||||
int getInnerColor();
|
||||
void setInnerColor(int color);
|
||||
|
||||
int getOuterColor();
|
||||
void setOuterColor(int color);
|
||||
|
||||
boolean isOuterColorEnabled();
|
||||
void setOuterColorEnabled(boolean enabled);
|
||||
|
||||
// ==================== VISUALS ====================
|
||||
|
||||
float getParticleDensity();
|
||||
void setParticleDensity(float density);
|
||||
|
||||
float getParticleScale();
|
||||
void setParticleScale(float scale);
|
||||
|
||||
float getAnimSpeed();
|
||||
void setAnimSpeed(float speed);
|
||||
|
||||
boolean isIgnoreIFrames();
|
||||
void setIgnoreIFrames(boolean ignore);
|
||||
|
||||
// ==================== HAZARD-SPECIFIC ====================
|
||||
|
||||
float getDamagePerSecond();
|
||||
void setDamagePerSecond(float dps);
|
||||
|
||||
int getDamageInterval();
|
||||
void setDamageInterval(int ticks);
|
||||
|
||||
boolean isAffectsCaster();
|
||||
void setAffectsCaster(boolean affects);
|
||||
|
||||
// ==================== TRAP-SPECIFIC ====================
|
||||
|
||||
float getTriggerRadius();
|
||||
void setTriggerRadius(float radius);
|
||||
|
||||
int getArmTime();
|
||||
void setArmTime(int ticks);
|
||||
|
||||
int getMaxTriggers();
|
||||
void setMaxTriggers(int max);
|
||||
|
||||
int getTriggerCooldown();
|
||||
void setTriggerCooldown(int ticks);
|
||||
|
||||
float getDamage();
|
||||
void setDamage(float damage);
|
||||
|
||||
float getKnockback();
|
||||
void setKnockback(float knockback);
|
||||
|
||||
boolean isVisible();
|
||||
void setVisible(boolean visible);
|
||||
|
||||
// ==================== CUSTOM DAMAGE DATA ====================
|
||||
|
||||
/**
|
||||
* 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.
|
||||
* @param data the damage configuration NBT
|
||||
*/
|
||||
void setDamageData(noppes.npcs.api.INbt data);
|
||||
|
||||
// ==================== SPAWNING ====================
|
||||
|
||||
/** Spawn this zone entity into the world. */
|
||||
void spawn();
|
||||
}
|
||||
@@ -541,19 +541,20 @@ public interface IEntity<T extends Entity> {
|
||||
IEntity<?>[] getCapturedDrops();
|
||||
|
||||
/**
|
||||
* @since 1.7.10c
|
||||
* @return Whether the entity is sneaking.
|
||||
* @since 1.7.10c
|
||||
*/
|
||||
boolean isSneaking();
|
||||
|
||||
/**
|
||||
* @since 1.7.10c
|
||||
* @return Whether the entity is sprinting.
|
||||
* @since 1.7.10c
|
||||
*/
|
||||
boolean isSprinting();
|
||||
|
||||
/**
|
||||
* Expert users only.
|
||||
*
|
||||
* @return The underlying Minecraft entity.
|
||||
*/
|
||||
T getMCEntity();
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package noppes.npcs.api.entity;
|
||||
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import noppes.npcs.api.entity.IEntityLivingBase;
|
||||
|
||||
/**
|
||||
* Represents a living entity (mob, NPC, etc.) that extends the base living functionality.
|
||||
|
||||
@@ -437,5 +437,54 @@ 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);
|
||||
|
||||
/**
|
||||
* Applies knockback to the entity, pushing it away from the source entity.
|
||||
* Uses Minecraft's knockback mechanics which respects the entity's knockback resistance.
|
||||
* A strength of 1.0 is equivalent to a standard melee hit.
|
||||
*
|
||||
* @param strength the knockback strength multiplier.
|
||||
* @param source the source entity to knock back away from.
|
||||
*/
|
||||
void applyKnockback(float strength, IEntity source);
|
||||
|
||||
/**
|
||||
* Applies knockback to the entity in the specified direction.
|
||||
* Uses Minecraft's knockback mechanics which respects the entity's knockback resistance.
|
||||
* The direction vector does not need to be normalized.
|
||||
* A strength of 1.0 is equivalent to a standard melee hit.
|
||||
*
|
||||
* @param strength the knockback strength multiplier.
|
||||
* @param dirX the x component of the knockback direction.
|
||||
* @param dirZ the z component of the knockback direction.
|
||||
*/
|
||||
void applyKnockback(float strength, double dirX, double dirZ);
|
||||
|
||||
/**
|
||||
* Forcefully applies knockback to the entity, pushing it away from the source entity.
|
||||
* This ignores the entity's knockback resistance attribute.
|
||||
* A strength of 1.0 is equivalent to a standard melee hit.
|
||||
*
|
||||
* @param strength the knockback strength multiplier.
|
||||
* @param source the source entity to knock back away from.
|
||||
*/
|
||||
void forceKnockback(float strength, IEntity source);
|
||||
|
||||
/**
|
||||
* Forcefully applies knockback to the entity in the specified direction.
|
||||
* This ignores the entity's knockback resistance attribute.
|
||||
* The direction vector does not need to be normalized.
|
||||
* A strength of 1.0 is equivalent to a standard melee hit.
|
||||
*
|
||||
* @param strength the knockback strength multiplier.
|
||||
* @param dirX the x component of the knockback direction.
|
||||
* @param dirZ the z component of the knockback direction.
|
||||
*/
|
||||
void forceKnockback(float strength, double dirX, double dirZ);
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
package noppes.npcs.api.entity;
|
||||
|
||||
import net.minecraft.entity.passive.EntityTameable;
|
||||
import noppes.npcs.api.item.IItemStack;
|
||||
|
||||
/**
|
||||
* Represents a Pixelmon (a tameable creature) with additional attributes
|
||||
@@ -37,6 +36,7 @@ public interface IPixelmon<T extends EntityTameable> extends IAnimal<T> {
|
||||
|
||||
/**
|
||||
* Gets the Individual Value (IV) for the specified stat.
|
||||
*
|
||||
* @param type 0: HP, 1: Attack, 2: Defense, 3: SpAttack, 4: SpDefense, 5: Speed
|
||||
* @return the IV value, or -1 if invalid.
|
||||
*/
|
||||
@@ -84,7 +84,7 @@ public interface IPixelmon<T extends EntityTameable> extends IAnimal<T> {
|
||||
|
||||
/**
|
||||
* @return The Pixelmon's size type (0: Pygmy, 1: Runt, 2: Small, 3: Normal, 4: Huge, 5: Giant,
|
||||
* 6: Enormous, 7: Ginormous, 8: Microscopic).
|
||||
* 6: Enormous, 7: Ginormous, 8: Microscopic).
|
||||
*/
|
||||
int getSize();
|
||||
|
||||
@@ -121,7 +121,7 @@ public interface IPixelmon<T extends EntityTameable> extends IAnimal<T> {
|
||||
|
||||
/**
|
||||
* @return The type of Poké Ball in which the Pixelmon is contained
|
||||
* (-1: Uncaught, 0: Pokéball, 1: Great Ball, etc.).
|
||||
* (-1: Uncaught, 0: Pokéball, 1: Great Ball, etc.).
|
||||
*/
|
||||
int getPokeball();
|
||||
|
||||
|
||||
@@ -2,12 +2,23 @@ package noppes.npcs.api.entity;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import noppes.npcs.api.*;
|
||||
import noppes.npcs.api.IBlock;
|
||||
import noppes.npcs.api.IContainer;
|
||||
import noppes.npcs.api.IPixelmonPlayerData;
|
||||
import noppes.npcs.api.IPos;
|
||||
import noppes.npcs.api.IScreenSize;
|
||||
import noppes.npcs.api.ITimers;
|
||||
import noppes.npcs.api.IWorld;
|
||||
import noppes.npcs.api.gui.ICustomGui;
|
||||
import noppes.npcs.api.handler.IActionManager;
|
||||
import noppes.npcs.api.handler.IOverlayHandler;
|
||||
import noppes.npcs.api.handler.IPlayerData;
|
||||
import noppes.npcs.api.handler.data.*;
|
||||
import noppes.npcs.api.handler.data.IAnimationData;
|
||||
import noppes.npcs.api.handler.data.IDialog;
|
||||
import noppes.npcs.api.handler.data.IMagicData;
|
||||
import noppes.npcs.api.handler.data.IPlayerAttributes;
|
||||
import noppes.npcs.api.handler.data.IQuest;
|
||||
import noppes.npcs.api.handler.data.ISound;
|
||||
import noppes.npcs.api.item.IItemStack;
|
||||
import noppes.npcs.api.overlay.ICustomOverlay;
|
||||
|
||||
@@ -313,8 +324,8 @@ public interface IPlayer<T extends EntityPlayerMP> extends IEntityLivingBase<T>,
|
||||
void setMode(int type);
|
||||
|
||||
/**
|
||||
* @since 1.7.10d
|
||||
* @return Returns an IItemStack array of size 36 representing the player's inventory.
|
||||
* @since 1.7.10d
|
||||
*/
|
||||
IItemStack[] getInventory();
|
||||
|
||||
@@ -327,11 +338,11 @@ public interface IPlayer<T extends EntityPlayerMP> extends IEntityLivingBase<T>,
|
||||
int inventoryItemCount(IItemStack item, boolean ignoreNBT, boolean ignoreDamage);
|
||||
|
||||
/**
|
||||
* @since 1.7.10c
|
||||
* @param id The item's name.
|
||||
* @param damage The damage value.
|
||||
* @param amount How many items will be removed.
|
||||
* @return True if the items were removed successfully, false if the amount exceeds what the player has or the item doesn't exist.
|
||||
* @since 1.7.10c
|
||||
*/
|
||||
boolean removeItem(String id, int damage, int amount);
|
||||
|
||||
@@ -353,19 +364,19 @@ public interface IPlayer<T extends EntityPlayerMP> extends IEntityLivingBase<T>,
|
||||
int removeAllItems(IItemStack item, boolean ignoreNBT, boolean ignoreDamage);
|
||||
|
||||
/**
|
||||
* @since 1.7.10c
|
||||
* @param item The item to be added.
|
||||
* @param amount The number of items to add.
|
||||
* @return True if the item was given successfully, false otherwise.
|
||||
* @since 1.7.10c
|
||||
*/
|
||||
boolean giveItem(IItemStack item, int amount);
|
||||
|
||||
/**
|
||||
* @since 1.7.10c
|
||||
* @param id The item's name.
|
||||
* @param damage The damage value.
|
||||
* @param amount The number of items to add.
|
||||
* @return True if the item was given successfully, false otherwise.
|
||||
* @since 1.7.10c
|
||||
*/
|
||||
boolean giveItem(String id, int damage, int amount);
|
||||
|
||||
@@ -511,22 +522,22 @@ public interface IPlayer<T extends EntityPlayerMP> extends IEntityLivingBase<T>,
|
||||
boolean hasBukkitPermission(String permission);
|
||||
|
||||
/**
|
||||
* @since 1.7.10c
|
||||
* @return Returns the player's experience level.
|
||||
* @since 1.7.10c
|
||||
*/
|
||||
int getExpLevel();
|
||||
|
||||
/**
|
||||
* @since 1.7.10c
|
||||
* @param level The new experience level to set.
|
||||
* @since 1.7.10c
|
||||
*/
|
||||
void setExpLevel(int level);
|
||||
|
||||
/**
|
||||
* Requires Pixelmon to be installed.
|
||||
*
|
||||
* @since 1.7.10d
|
||||
* @return Returns the player's Pixelmon data, or null if Pixelmon is not enabled.
|
||||
* @since 1.7.10d
|
||||
*/
|
||||
IPixelmonPlayerData getPixelmonData();
|
||||
|
||||
@@ -673,6 +684,84 @@ 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();
|
||||
|
||||
// =========================================
|
||||
// Currency Methods
|
||||
// =========================================
|
||||
|
||||
/**
|
||||
* Gets the player's current currency balance.
|
||||
* If Vault is configured and available, returns Vault balance.
|
||||
* Otherwise returns CNPC+ built-in currency balance.
|
||||
*
|
||||
* @return The player's currency balance
|
||||
*/
|
||||
long getCurrencyBalance();
|
||||
|
||||
/**
|
||||
* Sets the player's currency balance.
|
||||
* If Vault is configured and available, sets Vault balance.
|
||||
* Otherwise sets CNPC+ built-in currency balance.
|
||||
*
|
||||
* @param amount The new balance
|
||||
*/
|
||||
void setCurrencyBalance(long amount);
|
||||
|
||||
/**
|
||||
* Deposits (adds) currency to the player's balance.
|
||||
* If Vault is configured and available, deposits to Vault.
|
||||
* Otherwise deposits to CNPC+ built-in currency.
|
||||
*
|
||||
* @param amount The amount to deposit
|
||||
* @return true if successful, false if would exceed max balance
|
||||
*/
|
||||
boolean depositCurrency(long amount);
|
||||
|
||||
/**
|
||||
* Withdraws (removes) currency from the player's balance.
|
||||
* If Vault is configured and available, withdraws from Vault.
|
||||
* Otherwise withdraws from CNPC+ built-in currency.
|
||||
*
|
||||
* @param amount The amount to withdraw
|
||||
* @return true if successful, false if insufficient funds
|
||||
*/
|
||||
boolean withdrawCurrency(long amount);
|
||||
|
||||
/**
|
||||
* Checks if the player can afford the specified amount.
|
||||
* If Vault is configured and available, checks Vault balance.
|
||||
* Otherwise checks CNPC+ built-in currency balance.
|
||||
*
|
||||
* @param amount The amount to check
|
||||
* @return true if the player has enough currency
|
||||
*/
|
||||
boolean canAffordCurrency(long amount);
|
||||
|
||||
/**
|
||||
* Checks if Vault is being used for currency operations.
|
||||
*
|
||||
* @return true if Vault is configured AND available, false if using CNPC+ built-in currency
|
||||
*/
|
||||
boolean isUsingVaultCurrency();
|
||||
|
||||
/**
|
||||
* Gets the player's formatted currency balance for display.
|
||||
* Uses Vault formatting if Vault is active, otherwise uses CNPC+ formatting.
|
||||
*
|
||||
* @return The formatted balance string
|
||||
*/
|
||||
String getFormattedCurrencyBalance();
|
||||
|
||||
/**
|
||||
* Returns all active energy projectiles fired by this player.
|
||||
*
|
||||
* @return Array of active energy projectiles, empty array if none
|
||||
*/
|
||||
IEnergyProjectile[] getActiveEnergyProjectiles();
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
package noppes.npcs.api.entity;
|
||||
|
||||
import net.minecraft.entity.passive.EntityVillager;
|
||||
import noppes.npcs.api.entity.IEntityLivingBase;
|
||||
|
||||
/**
|
||||
* Represents a villager entity with additional trading-related methods.
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
package noppes.npcs.api.entity.data;
|
||||
|
||||
/**
|
||||
* Provides configuration data for an NPC's custom hitbox dimensions.
|
||||
* <p>
|
||||
* When enabled, allows independent scaling of the NPC's collision box
|
||||
* width and height beyond the default model-based sizing.
|
||||
*/
|
||||
public interface IHitboxData {
|
||||
|
||||
/**
|
||||
* Returns whether the custom hitbox is enabled.
|
||||
*
|
||||
* @return true if the custom hitbox is enabled, false otherwise.
|
||||
*/
|
||||
boolean isHitboxEnabled();
|
||||
|
||||
/**
|
||||
* Sets whether the custom hitbox is enabled.
|
||||
*
|
||||
* @param enabled true to enable, false to disable.
|
||||
*/
|
||||
void setHitboxEnabled(boolean enabled);
|
||||
|
||||
/**
|
||||
* Returns the width scale factor for the hitbox.
|
||||
*
|
||||
* @return the width scale factor (1.0 = default).
|
||||
*/
|
||||
float getWidthScale();
|
||||
|
||||
/**
|
||||
* Sets the width scale factor for the hitbox.
|
||||
* Clamped to the server-configured maximum.
|
||||
*
|
||||
* @param widthScale the width scale factor.
|
||||
*/
|
||||
void setWidthScale(float widthScale);
|
||||
|
||||
/**
|
||||
* Returns the height scale factor for the hitbox.
|
||||
*
|
||||
* @return the height scale factor (1.0 = default).
|
||||
*/
|
||||
float getHeightScale();
|
||||
|
||||
/**
|
||||
* Sets the height scale factor for the hitbox.
|
||||
* Clamped to the server-configured maximum.
|
||||
*
|
||||
* @param heightScale the height scale factor.
|
||||
*/
|
||||
void setHeightScale(float heightScale);
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
package noppes.npcs.api.entity.data;
|
||||
|
||||
/**
|
||||
* Provides configuration data for an NPC's color tinting effects.
|
||||
* <p>
|
||||
* Controls both the hurt tint (flash color when damaged) and a persistent
|
||||
* general tint overlay applied to the NPC's model.
|
||||
*/
|
||||
public interface ITintData {
|
||||
|
||||
/**
|
||||
* Returns whether the tint system is enabled.
|
||||
*
|
||||
* @return true if tinting is enabled, false otherwise.
|
||||
*/
|
||||
boolean isTintEnabled();
|
||||
|
||||
/**
|
||||
* Sets whether the tint system is enabled.
|
||||
*
|
||||
* @param enabled true to enable, false to disable.
|
||||
*/
|
||||
void setTintEnabled(boolean enabled);
|
||||
|
||||
/**
|
||||
* Returns whether the hurt tint effect is enabled.
|
||||
*
|
||||
* @return true if hurt tint is enabled, false otherwise.
|
||||
*/
|
||||
boolean isHurtTintEnabled();
|
||||
|
||||
/**
|
||||
* Sets whether the hurt tint effect is enabled.
|
||||
*
|
||||
* @param enabled true to enable, false to disable.
|
||||
*/
|
||||
void setHurtTintEnabled(boolean enabled);
|
||||
|
||||
/**
|
||||
* Returns whether the general (persistent) tint is enabled.
|
||||
*
|
||||
* @return true if general tint is enabled, false otherwise.
|
||||
*/
|
||||
boolean isGeneralTintEnabled();
|
||||
|
||||
/**
|
||||
* Sets whether the general (persistent) tint is enabled.
|
||||
*
|
||||
* @param enabled true to enable, false to disable.
|
||||
*/
|
||||
void setGeneralTintEnabled(boolean enabled);
|
||||
|
||||
/**
|
||||
* Returns the hurt tint color as an RGB integer (e.g. 0xff0000 for red).
|
||||
*
|
||||
* @return the hurt tint color.
|
||||
*/
|
||||
int getHurtTint();
|
||||
|
||||
/**
|
||||
* Sets the hurt tint color as an RGB integer.
|
||||
*
|
||||
* @param color the hurt tint color (e.g. 0xff0000 for red).
|
||||
*/
|
||||
void setHurtTint(int color);
|
||||
|
||||
/**
|
||||
* Returns the general tint color as an RGB integer.
|
||||
*
|
||||
* @return the general tint color.
|
||||
*/
|
||||
int getGeneralTint();
|
||||
|
||||
/**
|
||||
* Sets the general tint color as an RGB integer.
|
||||
*
|
||||
* @param color the general tint color.
|
||||
*/
|
||||
void setGeneralTint(int color);
|
||||
|
||||
/**
|
||||
* Returns the alpha (opacity) of the general tint overlay (0-255).
|
||||
*
|
||||
* @return the general tint alpha value.
|
||||
*/
|
||||
int getGeneralAlpha();
|
||||
|
||||
/**
|
||||
* Sets the alpha (opacity) of the general tint overlay (0-255).
|
||||
*
|
||||
* @param alpha the general tint alpha value.
|
||||
*/
|
||||
void setGeneralAlpha(int alpha);
|
||||
}
|
||||
@@ -0,0 +1,174 @@
|
||||
package noppes.npcs.api.event;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.Cancelable;
|
||||
import noppes.npcs.api.IDamageSource;
|
||||
import noppes.npcs.api.ability.IAbility;
|
||||
import noppes.npcs.api.entity.ICustomNpc;
|
||||
import noppes.npcs.api.entity.IEntityLivingBase;
|
||||
import noppes.npcs.api.entity.IPlayer;
|
||||
|
||||
/**
|
||||
* Events related to NPC ability execution.
|
||||
* These events are fired during the ability lifecycle.
|
||||
*/
|
||||
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();
|
||||
|
||||
/**
|
||||
* Fired when an ability starts executing (enters WINDUP phase).
|
||||
* Canceling prevents the ability from starting.
|
||||
*/
|
||||
@Cancelable
|
||||
interface StartEvent extends IAbilityEvent {
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when an ability enters the ACTIVE phase and performs its effect.
|
||||
* Canceling prevents the ability effect from occurring.
|
||||
*/
|
||||
@Cancelable
|
||||
interface ExecuteEvent extends IAbilityEvent {
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when an ability is interrupted by damage.
|
||||
*/
|
||||
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();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when an ability completes its full execution cycle.
|
||||
*/
|
||||
interface CompleteEvent extends IAbilityEvent {
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when a toggle ability is switched ON or OFF.
|
||||
* Canceling prevents the toggle from changing state.
|
||||
*/
|
||||
@Cancelable
|
||||
interface ToggleEvent extends IAbilityEvent {
|
||||
boolean isTogglingOn();
|
||||
int getOldState();
|
||||
int getNewState();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired every 10 ticks for each active toggle ability.
|
||||
* Scripts can call setEnabled(false) to force-deactivate.
|
||||
*/
|
||||
interface ToggleUpdateEvent extends IAbilityEvent {
|
||||
int getTick();
|
||||
int getState();
|
||||
boolean isEnabled();
|
||||
void setEnabled(boolean enabled);
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when an ability hits an entity with damage.
|
||||
* Canceling this event prevents the damage from being applied.
|
||||
*/
|
||||
@Cancelable
|
||||
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);
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired every tick while an ability is executing.
|
||||
* Provides the current phase and tick count.
|
||||
*/
|
||||
interface TickEvent extends IAbilityEvent {
|
||||
/**
|
||||
* 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,33 +6,56 @@ 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
|
||||
interface Started extends IAnimationEvent {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 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();
|
||||
|
||||
/**
|
||||
* @hookName frameEnter
|
||||
*/
|
||||
interface Entered extends IFrameEvent {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @hookName frameExit
|
||||
*/
|
||||
interface Exited extends IFrameEvent {
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
package noppes.npcs.api.event;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.Cancelable;
|
||||
import noppes.npcs.api.handler.data.IAuctionClaim;
|
||||
import noppes.npcs.api.handler.data.IAuctionListing;
|
||||
import noppes.npcs.api.item.IItemStack;
|
||||
|
||||
/**
|
||||
* Events related to auction actions.
|
||||
* These events are fired when players interact with the auction system.
|
||||
*/
|
||||
public interface IAuctionEvent extends IPlayerEvent {
|
||||
|
||||
/**
|
||||
* Fired before a player creates a new auction listing.
|
||||
* Cancel to prevent the listing from being created.
|
||||
* The listing fee has NOT yet been deducted when this fires.
|
||||
*
|
||||
* @hookName auctionCreate
|
||||
*/
|
||||
@Cancelable
|
||||
interface CreateEvent extends IAuctionEvent {
|
||||
IItemStack getItem();
|
||||
|
||||
long getStartingPrice();
|
||||
|
||||
long getBuyoutPrice();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired before a player places a bid on an auction.
|
||||
* Cancel to prevent the bid from being placed.
|
||||
* Currency has NOT yet been deducted when this fires.
|
||||
*
|
||||
* @hookName auctionBid
|
||||
*/
|
||||
@Cancelable
|
||||
interface BidEvent extends IAuctionEvent {
|
||||
IAuctionListing getListing();
|
||||
|
||||
long getBidAmount();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired before a player buys out an auction.
|
||||
* Cancel to prevent the buyout.
|
||||
* Currency has NOT yet been deducted when this fires.
|
||||
*
|
||||
* @hookName auctionBuyout
|
||||
*/
|
||||
@Cancelable
|
||||
interface BuyoutEvent extends IAuctionEvent {
|
||||
IAuctionListing getListing();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired before a player cancels an auction listing.
|
||||
* Cancel to prevent the cancellation.
|
||||
*
|
||||
* @hookName auctionCancel
|
||||
*/
|
||||
@Cancelable
|
||||
interface CancelEvent extends IAuctionEvent {
|
||||
IAuctionListing getListing();
|
||||
|
||||
boolean isAdmin();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired before a player claims an item or currency from an auction.
|
||||
* Cancel to prevent the claim.
|
||||
*
|
||||
* @hookName auctionClaim
|
||||
*/
|
||||
@Cancelable
|
||||
interface ClaimEvent extends IAuctionEvent {
|
||||
IAuctionClaim getClaim();
|
||||
}
|
||||
}
|
||||
@@ -6,11 +6,20 @@ 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();
|
||||
|
||||
/**
|
||||
* @hookName fallenUpon
|
||||
*/
|
||||
@Cancelable
|
||||
interface EntityFallenUponEvent extends IBlockEvent{
|
||||
interface EntityFallenUponEvent extends IBlockEvent {
|
||||
IEntity getEntity();
|
||||
|
||||
float getDistanceFallen();
|
||||
}
|
||||
|
||||
@@ -27,18 +36,28 @@ public interface IBlockEvent extends ICustomNPCsEvent {
|
||||
int getSide();
|
||||
}
|
||||
|
||||
interface RedstoneEvent extends IBlockEvent{
|
||||
interface RedstoneEvent extends IBlockEvent {
|
||||
int getPrevPower();
|
||||
|
||||
int getPower();
|
||||
}
|
||||
interface BreakEvent extends IBlockEvent{
|
||||
|
||||
/**
|
||||
* @hookName broken
|
||||
*/
|
||||
interface BreakEvent extends IBlockEvent {
|
||||
|
||||
}
|
||||
|
||||
@Cancelable
|
||||
interface ExplodedEvent extends IBlockEvent{
|
||||
interface ExplodedEvent extends IBlockEvent {
|
||||
|
||||
}
|
||||
interface RainFillEvent extends IBlockEvent{
|
||||
|
||||
/**
|
||||
* @hookName rainFilled
|
||||
*/
|
||||
interface RainFillEvent extends IBlockEvent {
|
||||
|
||||
}
|
||||
|
||||
@@ -46,10 +65,14 @@ public interface IBlockEvent extends ICustomNPCsEvent {
|
||||
IPos getChangedPos();
|
||||
}
|
||||
|
||||
interface InitEvent extends IBlockEvent{
|
||||
interface InitEvent extends IBlockEvent {
|
||||
|
||||
}
|
||||
interface UpdateEvent extends IBlockEvent{
|
||||
|
||||
/**
|
||||
* @hookName tick
|
||||
*/
|
||||
interface UpdateEvent extends IBlockEvent {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
package noppes.npcs.api.event;
|
||||
|
||||
import noppes.npcs.api.IDamageSource;
|
||||
import noppes.npcs.api.ability.IChainedAbility;
|
||||
import noppes.npcs.api.entity.ICustomNpc;
|
||||
import noppes.npcs.api.entity.IEntityLivingBase;
|
||||
import noppes.npcs.api.entity.IPlayer;
|
||||
|
||||
/**
|
||||
* Events related to chained ability execution lifecycle.
|
||||
* These fire at chain-level transitions, not per-ability.
|
||||
* Unified for both NPCs and Players.
|
||||
*/
|
||||
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();
|
||||
|
||||
/**
|
||||
* Fired when a chained ability sequence starts executing.
|
||||
*/
|
||||
interface StartEvent extends IChainEvent {}
|
||||
|
||||
/**
|
||||
* Fired when the chain advances to the next entry in the sequence.
|
||||
*/
|
||||
interface NextEvent extends IChainEvent {}
|
||||
|
||||
/**
|
||||
* Fired when a chained ability sequence completes all entries.
|
||||
*/
|
||||
interface CompleteEvent extends IChainEvent {}
|
||||
|
||||
/**
|
||||
* Fired when a chained ability is interrupted by damage.
|
||||
*/
|
||||
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,21 +4,38 @@ 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();
|
||||
|
||||
/**
|
||||
* @hookName customGuiButton
|
||||
*/
|
||||
interface ButtonEvent extends ICustomGuiEvent {
|
||||
}
|
||||
|
||||
/**
|
||||
* @hookName customGuiTextfield
|
||||
*/
|
||||
interface UnfocusedEvent extends ICustomGuiEvent {
|
||||
}
|
||||
|
||||
/**
|
||||
* @hookName customGuiClosed
|
||||
*/
|
||||
interface CloseEvent extends ICustomGuiEvent {
|
||||
}
|
||||
|
||||
/**
|
||||
* @hookName customGuiScroll
|
||||
*/
|
||||
interface ScrollEvent extends ICustomGuiEvent {
|
||||
String[] getSelection();
|
||||
|
||||
@@ -27,10 +44,16 @@ public interface ICustomGuiEvent extends IPlayerEvent {
|
||||
int getScrollIndex();
|
||||
}
|
||||
|
||||
/**
|
||||
* @hookName customGuiSlot
|
||||
*/
|
||||
interface SlotEvent extends ICustomGuiEvent {
|
||||
IItemStack getStack();
|
||||
}
|
||||
|
||||
/**
|
||||
* @hookName customGuiSlotClicked
|
||||
*/
|
||||
@Cancelable
|
||||
interface SlotClickEvent extends ICustomGuiEvent {
|
||||
IItemStack getStack();
|
||||
|
||||
@@ -5,10 +5,17 @@ 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();
|
||||
|
||||
/**
|
||||
* @hookName onCNPCNaturalSpawn
|
||||
*/
|
||||
@Cancelable
|
||||
interface CNPCNaturalSpawnEvent extends ICustomNPCsEvent {
|
||||
INaturalSpawn getNaturalSpawn();
|
||||
|
||||
@@ -3,18 +3,40 @@ 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 {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package noppes.npcs.api.event;
|
||||
|
||||
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 {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package noppes.npcs.api.event;
|
||||
|
||||
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,18 +4,36 @@ 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 {
|
||||
}
|
||||
}
|
||||
@@ -6,101 +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();
|
||||
|
||||
/** @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,15 +1,26 @@
|
||||
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 {
|
||||
|
||||
// Version Change Event
|
||||
/**
|
||||
* 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 {
|
||||
}
|
||||
}
|
||||
@@ -9,127 +9,227 @@ 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();
|
||||
}
|
||||
|
||||
interface CollideEvent extends INpcEvent{
|
||||
/**
|
||||
* 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);
|
||||
|
||||
/** @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 {
|
||||
|
||||
/**
|
||||
* Can be null
|
||||
*
|
||||
* @return Returns the swung item
|
||||
*/
|
||||
IItemStack getItemStack();
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 {
|
||||
}
|
||||
}
|
||||
Loaded 100 of 194 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user