mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-18 04:35:03 +00:00
PHASE 0B & 0C: mc1710/src/api → platform-api Merge
PHASE 0D: Complete Existing Core TODOs (mc1710 shadow files) PHASE 0E: Exhaustive file-by-file comparison of all 100 core/ classes against their mc1710 counterparts. ALL COMPLETE!
This commit is contained in:
1 parent
7a656420ca
commit
f58aed7b57
215 files changed
+19066
-73
No files matched your search
@@ -0,0 +1,294 @@
|
||||
package noppes.npcs.api;
|
||||
|
||||
import noppes.npcs.api.entity.ICustomNpc;
|
||||
import noppes.npcs.api.entity.IEntity;
|
||||
import noppes.npcs.api.entity.IPlayer;
|
||||
import noppes.npcs.api.gui.ICustomGui;
|
||||
import noppes.npcs.api.handler.*;
|
||||
import noppes.npcs.api.handler.data.IAnimation;
|
||||
import noppes.npcs.api.handler.data.IFrame;
|
||||
import noppes.npcs.api.handler.data.IFramePart;
|
||||
import noppes.npcs.api.handler.data.ISound;
|
||||
import noppes.npcs.api.item.IItemStack;
|
||||
import noppes.npcs.api.overlay.ICustomOverlay;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.HashMap;
|
||||
|
||||
/**
|
||||
* This object stores functions available to all scripting handlers through the "API" keyword.
|
||||
*
|
||||
*/
|
||||
public abstract class AbstractNpcAPI {
|
||||
private static AbstractNpcAPI instance = null;
|
||||
|
||||
public AbstractNpcAPI() {
|
||||
}
|
||||
|
||||
public abstract Object getTempData(String key);
|
||||
|
||||
public abstract void setTempData(String key, Object value);
|
||||
|
||||
public abstract boolean hasTempData(String key);
|
||||
|
||||
public abstract void removeTempData(String key);
|
||||
|
||||
public abstract void clearTempData();
|
||||
|
||||
public abstract String[] getTempDataKeys();
|
||||
|
||||
public abstract Object getStoredData(String key);
|
||||
|
||||
public abstract void setStoredData(String key, Object value);
|
||||
|
||||
public abstract boolean hasStoredData(String key);
|
||||
|
||||
public abstract void removeStoredData(String key);
|
||||
|
||||
public abstract void clearStoredData();
|
||||
|
||||
public abstract String[] getStoredDataKeys();
|
||||
|
||||
public abstract void registerICommand(ICommand command);
|
||||
|
||||
public abstract ICommand getICommand(String commandName, int priorityLevel);
|
||||
|
||||
public abstract void addGlobalObject(String key, Object obj);
|
||||
|
||||
public abstract void removeGlobalObject(String key);
|
||||
|
||||
public abstract boolean hasGlobalObject(String key);
|
||||
|
||||
public abstract HashMap<String, Object> getEngineObjects();
|
||||
|
||||
public abstract long sizeOfObject(Object obj);
|
||||
|
||||
public abstract void stopServer();
|
||||
|
||||
public abstract int getCurrentPlayerCount();
|
||||
|
||||
public abstract int getMaxPlayers();
|
||||
|
||||
public abstract void kickAllPlayers();
|
||||
|
||||
public abstract boolean isHardcore();
|
||||
|
||||
public abstract File getFile(String path);
|
||||
|
||||
public abstract String getServerOwner();
|
||||
|
||||
public abstract IFactionHandler getFactions();
|
||||
|
||||
public abstract IRecipeHandler getRecipes();
|
||||
|
||||
public abstract IQuestHandler getQuests();
|
||||
|
||||
public abstract IDialogHandler getDialogs();
|
||||
|
||||
public abstract ICloneHandler getClones();
|
||||
|
||||
public abstract INaturalSpawnsHandler getNaturalSpawns();
|
||||
|
||||
public abstract IProfileHandler getProfileHandler();
|
||||
|
||||
public abstract ICustomEffectHandler getCustomEffectHandler();
|
||||
|
||||
public abstract IMagicHandler getMagicHandler();
|
||||
|
||||
public abstract IPartyHandler getPartyHandler();
|
||||
|
||||
public abstract ITransportHandler getLocations();
|
||||
|
||||
public abstract IAnimationHandler getAnimations();
|
||||
|
||||
public abstract ILinkedItemHandler getLinkedItems();
|
||||
|
||||
public abstract IScriptHookHandler getScriptHooks();
|
||||
|
||||
public abstract IAbilityHandler getAbilities();
|
||||
|
||||
public abstract ITelegraphHandler getTelegraphs();
|
||||
|
||||
public abstract IAuctionHandler getAuctions();
|
||||
|
||||
public abstract ITelegraph createTelegraph(String type);
|
||||
|
||||
public abstract String[] getAllBiomeNames();
|
||||
|
||||
public abstract ICustomNpc createNPC(IWorld var1);
|
||||
|
||||
public abstract ICustomNpc spawnNPC(IWorld var1, int var2, int var3, int var4);
|
||||
|
||||
public abstract ICustomNpc spawnNPC(IWorld world, IPos pos);
|
||||
|
||||
public abstract IEntity getIEntity(Object var1);
|
||||
|
||||
public abstract IPlayer getPlayer(String username);
|
||||
|
||||
public abstract Object[] getChunkLoadingNPCs();
|
||||
|
||||
public abstract IEntity[] getLoadedEntities();
|
||||
|
||||
public abstract IBlock getIBlock(IWorld world, int x, int y, int z);
|
||||
|
||||
public abstract IBlock getIBlock(IWorld world, IPos pos);
|
||||
|
||||
public abstract ITileEntity getITileEntity(IWorld world, IPos pos);
|
||||
|
||||
public abstract ITileEntity getITileEntity(IWorld world, int x, int y, int z);
|
||||
|
||||
public abstract ITileEntity getITileEntity(Object tileEntity);
|
||||
|
||||
public abstract IPos getIPos(Object pos);
|
||||
|
||||
public abstract IPos getIPos(int x, int y, int z);
|
||||
|
||||
public abstract IPos getIPos(double x, double y, double z);
|
||||
|
||||
public abstract IPos getIPos(float x, float y, float z);
|
||||
|
||||
public abstract IPos getIPos(long serializedPos);
|
||||
|
||||
public abstract IPos[] getAllInBox(IPos from, IPos to, boolean sortByDistance);
|
||||
|
||||
public abstract IPos[] getAllInBox(IPos from, IPos to);
|
||||
|
||||
public abstract IContainer getIContainer(Object var1);
|
||||
|
||||
public abstract IItemStack getIItemStack(Object var1);
|
||||
|
||||
public abstract IWorld getIWorld(Object var1);
|
||||
|
||||
public abstract IWorld getIWorld(int var1);
|
||||
|
||||
public abstract IWorld getIWorldLoad(int var1);
|
||||
|
||||
public abstract IActionManager getActionManager();
|
||||
|
||||
public abstract IWorld[] getIWorlds();
|
||||
|
||||
public abstract IDamageSource getIDamageSource(Object var1);
|
||||
|
||||
public abstract IDamageSource getIDamageSource(IEntity entity);
|
||||
|
||||
public abstract IEnergyHandler getEnergyHandler();
|
||||
|
||||
public abstract Object events();
|
||||
|
||||
public abstract File getGlobalDir();
|
||||
|
||||
public abstract File getWorldDir();
|
||||
|
||||
public static boolean IsAvailable() {
|
||||
try {
|
||||
Class.forName("noppes.npcs.scripted.NpcAPI");
|
||||
return true;
|
||||
} catch (ClassNotFoundException e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static AbstractNpcAPI Instance() {
|
||||
if (instance != null) {
|
||||
return instance;
|
||||
} else if (!IsAvailable()) {
|
||||
return null;
|
||||
} else {
|
||||
try {
|
||||
Class<?> c = Class.forName("noppes.npcs.scripted.NpcAPI");
|
||||
instance = (AbstractNpcAPI) c.getMethod("Instance").invoke((Object) null);
|
||||
} catch (Exception var1) {
|
||||
var1.printStackTrace();
|
||||
}
|
||||
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
|
||||
public abstract void executeCommand(IWorld var1, String var2);
|
||||
|
||||
public abstract String getRandomName(int dictionary, int gender);
|
||||
|
||||
public abstract INbt getINbt(Object nbtTagCompound);
|
||||
|
||||
public abstract INbt stringToNbt(String str);
|
||||
|
||||
public abstract IPlayer[] getAllServerPlayers();
|
||||
|
||||
public abstract String[] getPlayerNames();
|
||||
|
||||
public abstract IItemStack createItemFromNBT(INbt nbt);
|
||||
|
||||
public abstract IItemStack createItem(String id, int damage, int size);
|
||||
|
||||
public abstract void playSoundAtEntity(IEntity entity, String sound, float volume, float pitch);
|
||||
|
||||
public abstract void playSoundToNearExcept(IPlayer player, String sound, float volume, float pitch);
|
||||
|
||||
public abstract String getMOTD();
|
||||
|
||||
public abstract void setMOTD(String motd);
|
||||
|
||||
public abstract IParticle createParticle(String directory);
|
||||
|
||||
@Deprecated
|
||||
public abstract IParticle createEntityParticle(String directory);
|
||||
|
||||
public abstract ISound createSound(String directory);
|
||||
|
||||
public abstract void playSound(int id, ISound sound);
|
||||
|
||||
public abstract void playSound(ISound sound);
|
||||
|
||||
public abstract void stopSound(int id);
|
||||
|
||||
public abstract void pauseSounds();
|
||||
|
||||
public abstract void continueSounds();
|
||||
|
||||
public abstract void stopSounds();
|
||||
|
||||
public abstract int getServerTime();
|
||||
|
||||
public abstract boolean arePlayerScriptsEnabled();
|
||||
|
||||
public abstract boolean areForgeScriptsEnabled();
|
||||
|
||||
public abstract boolean areGlobalNPCScriptsEnabled();
|
||||
|
||||
public abstract void enablePlayerScripts(boolean enable);
|
||||
|
||||
public abstract void enableForgeScripts(boolean enable);
|
||||
|
||||
public abstract void enableGlobalNPCScripts(boolean enable);
|
||||
|
||||
public abstract ICustomGui createCustomGui(int id, int width, int height, boolean pauseGame);
|
||||
|
||||
public abstract ICustomOverlay createCustomOverlay(int id);
|
||||
|
||||
public abstract ISkinOverlay createSkinOverlay(String texture);
|
||||
|
||||
public abstract String millisToTime(long millis);
|
||||
|
||||
public abstract String ticksToTime(long ticks);
|
||||
|
||||
public abstract IAnimation createAnimation(String name);
|
||||
|
||||
public abstract IAnimation createAnimation(String name, float speed, byte smooth);
|
||||
|
||||
public abstract IFrame createFrame(int duration);
|
||||
|
||||
public abstract IFrame createFrame(int duration, float speed, byte smooth);
|
||||
|
||||
public abstract IFramePart createPart(String name);
|
||||
|
||||
public abstract IFramePart createPart(String name, float[] rotation, float[] pivot);
|
||||
|
||||
public abstract IFramePart createPart(String name, float[] rotation, float[] pivot, float speed, byte smooth);
|
||||
|
||||
public abstract IFramePart createPart(int partId);
|
||||
|
||||
public abstract IFramePart createPart(int partId, float[] rotation, float[] pivot);
|
||||
|
||||
public abstract IFramePart createPart(int partId, float[] rotation, float[] pivot, float speed, byte smooth);
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package noppes.npcs.api;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.TYPE)
|
||||
public @interface Cancelable {
|
||||
}
|
||||
@@ -0,0 +1,137 @@
|
||||
package noppes.npcs.api;
|
||||
|
||||
|
||||
public interface IBlock {
|
||||
int getX();
|
||||
|
||||
int getY();
|
||||
|
||||
int getZ();
|
||||
|
||||
/**
|
||||
*
|
||||
* @return An IPos object with the block's XYZ position.
|
||||
*/
|
||||
IPos getPosition();
|
||||
|
||||
/**
|
||||
* 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 world The destination world of the block
|
||||
* @return Whether the block was successfully placed
|
||||
*/
|
||||
boolean setPosition(IPos pos, IWorld world);
|
||||
|
||||
boolean setPosition(IPos pos);
|
||||
|
||||
boolean setPosition(int x, int y, int z, IWorld world);
|
||||
|
||||
boolean setPosition(int x, int y, int z);
|
||||
|
||||
/**
|
||||
*
|
||||
* @return The block name as it appears in the block registry. Return example: "minecraft:stone"
|
||||
*/
|
||||
String getName();
|
||||
|
||||
/**
|
||||
* Deletes the block, setting it to air.
|
||||
*/
|
||||
void remove();
|
||||
|
||||
boolean isAir();
|
||||
|
||||
/**
|
||||
*
|
||||
* @param blockName The name of the block to be set in place of this block.
|
||||
* @return The new block set in place of this block as an IBlock object.
|
||||
*/
|
||||
IBlock setBlock(String blockName);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param block Input IBlock object to replace this block.
|
||||
* @return The new block set in place of the previous block.
|
||||
*/
|
||||
IBlock setBlock(IBlock block);
|
||||
|
||||
/**
|
||||
*
|
||||
* @return True if the block can contain items like a chest does.
|
||||
*/
|
||||
boolean isContainer();
|
||||
|
||||
/**
|
||||
*
|
||||
* @return The container object of this block. If this block is not a container, an exception will be thrown.
|
||||
*/
|
||||
IContainer getContainer();
|
||||
|
||||
/**
|
||||
*
|
||||
* @return An IWorld object of the world this block is in.
|
||||
*/
|
||||
IWorld getWorld();
|
||||
|
||||
/**
|
||||
*
|
||||
* @return True if this block has a tile entity. Blocks with custom data like signs, player skulls, chests, etc. will have tile entities.
|
||||
*/
|
||||
boolean hasTileEntity();
|
||||
|
||||
/**
|
||||
*
|
||||
* @return An ITileEntity object which can modify this block's tile entity.
|
||||
*/
|
||||
ITileEntity getTileEntity();
|
||||
|
||||
/**
|
||||
*
|
||||
* @param tileEntity Replaces this block's tile entity based on the data given by this parameter.
|
||||
*/
|
||||
void setTileEntity(ITileEntity tileEntity);
|
||||
|
||||
/**
|
||||
*
|
||||
* @return An obfuscated MC object for the block's tile entity.
|
||||
*/
|
||||
Object getMCTileEntity();
|
||||
|
||||
/**
|
||||
*
|
||||
* @return An obfuscated MC block object.
|
||||
*/
|
||||
Object getMCBlock();
|
||||
|
||||
String getDisplayName();
|
||||
|
||||
/**
|
||||
*
|
||||
* @return An INbt object which can modify the block's tile entity's NBT data.
|
||||
*/
|
||||
INbt getTileEntityNBT();
|
||||
|
||||
/**
|
||||
*
|
||||
* @param maxVolume The volume threshold to determine whether this block's bounding box collides, if it has one.
|
||||
* @return Whether this block can be collided with
|
||||
*/
|
||||
boolean canCollide(double maxVolume);
|
||||
|
||||
boolean canCollide();
|
||||
|
||||
void setBounds(float minX, float minY, float minZ, float maxX, float maxY, float maxZ);
|
||||
|
||||
double getBlockBoundsMinX();
|
||||
|
||||
double getBlockBoundsMinY();
|
||||
|
||||
double getBlockBoundsMinZ();
|
||||
|
||||
double getBlockBoundsMaxX();
|
||||
|
||||
double getBlockBoundsMaxY();
|
||||
|
||||
double getBlockBoundsMaxZ();
|
||||
}
|
||||
@@ -0,0 +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);
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package noppes.npcs.api;
|
||||
|
||||
import noppes.npcs.api.entity.IPlayer;
|
||||
import noppes.npcs.api.item.IItemStack;
|
||||
|
||||
public interface IContainer {
|
||||
int getSize();
|
||||
|
||||
IItemStack getSlot(int slot);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param slot The slot to be replaced
|
||||
* @param item The item replacing the previous item in that slot, as an IItemStack object
|
||||
*/
|
||||
void setSlot(int slot, IItemStack item);
|
||||
|
||||
/**
|
||||
*
|
||||
* @return An obfuscated MC inventory object.
|
||||
*/
|
||||
Object getMCInventory();
|
||||
|
||||
/**
|
||||
*
|
||||
* @return An obfuscated MC container object.
|
||||
*/
|
||||
Object getMCContainer();
|
||||
|
||||
/**
|
||||
*
|
||||
* @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
|
||||
* @return The amount of the item stack found, based on the flags given above.
|
||||
*/
|
||||
int count(IItemStack itemStack, boolean ignoreDamage, boolean ignoreNBT);
|
||||
|
||||
/**
|
||||
*
|
||||
* @return A list of all item stacks in the container as a list of IItemStack objects.
|
||||
*/
|
||||
IItemStack[] getItems();
|
||||
|
||||
/**
|
||||
*
|
||||
* @return True if this container belongs to a Custom GUI.
|
||||
*/
|
||||
boolean isCustomGUI();
|
||||
|
||||
/**
|
||||
* Sends changes to be reflected on the player's client.
|
||||
*/
|
||||
void detectAndSendChanges();
|
||||
|
||||
boolean isPlayerNotUsingContainer(IPlayer player);
|
||||
}
|
||||
@@ -0,0 +1,135 @@
|
||||
package noppes.npcs.api;
|
||||
|
||||
import noppes.npcs.api.entity.*;
|
||||
|
||||
/**
|
||||
* 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);
|
||||
}
|
||||
@@ -0,0 +1,294 @@
|
||||
package noppes.npcs.api;
|
||||
|
||||
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.
|
||||
*
|
||||
*/
|
||||
public interface IParticle {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param entity Spawns this particle object on the given entity. When spawned this way, the particle will always have its origin at the entity.
|
||||
*/
|
||||
void spawn(IEntity entity);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param world Spawns the particle in the given world, at a position corresponding to this particle's position variables.
|
||||
*/
|
||||
void spawn(IWorld world);
|
||||
|
||||
/**
|
||||
*
|
||||
* @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.
|
||||
*/
|
||||
void spawn(IWorld world, double x, double y, double z);
|
||||
|
||||
@Deprecated
|
||||
void spawnOnEntity(IEntity entity);
|
||||
|
||||
@Deprecated
|
||||
void spawnInWorld(IWorld world);
|
||||
|
||||
@Deprecated
|
||||
void spawnInWorld(IWorld world, double x, double y, double z);
|
||||
|
||||
/**
|
||||
*
|
||||
* @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();
|
||||
|
||||
/**
|
||||
*
|
||||
* @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();
|
||||
|
||||
/**
|
||||
*
|
||||
* @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();
|
||||
|
||||
/**
|
||||
*
|
||||
* @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();
|
||||
|
||||
/**
|
||||
*
|
||||
* @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 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.
|
||||
*
|
||||
* @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 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.
|
||||
*/
|
||||
void setAnim(int animRate, boolean animLoop, int animStart, int animEnd);
|
||||
|
||||
int getAnimRate();
|
||||
|
||||
boolean getAnimLoop();
|
||||
|
||||
int getAnimStart();
|
||||
|
||||
int getAnimEnd();
|
||||
|
||||
/**
|
||||
*
|
||||
* @param x The X position from the particle's origin the particle will spawn at.
|
||||
* @param y The Y position from the particle's origin the particle will spawn at.
|
||||
* @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 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 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 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 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 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();
|
||||
|
||||
/**
|
||||
* Enables rotation about the Y axis.
|
||||
* 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 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();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
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();
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package noppes.npcs.api;
|
||||
|
||||
|
||||
public interface IPos {
|
||||
|
||||
int getX();
|
||||
@@ -14,44 +15,154 @@ public interface IPos {
|
||||
|
||||
double getZD();
|
||||
|
||||
/**
|
||||
* Shifts the IPos up by 1 block and returns the new object.
|
||||
*
|
||||
* @return the position above
|
||||
*/
|
||||
IPos up();
|
||||
|
||||
/**
|
||||
*
|
||||
* @param n The number of blocks to move the position up by.
|
||||
* @return The new IPos object.
|
||||
*/
|
||||
IPos up(double n);
|
||||
|
||||
/**
|
||||
* Shifts the IPos down by 1 block and returns the new object.
|
||||
*
|
||||
* @return the position below
|
||||
*/
|
||||
IPos down();
|
||||
|
||||
/**
|
||||
*
|
||||
* @param n The number of blocks to move the position down by.
|
||||
* @return The new IPos object.
|
||||
*/
|
||||
IPos down(double n);
|
||||
|
||||
/**
|
||||
* Shifts the IPos north by 1 block and returns the new object.
|
||||
*
|
||||
* @return the position to the north
|
||||
*/
|
||||
IPos north();
|
||||
|
||||
/**
|
||||
*
|
||||
* @param n The number of blocks to move the position north by.
|
||||
* @return The new IPos object.
|
||||
*/
|
||||
IPos north(double n);
|
||||
|
||||
/**
|
||||
* Shifts the IPos east by 1 block and returns the new object.
|
||||
*
|
||||
* @return the position to the east
|
||||
*/
|
||||
IPos east();
|
||||
|
||||
/**
|
||||
*
|
||||
* @param n The number of blocks to move the position east by.
|
||||
* @return The new IPos object.
|
||||
*/
|
||||
IPos east(double n);
|
||||
|
||||
/**
|
||||
* Shifts the IPos south by 1 block and returns the new object.
|
||||
*
|
||||
* @return the position to the south
|
||||
*/
|
||||
IPos south();
|
||||
|
||||
/**
|
||||
*
|
||||
* @param n The number of blocks to move the position south by.
|
||||
* @return The new IPos object.
|
||||
*/
|
||||
IPos south(double n);
|
||||
|
||||
/**
|
||||
* Shifts the IPos west by 1 block and returns the new object.
|
||||
*
|
||||
* @return the position to the west
|
||||
*/
|
||||
IPos west();
|
||||
|
||||
/**
|
||||
*
|
||||
* @param n The number of blocks to move the position west by.
|
||||
* @return The new IPos object.
|
||||
*/
|
||||
IPos west(double n);
|
||||
|
||||
/**
|
||||
* Adds the IPos' coordinates by each of the parameters given.
|
||||
*
|
||||
* @param x X coordinate amount to be added
|
||||
* @param y Y coordinate amount to be added
|
||||
* @param z Z coordinate amount to be added
|
||||
* @return The resulting IPos from the addition.
|
||||
*/
|
||||
IPos add(double x, double y, double z);
|
||||
|
||||
/**
|
||||
* Directly adds the coordinates of two IPos objects and returns the resulting IPos sum.
|
||||
* For example, if one IPos was represented by the coordinates (0,60,5), and another by (-10,-30,25),
|
||||
* the resulting object's coordinates are (0 - 10,60 - 30,5 + 25) = (-10,30,30).
|
||||
*
|
||||
* @param pos The position to be added to this IPos object.
|
||||
* @return The sum of the two IPos objects as a new IPos object.
|
||||
*/
|
||||
IPos add(IPos pos);
|
||||
|
||||
/**
|
||||
* Subtracts the IPos' coordinates by each of the parameters given.
|
||||
*
|
||||
* @param x X coordinate amount to be subtracted
|
||||
* @param y Y coordinate amount to be subtracted
|
||||
* @param z Z coordinate amount to be subtracted
|
||||
* @return The resulting IPos from the subtraction.
|
||||
*/
|
||||
IPos subtract(double x, double y, double z);
|
||||
|
||||
/**
|
||||
* Directly subtracts the coordinates of two IPos objects and returns the resulting IPos difference.
|
||||
* For example, if one IPos was represented by the coordinates (0,60,5), and another by (-10,-30,25),
|
||||
* the resulting object's coordinates are (0 + 10,60 + 30,5 - 25) = (10,90,-20).
|
||||
*
|
||||
* @param pos The position to be subtracted from this IPos object.
|
||||
* @return The difference of the two IPos objects as a new IPos object.
|
||||
*/
|
||||
IPos subtract(IPos pos);
|
||||
|
||||
/**
|
||||
* Returns a normalized vector of this block's position, calculated by:
|
||||
*
|
||||
* @return The normalized vector of this block position.
|
||||
*/
|
||||
IPos normalize();
|
||||
|
||||
double[] normalizeDouble();
|
||||
|
||||
/**
|
||||
* 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);
|
||||
|
||||
IPos crossProduct(double x, double y, double z);
|
||||
@@ -64,7 +175,14 @@ public interface IPos {
|
||||
|
||||
IPos fromLong(long serialized);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param pos The IPos object to calculate the distance to
|
||||
* @return The distance between this IPos object and the other.
|
||||
*/
|
||||
double distanceTo(IPos pos);
|
||||
|
||||
double distanceTo(double x, double y, double z);
|
||||
|
||||
Object getMCPos();
|
||||
}
|
||||
@@ -0,0 +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);
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
package noppes.npcs.api;
|
||||
|
||||
|
||||
public interface ITileEntity {
|
||||
/**
|
||||
*
|
||||
* @return An integer representing the metadata of this block. Blocks with different states will
|
||||
* return different values. For example, each stage of growth for a wheat crop will return a different value, each
|
||||
* orientation of a stair block will return a different value, etc.
|
||||
*/
|
||||
int getBlockMetadata();
|
||||
|
||||
/**
|
||||
*
|
||||
* @return The world this tile entity is in.
|
||||
*/
|
||||
IWorld getWorld();
|
||||
|
||||
void setWorld(IWorld world);
|
||||
|
||||
/**
|
||||
*
|
||||
* @return An obfuscated MC tile entity object.
|
||||
*/
|
||||
Object getMCTileEntity();
|
||||
|
||||
void markDirty();
|
||||
|
||||
/**
|
||||
* 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);
|
||||
|
||||
/**
|
||||
* @return A new IBlock object based on this tile entity's type.
|
||||
*/
|
||||
IBlock getBlockType();
|
||||
|
||||
/**
|
||||
*
|
||||
* @return True if the tile entity is invalid, false otherwise.
|
||||
*/
|
||||
boolean isInvalid();
|
||||
|
||||
/**
|
||||
* Invalidates the tile entity.
|
||||
*/
|
||||
void invalidate();
|
||||
|
||||
/**
|
||||
* Validates the tile entity for use.
|
||||
*/
|
||||
void validate();
|
||||
|
||||
/**
|
||||
* Updates the block's tile entity to the values set in this object.
|
||||
*/
|
||||
void updateContainingBlockInfo();
|
||||
|
||||
/**
|
||||
* Writes the tile entity to NBT and returns the compound tag.
|
||||
* @return the tile entity's NBT data
|
||||
*/
|
||||
INbt getNBT();
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
package noppes.npcs.api;
|
||||
|
||||
public interface ITimers {
|
||||
|
||||
int[] timerIds();
|
||||
|
||||
/**
|
||||
* 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 repeat Whether this timer repeats when it reaches its maximum amount of ticks.
|
||||
*/
|
||||
void start(int id, int ticks, boolean repeat);
|
||||
|
||||
/**
|
||||
* 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 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);
|
||||
|
||||
/**
|
||||
* 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);
|
||||
|
||||
/**
|
||||
* Removes all timers.
|
||||
*/
|
||||
void clear();
|
||||
|
||||
/**
|
||||
* @param id the timer ID
|
||||
* @return The amount of ticks elapsed in the timer.
|
||||
*/
|
||||
int ticks(int id);
|
||||
|
||||
/**
|
||||
* 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);
|
||||
|
||||
/**
|
||||
*
|
||||
* @return The amount of timers in the set of timers.
|
||||
*/
|
||||
int size();
|
||||
}
|
||||
@@ -1,8 +1,9 @@
|
||||
package noppes.npcs.api;
|
||||
|
||||
import noppes.npcs.api.entity.IEntity;
|
||||
import noppes.npcs.api.entity.IPlayer;
|
||||
import noppes.npcs.api.entity.*;
|
||||
import noppes.npcs.api.handler.data.ISound;
|
||||
import noppes.npcs.api.item.IItemStack;
|
||||
import noppes.npcs.api.scoreboard.IScoreboard;
|
||||
|
||||
public interface IWorld {
|
||||
/**
|
||||
@@ -17,6 +18,29 @@ public interface IWorld {
|
||||
|
||||
boolean areAllPlayersAsleep();
|
||||
|
||||
/**
|
||||
* @param x World position x
|
||||
* @param y World position y
|
||||
* @param z World position z
|
||||
* @return The block at the given position. Returns null if there isn't a block
|
||||
*/
|
||||
public IBlock getBlock(int x, int y, int z);
|
||||
|
||||
/**
|
||||
* @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);
|
||||
@@ -99,6 +123,16 @@ public interface IWorld {
|
||||
|
||||
void playSoundToNearExcept(IPlayer player, String sound, float volume, float pitch);
|
||||
|
||||
void playSound(int id, ISound sound);
|
||||
|
||||
void stopSound(int id);
|
||||
|
||||
void pauseSounds();
|
||||
|
||||
void continueSounds();
|
||||
|
||||
void stopSounds();
|
||||
|
||||
IEntity getEntityByID(int id);
|
||||
|
||||
boolean spawnEntityInWorld(IEntity entity);
|
||||
@@ -128,6 +162,29 @@ public interface IWorld {
|
||||
|
||||
IEntity[] getEntitiesNear(double x, double y, double z, double range);
|
||||
|
||||
/**
|
||||
* 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
|
||||
@@ -163,6 +220,37 @@ public interface IWorld {
|
||||
|
||||
String getSignText(IPos pos);
|
||||
|
||||
/**
|
||||
* @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
|
||||
* @return true if the block was successfully placed
|
||||
*/
|
||||
boolean setBlock(int x, int y, int z, IBlock block);
|
||||
|
||||
boolean setBlock(IPos pos, IBlock block);
|
||||
|
||||
/**
|
||||
* @param x World position x
|
||||
* @param y World position y
|
||||
* @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);
|
||||
|
||||
boolean isPlaceCancelled(IPos pos);
|
||||
@@ -179,16 +267,35 @@ public interface IWorld {
|
||||
|
||||
IPos rayCastPos(IPos startPos, IPos lookVector, int maxDistance);
|
||||
|
||||
/**
|
||||
* starting at the start position, draw a line in the lookVector direction until a block is detected
|
||||
*
|
||||
* @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);
|
||||
|
||||
IBlock rayCastBlock(double[] startPos, double[] lookVector, int maxDistance);
|
||||
|
||||
IBlock rayCastBlock(IPos startPos, IPos lookVector, int maxDistance, boolean stopOnBlock, boolean stopOnLiquid, boolean stopOnCollision);
|
||||
|
||||
IBlock rayCastBlock(IPos startPos, IPos lookVector, int maxDistance);
|
||||
|
||||
/**
|
||||
* @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
|
||||
*/
|
||||
IPos getNearestAir(IPos startPos, int maxHeight);
|
||||
public IPos getNearestAir(IPos startPos, int maxHeight);
|
||||
|
||||
IEntity[] rayCastEntities(double[] startPos, double[] lookVector, int maxDistance, double offset, double range, boolean stopOnBlock, boolean stopOnLiquid, boolean stopOnCollision);
|
||||
|
||||
IEntity[] rayCastEntities(IEntity[] ignoreEntities, double[] startPos, double[] lookVector, int maxDistance, double offset, double range, boolean stopOnBlock, boolean stopOnLiquid, boolean stopOnCollision);
|
||||
public IEntity[] rayCastEntities(IEntity[] ignoreEntities, double[] startPos, double[] lookVector, int maxDistance, double offset, double range, boolean stopOnBlock, boolean stopOnLiquid, boolean stopOnCollision);
|
||||
|
||||
IEntity[] rayCastEntities(IPos startPos, IPos lookVector, int maxDistance, double offset, double range, boolean stopOnBlock, boolean stopOnLiquid, boolean stopOnCollision);
|
||||
|
||||
@@ -233,6 +340,23 @@ public interface IWorld {
|
||||
|
||||
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
|
||||
*/
|
||||
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 damage The damage value
|
||||
@@ -241,6 +365,13 @@ public interface IWorld {
|
||||
*/
|
||||
IItemStack createItem(String id, int damage, int size);
|
||||
|
||||
/**
|
||||
* @param directory The particle's texture directory. Use only forward slashes when writing a directory. Example: "customnpcs:textures/particle/tail.png"
|
||||
* @return Returns IEntityParticle object
|
||||
*/
|
||||
@Deprecated
|
||||
IParticle createEntityParticle(String directory);
|
||||
|
||||
@Deprecated
|
||||
Object getTempData(String key);
|
||||
|
||||
@@ -290,7 +421,7 @@ public interface IWorld {
|
||||
|
||||
IPlayer[] getAllServerPlayers();
|
||||
|
||||
String[] getPlayerNames();
|
||||
public String[] getPlayerNames();
|
||||
|
||||
/**
|
||||
* @param x Position x
|
||||
@@ -321,6 +452,8 @@ public interface IWorld {
|
||||
|
||||
IEntity spawnClone(IPos pos, int tab, String name);
|
||||
|
||||
IScoreboard getScoreboard();
|
||||
|
||||
/**
|
||||
* @return Returns minecraft world object
|
||||
* @since 1.7.10c
|
||||
@@ -334,5 +467,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,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);
|
||||
}
|
||||
+146
@@ -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);
|
||||
}
|
||||
@@ -0,0 +1,145 @@
|
||||
package noppes.npcs.api.block;
|
||||
|
||||
import noppes.npcs.api.IBlock;
|
||||
import noppes.npcs.api.ITimers;
|
||||
import noppes.npcs.api.item.IItemStack;
|
||||
|
||||
public interface IBlockScripted extends IBlock {
|
||||
|
||||
/**
|
||||
* @param item The item to be set as model
|
||||
*/
|
||||
void setModel(IItemStack item);
|
||||
|
||||
void setModel(String name);
|
||||
|
||||
IItemStack getModel();
|
||||
|
||||
ITimers getTimers();
|
||||
|
||||
/**
|
||||
* @param strength Sets the strength of the redstone signal (0-15)
|
||||
*/
|
||||
void setRedstonePower(int strength);
|
||||
|
||||
/**
|
||||
* @return Returns the current redstone power (0-15) this block is giving off
|
||||
*/
|
||||
int getRedstonePower();
|
||||
|
||||
void setIsLadder(boolean enabled);
|
||||
|
||||
boolean getIsLadder();
|
||||
|
||||
/**
|
||||
* @param value Sets the light value (0-15)
|
||||
*/
|
||||
void setLight(int value);
|
||||
|
||||
/**
|
||||
* @return Returns the light value (0-15)
|
||||
*/
|
||||
int getLight();
|
||||
|
||||
/**
|
||||
* @param x Scale x (0-10)
|
||||
* @param y Scale y (0-10)
|
||||
* @param z Scale z (0-10)
|
||||
*/
|
||||
void setScale(float x, float y, float z);
|
||||
|
||||
float getScaleX();
|
||||
|
||||
float getScaleY();
|
||||
|
||||
float getScaleZ();
|
||||
|
||||
/**
|
||||
* @param x Rotation x (0-359)
|
||||
* @param y Rotation y (0-359)
|
||||
* @param z Rotation z (0-359)
|
||||
*/
|
||||
void setRotation(int x, int y, int z);
|
||||
|
||||
int getRotationX();
|
||||
|
||||
int getRotationY();
|
||||
|
||||
int getRotationZ();
|
||||
|
||||
/**
|
||||
* On servers the enable-command-block option in the server.properties needs to be set to true <br>
|
||||
* 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);
|
||||
|
||||
boolean getIsPassable();
|
||||
|
||||
void setIsPassable(boolean bo);
|
||||
|
||||
/**
|
||||
* @return Harvesting hardness (-1 makes it unharvestable)
|
||||
*/
|
||||
float getHardness();
|
||||
|
||||
void setHardness(float hardness);
|
||||
|
||||
/**
|
||||
* @return Explosion resistance (-1 makes it unexplodable)
|
||||
*/
|
||||
float getResistance();
|
||||
|
||||
void setResistance(float resistance);
|
||||
|
||||
ITextPlane getTextPlane();
|
||||
|
||||
ITextPlane getTextPlane2();
|
||||
|
||||
ITextPlane getTextPlane3();
|
||||
|
||||
ITextPlane getTextPlane4();
|
||||
|
||||
ITextPlane getTextPlane5();
|
||||
|
||||
ITextPlane getTextPlane6();
|
||||
|
||||
void setStoredData(String key, Object value);
|
||||
|
||||
Object getStoredData(String key);
|
||||
|
||||
void removeStoredData(String key);
|
||||
|
||||
boolean hasStoredData(String key);
|
||||
|
||||
void clearStoredData();
|
||||
|
||||
String[] getStoredDataKeys();
|
||||
|
||||
void removeTempData(String key);
|
||||
|
||||
void setTempData(String key, Object value);
|
||||
|
||||
boolean hasTempData(String key);
|
||||
|
||||
Object getTempData(String key);
|
||||
|
||||
void clearTempData();
|
||||
|
||||
String[] getTempDataKeys();
|
||||
}
|
||||
@@ -0,0 +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);
|
||||
|
||||
/**
|
||||
* 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();
|
||||
|
||||
/**
|
||||
* Sets the scale of the text plane.
|
||||
* @param scale the scale factor to set. Default: 1
|
||||
*/
|
||||
public void setScale(float scale);
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package noppes.npcs.api.entity;
|
||||
|
||||
import noppes.npcs.api.item.IItemStack;
|
||||
|
||||
/**
|
||||
* Represents an animal entity with additional behavior such as breeding,
|
||||
* following, and mating.
|
||||
*
|
||||
*/
|
||||
public interface IAnimal extends IEntityLiving {
|
||||
|
||||
/**
|
||||
* Checks whether the specified item can be used to breed this animal.
|
||||
* (e.g. wheat, carrots or seeds depending on the animal type)
|
||||
*
|
||||
* @param itemStack the item to test.
|
||||
* @return true if the item is a breeding item; false otherwise.
|
||||
*/
|
||||
boolean isBreedingItem(IItemStack itemStack);
|
||||
|
||||
/**
|
||||
* Called when a player interacts with the animal.
|
||||
* For example, this might return true if the player milks a cow or saddles a pig.
|
||||
*
|
||||
* @param player the interacting player.
|
||||
* @return true if the interaction was handled; false otherwise.
|
||||
*/
|
||||
boolean interact(IPlayer player);
|
||||
|
||||
/**
|
||||
* Sets the specified player as the one to follow.
|
||||
*
|
||||
* @param player the player to follow.
|
||||
*/
|
||||
void setFollowPlayer(IPlayer player);
|
||||
|
||||
/**
|
||||
* Returns the player that this animal is currently following.
|
||||
*
|
||||
* @return the following player, or null if not following anyone.
|
||||
*/
|
||||
IPlayer followingPlayer();
|
||||
|
||||
/**
|
||||
* Checks if the animal is currently in a "love" state,
|
||||
* indicating readiness to mate.
|
||||
*
|
||||
* @return true if the animal is in love; false otherwise.
|
||||
*/
|
||||
boolean isInLove();
|
||||
|
||||
/**
|
||||
* Resets the animal's love state.
|
||||
*/
|
||||
void resetInLove();
|
||||
|
||||
/**
|
||||
* Checks if this animal can mate with another animal.
|
||||
*
|
||||
* @param animal the other animal.
|
||||
* @return true if mating is possible; false otherwise.
|
||||
*/
|
||||
boolean canMateWith(IAnimal animal);
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package noppes.npcs.api.entity;
|
||||
|
||||
|
||||
/**
|
||||
* Represents a arrow entity with additional methods.
|
||||
*
|
||||
*/
|
||||
public interface IArrow extends IEntity {
|
||||
|
||||
/**
|
||||
* 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();
|
||||
}
|
||||
@@ -1,13 +1,17 @@
|
||||
package noppes.npcs.api.entity;
|
||||
|
||||
import noppes.npcs.api.INbt;
|
||||
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.data.IAnimationData;
|
||||
import noppes.npcs.api.handler.data.ILines;
|
||||
import noppes.npcs.api.handler.data.IMagicData;
|
||||
import noppes.npcs.api.handler.IActionManager;
|
||||
import noppes.npcs.api.handler.IOverlayHandler;
|
||||
import noppes.npcs.api.handler.data.*;
|
||||
import noppes.npcs.api.item.IItemStack;
|
||||
import noppes.npcs.api.jobs.IJob;
|
||||
import noppes.npcs.api.roles.IRole;
|
||||
|
||||
/**
|
||||
* Represents a customizable NPC with a wide variety of properties such as appearance,
|
||||
@@ -22,7 +26,6 @@ public interface ICustomNpc extends IEntityLiving, IAnimatable {
|
||||
* @return the MC entity as a generic Object.
|
||||
*/
|
||||
Object getMCEntity();
|
||||
|
||||
/**
|
||||
* Returns the current NPC's size (scale factor) within the range 1–30.
|
||||
*
|
||||
@@ -214,6 +217,13 @@ public interface ICustomNpc extends IEntityLiving, IAnimatable {
|
||||
*/
|
||||
boolean getReturnToHome();
|
||||
|
||||
/**
|
||||
* Returns the faction associated with the NPC.
|
||||
*
|
||||
* @return the NPC's faction.
|
||||
*/
|
||||
IFaction getFaction();
|
||||
|
||||
/**
|
||||
* Sets the NPC's faction by its ID.
|
||||
*
|
||||
@@ -316,6 +326,14 @@ public interface ICustomNpc extends IEntityLiving, IAnimatable {
|
||||
*/
|
||||
void say(IPlayer player, String message);
|
||||
|
||||
/**
|
||||
* Retrieves the dialog from the specified slot.
|
||||
*
|
||||
* @param slot the dialog slot.
|
||||
* @return the dialog instance.
|
||||
*/
|
||||
IDialog getDialog(int slot);
|
||||
|
||||
/**
|
||||
* Returns the dialog ID in the specified slot.
|
||||
*
|
||||
@@ -324,6 +342,14 @@ public interface ICustomNpc extends IEntityLiving, IAnimatable {
|
||||
*/
|
||||
int getDialogId(int slot);
|
||||
|
||||
/**
|
||||
* Sets the dialog for the specified slot.
|
||||
*
|
||||
* @param slot the dialog slot.
|
||||
* @param dialog the dialog instance.
|
||||
*/
|
||||
void setDialog(int slot, IDialog dialog);
|
||||
|
||||
/**
|
||||
* Sets the dialog for the specified slot by its ID.
|
||||
*
|
||||
@@ -482,6 +508,13 @@ public interface ICustomNpc extends IEntityLiving, IAnimatable {
|
||||
*/
|
||||
IAnimationData getAnimationData();
|
||||
|
||||
/**
|
||||
* Returns the NPC's current role.
|
||||
*
|
||||
* @return the role instance.
|
||||
*/
|
||||
IRole getRole();
|
||||
|
||||
/**
|
||||
* Sets the NPC's role by its ID.
|
||||
*
|
||||
@@ -489,6 +522,13 @@ public interface ICustomNpc extends IEntityLiving, IAnimatable {
|
||||
*/
|
||||
void setRole(int role);
|
||||
|
||||
/**
|
||||
* Returns the NPC's current job.
|
||||
*
|
||||
* @return the job instance.
|
||||
*/
|
||||
IJob getJob();
|
||||
|
||||
/**
|
||||
* Sets the NPC's job by its ID.
|
||||
*
|
||||
@@ -1527,6 +1567,13 @@ public interface ICustomNpc extends IEntityLiving, IAnimatable {
|
||||
*/
|
||||
void executeCommand(String command);
|
||||
|
||||
/**
|
||||
* Returns the model data associated with the NPC.
|
||||
*
|
||||
* @return the model data, or null if not available.
|
||||
*/
|
||||
IModelData getModelData();
|
||||
|
||||
/**
|
||||
* Returns the hitbox data associated with the NPC.
|
||||
*
|
||||
@@ -1777,6 +1824,13 @@ public interface ICustomNpc extends IEntityLiving, IAnimatable {
|
||||
*/
|
||||
long getAge();
|
||||
|
||||
/**
|
||||
* Returns the timers associated with the NPC.
|
||||
*
|
||||
* @return the timers.
|
||||
*/
|
||||
ITimers getTimers();
|
||||
|
||||
/**
|
||||
* Sets the NPC's flying ability.
|
||||
*
|
||||
@@ -1935,6 +1989,13 @@ public interface ICustomNpc extends IEntityLiving, IAnimatable {
|
||||
*/
|
||||
void setGlowTexture(String texture);
|
||||
|
||||
/**
|
||||
* Returns the NPC's overlay handler.
|
||||
*
|
||||
* @return the overlay handler.
|
||||
*/
|
||||
IOverlayHandler getOverlays();
|
||||
|
||||
/**
|
||||
* Sets the NPC's collision type.
|
||||
*
|
||||
@@ -1959,10 +2020,33 @@ public interface ICustomNpc extends IEntityLiving, IAnimatable {
|
||||
*/
|
||||
void updateAI();
|
||||
|
||||
/**
|
||||
* Returns the action manager used for scheduling NPC actions.
|
||||
*
|
||||
* @return the action manager.
|
||||
*/
|
||||
IActionManager getActionManager();
|
||||
|
||||
/**
|
||||
* Returns the Magic Data of an NPC
|
||||
*
|
||||
* @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,489 @@
|
||||
package noppes.npcs.api.entity;
|
||||
|
||||
import noppes.npcs.api.item.IItemStack;
|
||||
|
||||
/**
|
||||
* Extends IPlayer with additional methods specific to DBC (Dragon Ball C) players.
|
||||
* These methods manage stats, bonus attributes, form configurations, inventory, and more.
|
||||
*/
|
||||
public interface IDBCPlayer extends IPlayer {
|
||||
|
||||
/**
|
||||
* Sets the specified stat to the given value.
|
||||
*
|
||||
* @param stat the stat name (e.g. "str", "dex", "con", "wil", "mnd", "spi").
|
||||
* @param value the new value.
|
||||
*/
|
||||
void setStat(String stat, int value);
|
||||
|
||||
/**
|
||||
* Retrieves the value of the specified stat.
|
||||
*
|
||||
* @param stat the stat name.
|
||||
* @return the stat value.
|
||||
*/
|
||||
int getStat(String stat);
|
||||
|
||||
/**
|
||||
* Adds a bonus attribute for the specified stat.
|
||||
*
|
||||
* @param stat the stat name.
|
||||
* @param bonusID the identifier for the bonus.
|
||||
* @param operation the arithmetic operation to apply.
|
||||
* @param attributeValue the attribute value.
|
||||
*/
|
||||
void addBonusAttribute(String stat, String bonusID, String operation, double attributeValue);
|
||||
|
||||
/**
|
||||
* Adds a bonus attribute for the specified stat.
|
||||
*
|
||||
* @param stat the stat name.
|
||||
* @param bonusID the identifier for the bonus.
|
||||
* @param operation the arithmetic operation to apply.
|
||||
* @param attributeValue the attribute value.
|
||||
* @param endOfTheList whether to add the bonus at the end of the list.
|
||||
*/
|
||||
void addBonusAttribute(String stat, String bonusID, String operation, double attributeValue, boolean endOfTheList);
|
||||
|
||||
/**
|
||||
* Increases an existing bonus attribute for the specified stat.
|
||||
*
|
||||
* @param stat the stat name.
|
||||
* @param bonusID the identifier for the bonus.
|
||||
* @param operation the arithmetic operation.
|
||||
* @param attributeValue the value to add.
|
||||
*/
|
||||
void addToBonusAttribute(String stat, String bonusID, String operation, double attributeValue);
|
||||
|
||||
/**
|
||||
* Sets a bonus attribute for the specified stat.
|
||||
*
|
||||
* @param stat the stat name.
|
||||
* @param bonusID the identifier for the bonus.
|
||||
* @param operation the arithmetic operation.
|
||||
* @param attributeValue the value to set.
|
||||
*/
|
||||
void setBonusAttribute(String stat, String bonusID, String operation, double attributeValue);
|
||||
|
||||
/**
|
||||
* Retrieves a bonus attribute for the specified stat.
|
||||
*
|
||||
* @param stat the stat name.
|
||||
* @param bonusID the identifier for the bonus.
|
||||
*/
|
||||
void getBonusAttribute(String stat, String bonusID);
|
||||
|
||||
/**
|
||||
* Removes the bonus attribute with the given identifier for the specified stat.
|
||||
*
|
||||
* @param stat the stat name.
|
||||
* @param bonusID the bonus identifier.
|
||||
*/
|
||||
void removeBonusAttribute(String stat, String bonusID);
|
||||
|
||||
/**
|
||||
* Clears all bonus attributes for the specified stat.
|
||||
*
|
||||
* @param stat the stat name.
|
||||
*/
|
||||
void clearBonusAttribute(String stat);
|
||||
|
||||
/**
|
||||
* Retrieves a bonus attribute string based on an action.
|
||||
*
|
||||
* @param action the action (get, remove, or clear).
|
||||
* @param stat the stat name.
|
||||
* @param bonusID the bonus identifier.
|
||||
* @return the bonus attribute string.
|
||||
*/
|
||||
String bonusAttribute(String action, String stat, String bonusID);
|
||||
|
||||
/**
|
||||
* Retrieves a bonus attribute string with full parameters.
|
||||
*
|
||||
* @param action the action (add, addto, set, get, remove, or clear).
|
||||
* @param stat the stat name.
|
||||
* @param bonusID the bonus identifier.
|
||||
* @param operation the arithmetic operation.
|
||||
* @param attributeValue the attribute value.
|
||||
* @param endOfTheList whether to add at the end of the list.
|
||||
* @return the bonus attribute string.
|
||||
*/
|
||||
String bonusAttribute(String action, String stat, String bonusID, String operation, double attributeValue, boolean endOfTheList);
|
||||
|
||||
/**
|
||||
* Sets the release state.
|
||||
*
|
||||
* @param release the release value.
|
||||
*/
|
||||
void setRelease(byte release);
|
||||
|
||||
/**
|
||||
* Returns the current release state.
|
||||
*
|
||||
* @return the release value.
|
||||
*/
|
||||
byte getRelease();
|
||||
|
||||
/**
|
||||
* Sets the body value. Also HP.
|
||||
*
|
||||
* @param body the body value.
|
||||
*/
|
||||
void setBody(int body);
|
||||
|
||||
/**
|
||||
* Returns the body value. Also HP.
|
||||
*
|
||||
* @return the body.
|
||||
*/
|
||||
int getBody();
|
||||
|
||||
/**
|
||||
* Sets the HP value.
|
||||
*
|
||||
* @param hp the HP value.
|
||||
*/
|
||||
void setHP(int hp);
|
||||
|
||||
/**
|
||||
* Returns the HP value.
|
||||
*
|
||||
* @return the HP.
|
||||
*/
|
||||
int getHP();
|
||||
|
||||
/**
|
||||
* Sets the stamina value.
|
||||
*
|
||||
* @param stamina the stamina value.
|
||||
*/
|
||||
void setStamina(int stamina);
|
||||
|
||||
/**
|
||||
* Returns the stamina value.
|
||||
*
|
||||
* @return the stamina.
|
||||
*/
|
||||
int getStamina();
|
||||
|
||||
/**
|
||||
* Sets the Ki value.
|
||||
*
|
||||
* @param ki Ki value.
|
||||
*/
|
||||
void setKi(int ki);
|
||||
|
||||
/**
|
||||
* Returns the Ki value.
|
||||
*
|
||||
* @return Ki of Player.
|
||||
*/
|
||||
int getKi();
|
||||
|
||||
/**
|
||||
* Sets the TP value.
|
||||
*
|
||||
* @param tp Set TP Amount
|
||||
*/
|
||||
void setTP(int tp);
|
||||
|
||||
/**
|
||||
* Returns the TP value.
|
||||
*
|
||||
* @return Player TP Amount
|
||||
*/
|
||||
int getTP();
|
||||
|
||||
/**
|
||||
* Sets the gravity for the player.
|
||||
*
|
||||
* @param gravity the gravity value.
|
||||
*/
|
||||
void setGravity(float gravity);
|
||||
|
||||
/**
|
||||
* Returns the current gravity value.
|
||||
*
|
||||
* @return the gravity.
|
||||
*/
|
||||
float getGravity();
|
||||
|
||||
/**
|
||||
* Checks if the player is blocking.
|
||||
*
|
||||
* @return true if blocking; false otherwise.
|
||||
*/
|
||||
boolean isBlocking();
|
||||
|
||||
/**
|
||||
* Sets the hair code used to define the player's hairstyle.
|
||||
*
|
||||
* @param hairCode the hair code string.
|
||||
*/
|
||||
void setHairCode(String hairCode);
|
||||
|
||||
/**
|
||||
* Returns the player's hair code.
|
||||
*
|
||||
* @return the hair code string.
|
||||
*/
|
||||
String getHairCode();
|
||||
|
||||
/**
|
||||
* Sets the extra code used for additional customization.
|
||||
*
|
||||
* @param extraCode the extra code string.
|
||||
*/
|
||||
void setExtraCode(String extraCode);
|
||||
|
||||
/**
|
||||
* Returns the player's extra code.
|
||||
*
|
||||
* @return the extra code string.
|
||||
*/
|
||||
String getExtraCode();
|
||||
|
||||
/**
|
||||
* Sets an item in the DBC extra inventory slot.
|
||||
* <p>
|
||||
* Slot definitions:
|
||||
* <ul>
|
||||
* <li>0 - Weight</li>
|
||||
* <li>1 - Body</li>
|
||||
* <li>2 - Head</li>
|
||||
* <li>3 - 4th Vanity Slot Down to the left</li>
|
||||
* <li>4 - 3rd Vanity Slot Down to the left</li>
|
||||
* <li>5 - 2nd Vanity Slot Down to the left</li>
|
||||
* <li>6 - 1st Vanity Slot Down to the left</li>
|
||||
* <li>7 - 4th Vanity Slot Down to the right</li>
|
||||
* <li>8 - 3rd Vanity Slot Down to the right</li>
|
||||
* <li>9 - 2nd Vanity Slot Down to the right</li>
|
||||
* <li>10 - 1st Vanity Slot Down to the right</li>
|
||||
* </ul>
|
||||
*
|
||||
* @param itemStack the item to set (or null to remove).
|
||||
* @param slot the slot index.
|
||||
* @param vanity whether the slot is in the vanity inventory.
|
||||
*/
|
||||
void setItem(IItemStack itemStack, byte slot, boolean vanity);
|
||||
|
||||
/**
|
||||
* Retrieves the item from the specified DBC inventory slot.
|
||||
*
|
||||
* @param slot the slot index.
|
||||
* @param vanity whether the slot is in the vanity inventory.
|
||||
* @return the item stack, or null if empty.
|
||||
*/
|
||||
IItemStack getItem(byte slot, boolean vanity);
|
||||
|
||||
/**
|
||||
* Returns the entire DBC extra inventory.
|
||||
*
|
||||
* @return an array of item stacks.
|
||||
*/
|
||||
IItemStack[] getInventory();
|
||||
|
||||
/**
|
||||
* Sets the player's form.
|
||||
*
|
||||
* @param form the form value.
|
||||
*/
|
||||
void setForm(byte form);
|
||||
|
||||
/**
|
||||
* Returns the player's current form.
|
||||
*
|
||||
* @return the form value.
|
||||
*/
|
||||
byte getForm();
|
||||
|
||||
/**
|
||||
* Sets the player's secondary form.
|
||||
*
|
||||
* @param form2 the secondary form value.
|
||||
*/
|
||||
void setForm2(byte form2);
|
||||
|
||||
/**
|
||||
* Returns the player's secondary form.
|
||||
*
|
||||
* @return the secondary form value.
|
||||
*/
|
||||
byte getForm2();
|
||||
|
||||
/**
|
||||
* Returns the mastery value for a specific racial form.
|
||||
*
|
||||
* @param form the form index.
|
||||
* @return the mastery value.
|
||||
*/
|
||||
double getRacialFormMastery(byte form);
|
||||
|
||||
/**
|
||||
* Sets the mastery value for a specific racial form.
|
||||
*
|
||||
* @param form the form index.
|
||||
* @param value the new mastery value.
|
||||
*/
|
||||
void setRacialFormMastery(byte form, double value);
|
||||
|
||||
/**
|
||||
* Adds to the mastery value for a specific racial form.
|
||||
*
|
||||
* @param form the form index.
|
||||
* @param value the value to add.
|
||||
*/
|
||||
void addRacialFormMastery(byte form, double value);
|
||||
|
||||
/**
|
||||
* Returns the mastery value for a non-racial (other) form.
|
||||
*
|
||||
* @param formName the name of the form.
|
||||
* @return the mastery value.
|
||||
*/
|
||||
double getOtherFormMastery(String formName);
|
||||
|
||||
/**
|
||||
* Sets the mastery value for a non-racial (other) form.
|
||||
*
|
||||
* @param formName the name of the form.
|
||||
* @param value the new mastery value.
|
||||
*/
|
||||
void setOtherFormMastery(String formName, double value);
|
||||
|
||||
/**
|
||||
* Adds to the mastery value for a non-racial (other) form.
|
||||
*
|
||||
* @param formName the name of the form.
|
||||
* @param value the value to add.
|
||||
*/
|
||||
void addOtherFormMastery(String formName, double value);
|
||||
|
||||
/**
|
||||
* Sets the player's power points.
|
||||
*
|
||||
* @param points the power points.
|
||||
*/
|
||||
void setPowerPoints(int points);
|
||||
|
||||
/**
|
||||
* Returns the player's power points.
|
||||
*
|
||||
* @return the power points.
|
||||
*/
|
||||
int getPowerPoints();
|
||||
|
||||
/**
|
||||
* Sets the player's aura color.
|
||||
*
|
||||
* @param color the aura color.
|
||||
*/
|
||||
void setAuraColor(int color);
|
||||
|
||||
/**
|
||||
* Returns the player's aura color.
|
||||
*
|
||||
* @return the aura color.
|
||||
*/
|
||||
int getAuraColor();
|
||||
|
||||
/**
|
||||
* Sets the player's form level.
|
||||
*
|
||||
* @param level the form level.
|
||||
*/
|
||||
void setFormLevel(int level);
|
||||
|
||||
/**
|
||||
* Returns the player's form level.
|
||||
*
|
||||
* @return the form level.
|
||||
*/
|
||||
int getFormLevel();
|
||||
|
||||
/**
|
||||
* Sets the player's skills.
|
||||
*
|
||||
* @param skills a string representing the player's skills.
|
||||
*/
|
||||
void setSkills(String skills);
|
||||
|
||||
/**
|
||||
* Returns the player's skills.
|
||||
*
|
||||
* @return a string representing the player's skills.
|
||||
*/
|
||||
String getSkills();
|
||||
|
||||
/**
|
||||
* Sets the player's status effects.
|
||||
*
|
||||
* @param statusEffects a string representing status effects.
|
||||
*/
|
||||
void setJRMCSE(String statusEffects);
|
||||
|
||||
/**
|
||||
* Returns the player's status effects.
|
||||
*
|
||||
* @return a string representing the player's status effects.
|
||||
*/
|
||||
String getJRMCSE();
|
||||
|
||||
/**
|
||||
* Sets the player's race.
|
||||
*
|
||||
* @param race the race value.
|
||||
*/
|
||||
void setRace(byte race);
|
||||
|
||||
/**
|
||||
* Returns the player's race.
|
||||
*
|
||||
* @return the race value.
|
||||
*/
|
||||
int getRace();
|
||||
|
||||
/**
|
||||
* Sets the player's DBC class.
|
||||
*
|
||||
* @param dbcClass the DBC class value.
|
||||
*/
|
||||
void setDBCClass(byte dbcClass);
|
||||
|
||||
/**
|
||||
* Returns the player's DBC class.
|
||||
*
|
||||
* @return the DBC class.
|
||||
*/
|
||||
byte getDBCClass();
|
||||
|
||||
/**
|
||||
* Sets the player's power type.
|
||||
*
|
||||
* @param powerType the power type.
|
||||
*/
|
||||
void setPowerType(byte powerType);
|
||||
|
||||
/**
|
||||
* Returns the player's power type.
|
||||
*
|
||||
* @return the power type.
|
||||
*/
|
||||
int getPowerType();
|
||||
|
||||
/**
|
||||
* Returns the player's kill count for a given type.
|
||||
*
|
||||
* @param type the kill count type ("evil", "good", "neutral", or "all").
|
||||
* @return the kill count.
|
||||
*/
|
||||
int getKillCount(String type);
|
||||
|
||||
/**
|
||||
* Returns the fusion string for the player.
|
||||
*
|
||||
* @return the fusion string.
|
||||
*/
|
||||
String getFusionString();
|
||||
}
|
||||
@@ -0,0 +1,126 @@
|
||||
package noppes.npcs.api.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 extends IEntity {
|
||||
|
||||
// ==================== 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,148 @@
|
||||
package noppes.npcs.api.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 extends IEnergyAbility {
|
||||
|
||||
// ==================== 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,32 @@
|
||||
package noppes.npcs.api.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 extends IEnergyProjectile {
|
||||
|
||||
/**
|
||||
* 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,37 @@
|
||||
package noppes.npcs.api.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 extends IEnergyProjectile {
|
||||
|
||||
/**
|
||||
* 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,14 @@
|
||||
package noppes.npcs.api.entity;
|
||||
|
||||
|
||||
/**
|
||||
* Represents an energy dome barrier - a spherical shield centered on the caster.
|
||||
*/
|
||||
public interface IEnergyDome extends IEnergyBarrier {
|
||||
|
||||
/** @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,59 @@
|
||||
package noppes.npcs.api.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 extends IEnergyAbility {
|
||||
|
||||
// ==================== 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,49 @@
|
||||
package noppes.npcs.api.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 extends IEnergyProjectile {
|
||||
|
||||
/**
|
||||
* 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,24 @@
|
||||
package noppes.npcs.api.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 extends IEnergyProjectile {
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package noppes.npcs.api.entity;
|
||||
|
||||
|
||||
/**
|
||||
* Represents an energy panel barrier - a flat rectangular shield (Wall or Shield mode).
|
||||
*/
|
||||
public interface IEnergyPanel extends IEnergyBarrier {
|
||||
|
||||
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,279 @@
|
||||
package noppes.npcs.api.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 extends IEnergyAbility {
|
||||
|
||||
// ==================== 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,22 @@
|
||||
package noppes.npcs.api.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 extends IEnergyProjectile {
|
||||
|
||||
/**
|
||||
* 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,66 @@
|
||||
package noppes.npcs.api.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 extends IEnergyAbility {
|
||||
|
||||
// ==================== 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,108 @@
|
||||
package noppes.npcs.api.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 extends IEntity {
|
||||
|
||||
// ==================== 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();
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package noppes.npcs.api.entity;
|
||||
|
||||
import noppes.npcs.api.INbt;
|
||||
import noppes.npcs.api.IParticle;
|
||||
import noppes.npcs.api.IPos;
|
||||
import noppes.npcs.api.IWorld;
|
||||
import noppes.npcs.api.item.IItemStack;
|
||||
@@ -8,10 +9,17 @@ import noppes.npcs.api.item.IItemStack;
|
||||
/**
|
||||
* Represents a generic entity in the world.
|
||||
* Provides methods to access or modify the entity's position, motion, temporary and persistent data,
|
||||
* and to perform various actions (such as dropping items or changing dimensions).
|
||||
* and to perform various actions (such as spawning particles, dropping items, or changing dimensions).
|
||||
*/
|
||||
public interface IEntity {
|
||||
|
||||
/**
|
||||
* Spawns the given particle effect associated with this entity.
|
||||
*
|
||||
* @param entityParticle The particle effect to spawn.
|
||||
*/
|
||||
void spawnParticle(IParticle entityParticle);
|
||||
|
||||
/**
|
||||
* Returns the unique entity ID.
|
||||
*
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
package noppes.npcs.api.entity;
|
||||
|
||||
import noppes.npcs.api.item.IItemStack;
|
||||
|
||||
/**
|
||||
* Represents an item entity in the world.
|
||||
* Provides methods to manage pickup delay, age, ownership, and the contained item.
|
||||
*
|
||||
*/
|
||||
public interface IEntityItem extends IEntity {
|
||||
|
||||
/**
|
||||
* Returns the owner name of the item.
|
||||
* Only the owner can pick the item up (unless the age is very low).
|
||||
*
|
||||
* @return the owner's name.
|
||||
*/
|
||||
String getOwner();
|
||||
|
||||
/**
|
||||
* Sets the owner name of the item.
|
||||
*
|
||||
* @param name the owner's name.
|
||||
*/
|
||||
void setOwner(String name);
|
||||
|
||||
/**
|
||||
* Returns the thrower (entity that threw the item).
|
||||
*
|
||||
* @return the thrower's name.
|
||||
*/
|
||||
String getThrower();
|
||||
|
||||
/**
|
||||
* Sets the thrower (entity that threw the item).
|
||||
*
|
||||
* @param name the thrower's name.
|
||||
*/
|
||||
void setThrower(String name);
|
||||
|
||||
/**
|
||||
* @return Ticks remaining before the item can be picked up.
|
||||
* (32767 indicates an infinite delay.)
|
||||
*/
|
||||
int getPickupDelay();
|
||||
|
||||
/**
|
||||
* Sets the delay before the item can be picked up.
|
||||
*
|
||||
* @param delay the pickup delay in ticks (32767 for infinite delay).
|
||||
*/
|
||||
void setPickupDelay(int delay);
|
||||
|
||||
/**
|
||||
* @return The age of the item in ticks.
|
||||
*/
|
||||
long getAge();
|
||||
|
||||
/**
|
||||
* Sets the age of the item.
|
||||
*
|
||||
* @param age the new age (−32767 indicates infinite age).
|
||||
*/
|
||||
void setAge(long age);
|
||||
|
||||
/**
|
||||
* @return The lifespan threshold; when the age reaches this, the item despawns.
|
||||
*/
|
||||
int getLifeSpawn();
|
||||
|
||||
/**
|
||||
* Sets the age threshold at which the item will despawn.
|
||||
*
|
||||
* @param age the lifespan in ticks.
|
||||
*/
|
||||
void setLifeSpawn(int age);
|
||||
|
||||
/**
|
||||
* @return The item contained in this entity.
|
||||
*/
|
||||
IItemStack getItem();
|
||||
|
||||
/**
|
||||
* Sets the item contained in this entity.
|
||||
*
|
||||
* @param item the item to set.
|
||||
*/
|
||||
void setItem(IItemStack item);
|
||||
}
|
||||
@@ -1,54 +1,152 @@
|
||||
package noppes.npcs.api.entity;
|
||||
|
||||
/**
|
||||
* Platform-api version (MC-free). The src/api shadow adds generic type parameter.
|
||||
* All methods are clean — no MC types needed.
|
||||
* Represents a living entity (mob, NPC, etc.) that extends the base living functionality.
|
||||
* Provides additional methods for navigation, sound, custom name, leashing, and more.
|
||||
*/
|
||||
public interface IEntityLiving extends IEntityLivingBase {
|
||||
|
||||
/**
|
||||
* Checks if the entity is currently navigating (pathfinding).
|
||||
*
|
||||
* @return true if navigating; false otherwise.
|
||||
*/
|
||||
boolean isNavigating();
|
||||
|
||||
/**
|
||||
* Clears the current navigation path.
|
||||
*/
|
||||
void clearNavigation();
|
||||
|
||||
/**
|
||||
* Commands the entity to navigate toward the specified destination.
|
||||
*
|
||||
* @param x Destination x coordinate.
|
||||
* @param y Destination y coordinate.
|
||||
* @param z Destination z coordinate.
|
||||
* @param speed Movement speed (0.7 is default).
|
||||
*/
|
||||
void navigateTo(double x, double y, double z, double speed);
|
||||
|
||||
/**
|
||||
* Returns the underlying Minecraft entity.
|
||||
*
|
||||
* @return the Minecraft entity.
|
||||
*/
|
||||
Object getMCEntity();
|
||||
|
||||
/**
|
||||
* Plays the entity's living sound.
|
||||
*/
|
||||
void playLivingSound();
|
||||
|
||||
/**
|
||||
* Spawns explosion particles for this entity.
|
||||
*/
|
||||
void spawnExplosionParticle();
|
||||
|
||||
/**
|
||||
* Sets the forward movement speed for the entity.
|
||||
*
|
||||
* @param speed the forward speed.
|
||||
*/
|
||||
void setMoveForward(float speed);
|
||||
|
||||
/**
|
||||
* Rotates the entity to face the given entity.
|
||||
*
|
||||
* @param entity the target entity.
|
||||
* @param pitch the pitch angle.
|
||||
* @param yaw the yaw angle.
|
||||
*/
|
||||
void faceEntity(IEntity entity, float pitch, float yaw);
|
||||
|
||||
/**
|
||||
* @return Whether the entity can pick up loot.
|
||||
*/
|
||||
boolean canPickUpLoot();
|
||||
|
||||
/**
|
||||
* Sets whether the entity can pick up loot.
|
||||
*
|
||||
* @param pickUp true to allow picking up loot.
|
||||
*/
|
||||
void setCanPickUpLoot(boolean pickUp);
|
||||
|
||||
/**
|
||||
* @return Whether the entity is persistent (won't despawn).
|
||||
*/
|
||||
boolean isPersistent();
|
||||
|
||||
/**
|
||||
* Enables persistence so that the entity does not despawn.
|
||||
*/
|
||||
void enablePersistence();
|
||||
|
||||
/**
|
||||
* Sets a custom name tag for the entity.
|
||||
*
|
||||
* @param text the custom name.
|
||||
*/
|
||||
void setCustomNameTag(String text);
|
||||
|
||||
/**
|
||||
* Returns the entity's custom name tag.
|
||||
*
|
||||
* @return the custom name.
|
||||
*/
|
||||
String getCustomNameTag();
|
||||
|
||||
/**
|
||||
* @return Whether the entity has a custom name tag.
|
||||
*/
|
||||
boolean hasCustomNameTag();
|
||||
|
||||
/**
|
||||
* Sets whether the entity's name tag is always rendered.
|
||||
*
|
||||
* @param alwaysRender true to always render the name tag.
|
||||
*/
|
||||
void setAlwaysRenderNameTag(boolean alwaysRender);
|
||||
|
||||
/**
|
||||
* @return Whether the name tag is always rendered.
|
||||
*/
|
||||
boolean getAlwaysRenderNameTag();
|
||||
|
||||
/**
|
||||
* Clears the entity's leash.
|
||||
*
|
||||
* @param sendPacket whether to send a packet update.
|
||||
* @param dropLeash whether to drop the leash item.
|
||||
*/
|
||||
void clearLeashed(boolean sendPacket, boolean dropLeash);
|
||||
|
||||
/**
|
||||
* @return Whether the entity allows leashing.
|
||||
*/
|
||||
boolean allowLeashing();
|
||||
|
||||
/**
|
||||
* @return Whether the entity is currently leashed.
|
||||
*/
|
||||
boolean getLeashed();
|
||||
|
||||
/**
|
||||
* @return The entity to which this entity is leashed.
|
||||
*/
|
||||
IEntity getLeashedTo();
|
||||
|
||||
/**
|
||||
* Leashes this entity to the specified entity.
|
||||
*
|
||||
* @param entity the entity to leash to.
|
||||
* @param sendPacket whether to send a packet update.
|
||||
*/
|
||||
void setLeashedTo(IEntity entity, boolean sendPacket);
|
||||
|
||||
/**
|
||||
* @return Whether the entity can be steered.
|
||||
*/
|
||||
boolean canBeSteered();
|
||||
}
|
||||
@@ -1,130 +1,487 @@
|
||||
package noppes.npcs.api.entity;
|
||||
|
||||
import noppes.npcs.api.IBlock;
|
||||
import noppes.npcs.api.IDamageSource;
|
||||
import noppes.npcs.api.IPos;
|
||||
import noppes.npcs.api.item.IItemStack;
|
||||
|
||||
/**
|
||||
* Platform-api version (MC-free). The src/api shadow adds generic type parameter
|
||||
* and IBlock-dependent methods.
|
||||
* Represents a living entity (mob, NPC, etc.) with additional methods to manage health,
|
||||
* damage, targeting, vision, potion effects, equipment, and various attributes.
|
||||
* <p>
|
||||
* This interface extends {@link IEntity} and provides functionality specific to living entities.
|
||||
*/
|
||||
public interface IEntityLivingBase extends IEntity {
|
||||
|
||||
/**
|
||||
* Returns the entity's current health.
|
||||
*
|
||||
* @return the health value.
|
||||
*/
|
||||
float getHealth();
|
||||
|
||||
/**
|
||||
* Sets the entity's health to the specified value.
|
||||
*
|
||||
* @param health the new health value.
|
||||
*/
|
||||
void setHealth(float health);
|
||||
|
||||
/**
|
||||
* Applies damage to this entity using a generic damage source.
|
||||
*
|
||||
* @param damage the damage amount.
|
||||
*/
|
||||
void hurt(float damage);
|
||||
|
||||
/**
|
||||
* Applies damage to this entity with the given source entity.
|
||||
*
|
||||
* @param damage the damage amount.
|
||||
* @param source the source entity.
|
||||
*/
|
||||
void hurt(float damage, IEntity source);
|
||||
|
||||
/**
|
||||
* Applies damage to this entity using a custom damage source.
|
||||
*
|
||||
* @param damage the damage amount.
|
||||
* @param damageSource the damage source.
|
||||
*/
|
||||
void hurt(float damage, IDamageSource damageSource);
|
||||
|
||||
/**
|
||||
* Sets the maximum hurt time (hurt resistance time) for this entity.
|
||||
*
|
||||
* @param time the time in ticks.
|
||||
*/
|
||||
void setMaxHurtTime(int time);
|
||||
|
||||
/**
|
||||
* Returns the maximum hurt time (hurt resistance time) for this entity.
|
||||
*
|
||||
* @return the time in ticks.
|
||||
*/
|
||||
int getMaxHurtTime();
|
||||
|
||||
/**
|
||||
* Returns the entity's maximum health.
|
||||
*
|
||||
* @return the maximum health.
|
||||
*/
|
||||
double getMaxHealth();
|
||||
|
||||
/**
|
||||
* Returns the follow range attribute of the entity.
|
||||
*
|
||||
* @return the follow range.
|
||||
*/
|
||||
double getFollowRange();
|
||||
|
||||
/**
|
||||
* Returns the knockback resistance of the entity.
|
||||
*
|
||||
* @return the knockback resistance.
|
||||
*/
|
||||
double getKnockbackResistance();
|
||||
|
||||
/**
|
||||
* Returns the movement speed of the entity.
|
||||
*
|
||||
* @return the speed.
|
||||
*/
|
||||
double getSpeed();
|
||||
|
||||
/**
|
||||
* Returns the melee strength (attack damage) of the entity.
|
||||
*
|
||||
* @return the melee strength.
|
||||
*/
|
||||
double getMeleeStrength();
|
||||
|
||||
/**
|
||||
* Sets the entity's maximum health.
|
||||
*
|
||||
* @param health the new maximum health.
|
||||
*/
|
||||
void setMaxHealth(double health);
|
||||
|
||||
/**
|
||||
* Sets the follow range of the entity.
|
||||
*
|
||||
* @param range the new follow range.
|
||||
*/
|
||||
void setFollowRange(double range);
|
||||
|
||||
/**
|
||||
* Sets the knockback resistance of the entity.
|
||||
*
|
||||
* @param knockbackResistance the new knockback resistance.
|
||||
*/
|
||||
void setKnockbackResistance(double knockbackResistance);
|
||||
|
||||
/**
|
||||
* Sets the movement speed of the entity.
|
||||
*
|
||||
* @param speed the new movement speed.
|
||||
*/
|
||||
void setSpeed(double speed);
|
||||
|
||||
/**
|
||||
* Sets the melee strength (attack damage) of the entity.
|
||||
*
|
||||
* @param attackDamage the new attack damage.
|
||||
*/
|
||||
void setMeleeStrength(double attackDamage);
|
||||
|
||||
/**
|
||||
* @return true if this entity is currently attacking a target; false otherwise.
|
||||
*/
|
||||
boolean isAttacking();
|
||||
|
||||
/**
|
||||
* Sets the attack target for this entity.
|
||||
*
|
||||
* @param living the target entity.
|
||||
*/
|
||||
void setAttackTarget(IEntityLivingBase living);
|
||||
|
||||
/**
|
||||
* Returns the current attack target.
|
||||
*
|
||||
* @return the target entity.
|
||||
*/
|
||||
IEntityLivingBase getAttackTarget();
|
||||
|
||||
/**
|
||||
* Returns the time (in ticks) for which the current attack target has been active.
|
||||
*
|
||||
* @return the attack target time.
|
||||
*/
|
||||
int getAttackTargetTime();
|
||||
|
||||
void setLastAttacker(IEntity entity);
|
||||
/**
|
||||
* Sets the last attacker for this entity.
|
||||
*
|
||||
* @param p_130011_1_ the last attacker.
|
||||
*/
|
||||
void setLastAttacker(IEntity p_130011_1_);
|
||||
|
||||
/**
|
||||
* Returns the last attacker of this entity.
|
||||
*
|
||||
* @return the last attacker.
|
||||
*/
|
||||
IEntity getLastAttacker();
|
||||
|
||||
/**
|
||||
* Returns the time (in ticks) since the entity was last attacked.
|
||||
*
|
||||
* @return the last attacker time.
|
||||
*/
|
||||
int getLastAttackerTime();
|
||||
|
||||
/**
|
||||
* Checks whether the entity can breathe underwater.
|
||||
*
|
||||
* @return true if it can breathe underwater; false otherwise.
|
||||
*/
|
||||
boolean canBreatheUnderwater();
|
||||
|
||||
/**
|
||||
* Returns the EntityType (as defined in scripting constants) for this entity.
|
||||
*
|
||||
* @return the entity type.
|
||||
*/
|
||||
int getType();
|
||||
|
||||
/**
|
||||
* Checks if this entity is of the specified type.
|
||||
*
|
||||
* @param type the type to check.
|
||||
* @return true if this entity is of that type; false otherwise.
|
||||
*/
|
||||
boolean typeOf(int type);
|
||||
|
||||
/**
|
||||
* Returns the look vector of this entity as an IPos object.
|
||||
*
|
||||
* @return the look vector.
|
||||
*/
|
||||
IPos getLookVector();
|
||||
|
||||
// Note: getLookingAtBlock methods omitted — require IBlock (not in platform-api)
|
||||
/**
|
||||
* Returns the block that the entity is looking at, with detailed stopping conditions.
|
||||
*
|
||||
* @param maxDistance the maximum distance to check.
|
||||
* @param stopOnBlock whether to stop on any block.
|
||||
* @param stopOnLiquid whether to stop on liquids.
|
||||
* @param stopOnCollision whether to stop on collisions.
|
||||
* @return the block being looked at.
|
||||
*/
|
||||
IBlock getLookingAtBlock(int maxDistance, boolean stopOnBlock, boolean stopOnLiquid, boolean stopOnCollision);
|
||||
|
||||
/**
|
||||
* Returns the first block found by following the entity's look vector,
|
||||
* using default parameters (stop on block).
|
||||
*
|
||||
* @param maxDistance the maximum distance to check.
|
||||
* @return the block being looked at.
|
||||
*/
|
||||
IBlock getLookingAtBlock(int maxDistance);
|
||||
|
||||
/**
|
||||
* Returns the position (IPos) corresponding to the final obstructed point along the entity's look vector,
|
||||
* with detailed stopping conditions.
|
||||
*
|
||||
* @param maxDistance the maximum distance to check.
|
||||
* @param stopOnBlock whether to stop on blocks.
|
||||
* @param stopOnLiquid whether to stop on liquids.
|
||||
* @param stopOnCollision whether to stop on collisions.
|
||||
* @return the obstructed position, or the final position if unobstructed.
|
||||
*/
|
||||
IPos getLookingAtPos(int maxDistance, boolean stopOnBlock, boolean stopOnLiquid, boolean stopOnCollision);
|
||||
|
||||
/**
|
||||
* Returns the position (IPos) corresponding to the final obstructed point along the entity's look vector,
|
||||
* using default parameters (stop on block).
|
||||
*
|
||||
* @param maxDistance the maximum distance to check.
|
||||
* @return the position being looked at.
|
||||
*/
|
||||
IPos getLookingAtPos(int maxDistance);
|
||||
|
||||
/**
|
||||
* Returns an array of entities intersecting with the entity's look vector.
|
||||
* Entities are sorted first by proximity along the vector, then by closeness to the vector.
|
||||
*
|
||||
* @param ignoreEntities an array of entities to ignore.
|
||||
* @param maxDistance the maximum distance to check.
|
||||
* @param offset the offset along the vector.
|
||||
* @param range the search radius around the vector.
|
||||
* @param stopOnBlock whether to stop on blocks.
|
||||
* @param stopOnLiquid whether to stop on liquids.
|
||||
* @param stopOnCollision whether to stop on collisions.
|
||||
* @return an array of entities.
|
||||
*/
|
||||
IEntity[] getLookingAtEntities(IEntity[] ignoreEntities, int maxDistance, double offset, double range, boolean stopOnBlock, boolean stopOnLiquid, boolean stopOnCollision);
|
||||
|
||||
/**
|
||||
* Returns an array of entities intersecting with the entity's look vector with detailed stop conditions.
|
||||
*
|
||||
* @param maxDistance the maximum distance.
|
||||
* @param offset the offset.
|
||||
* @param range the search radius.
|
||||
* @param stopOnBlock whether to stop on blocks.
|
||||
* @param stopOnLiquid whether to stop on liquids.
|
||||
* @param stopOnCollision whether to stop on collisions.
|
||||
* @return an array of entities.
|
||||
*/
|
||||
IEntity[] getLookingAtEntities(int maxDistance, double offset, double range, boolean stopOnBlock, boolean stopOnLiquid, boolean stopOnCollision);
|
||||
|
||||
/**
|
||||
* Returns an array of entities intersecting with the entity's look vector using default stop conditions.
|
||||
*
|
||||
* @param maxDistance the maximum distance.
|
||||
* @param offset the offset.
|
||||
* @param range the search radius.
|
||||
* @return an array of entities.
|
||||
*/
|
||||
IEntity[] getLookingAtEntities(int maxDistance, double offset, double range);
|
||||
|
||||
/**
|
||||
* Expert use only.
|
||||
* Returns the underlying Minecraft EntityLivingBase object.
|
||||
*
|
||||
* @return the Minecraft entity.
|
||||
*/
|
||||
Object getMCEntity();
|
||||
|
||||
/**
|
||||
* Makes the entity swing its hand.
|
||||
*/
|
||||
void swingHand();
|
||||
|
||||
/**
|
||||
* Applies a potion effect to the entity.
|
||||
* Works similarly to the /effect command.
|
||||
*
|
||||
* @param effect the potion effect ID.
|
||||
* @param duration the duration in seconds.
|
||||
* @param strength the amplifier of the effect.
|
||||
* @param hideParticles whether to hide potion particles.
|
||||
*/
|
||||
void addPotionEffect(int effect, int duration, int strength, boolean hideParticles);
|
||||
|
||||
/**
|
||||
* Clears all active potion effects from the entity.
|
||||
*/
|
||||
void clearPotionEffects();
|
||||
|
||||
/**
|
||||
* Returns the amplifier of the specified potion effect.
|
||||
* If the effect is not active, returns -1.
|
||||
*
|
||||
* @param effect the potion effect ID.
|
||||
* @return the amplifier, or -1 if not active.
|
||||
*/
|
||||
int getPotionEffect(int effect);
|
||||
|
||||
/**
|
||||
* Returns the item the entity is currently holding.
|
||||
* Note that not all living entities support this.
|
||||
*
|
||||
* @return the held item.
|
||||
*/
|
||||
IItemStack getHeldItem();
|
||||
|
||||
/**
|
||||
* Sets the item the entity is holding.
|
||||
* Note that not all living entities support this.
|
||||
*
|
||||
* @param item the item to set.
|
||||
*/
|
||||
void setHeldItem(IItemStack item);
|
||||
|
||||
/**
|
||||
* Returns the armor piece in the given slot.
|
||||
* Slots: 0 - boots, 1 - pants, 2 - body, 3 - head.
|
||||
*
|
||||
* @param slot the armor slot.
|
||||
* @return the armor item.
|
||||
*/
|
||||
IItemStack getArmor(int slot);
|
||||
|
||||
/**
|
||||
* Sets the armor piece in the given slot.
|
||||
* Slots: 0 - boots, 1 - pants, 2 - body, 3 - head.
|
||||
*
|
||||
* @param slot the armor slot.
|
||||
* @param item the item to set.
|
||||
*/
|
||||
void setArmor(int slot, IItemStack item);
|
||||
|
||||
/**
|
||||
* @return true if this entity is a child.
|
||||
*/
|
||||
boolean isChild();
|
||||
|
||||
/**
|
||||
* Renders a broken item stack effect for the given item.
|
||||
*
|
||||
* @param itemStack the item stack.
|
||||
*/
|
||||
void renderBrokenItemStack(IItemStack itemStack);
|
||||
|
||||
/**
|
||||
* @return true if the entity is on a ladder.
|
||||
*/
|
||||
boolean isOnLadder();
|
||||
|
||||
/**
|
||||
* Returns the total armor value of the entity.
|
||||
*
|
||||
* @return the armor value.
|
||||
*/
|
||||
int getTotalArmorValue();
|
||||
|
||||
/**
|
||||
* Returns the number of arrows currently embedded in the entity.
|
||||
*
|
||||
* @return the arrow count.
|
||||
*/
|
||||
int getArrowCountInEntity();
|
||||
|
||||
/**
|
||||
* Sets the number of arrows embedded in the entity.
|
||||
*
|
||||
* @param count the new arrow count.
|
||||
*/
|
||||
void setArrowCountInEntity(int count);
|
||||
|
||||
/**
|
||||
* Dismounts the specified entity from this entity.
|
||||
*
|
||||
* @param entity the entity to dismount.
|
||||
*/
|
||||
void dismountEntity(IEntity entity);
|
||||
|
||||
/**
|
||||
* Sets the AI move speed for the entity.
|
||||
*
|
||||
* @param speed the speed value.
|
||||
*/
|
||||
void setAIMoveSpeed(float speed);
|
||||
|
||||
/**
|
||||
* Returns the AI move speed of the entity.
|
||||
*
|
||||
* @return the speed.
|
||||
*/
|
||||
float getAIMoveSpeed();
|
||||
|
||||
/**
|
||||
* Sets the absorption (extra health) amount.
|
||||
*
|
||||
* @param amount the absorption amount.
|
||||
*/
|
||||
void setAbsorptionAmount(float amount);
|
||||
|
||||
/**
|
||||
* Returns the absorption (extra health) amount.
|
||||
*
|
||||
* @return the absorption amount.
|
||||
*/
|
||||
float getAbsorptionAmount();
|
||||
|
||||
/**
|
||||
* 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);
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package noppes.npcs.api.entity;
|
||||
|
||||
|
||||
/**
|
||||
* Represents a fish hook entity with additional methods.
|
||||
*
|
||||
*/
|
||||
public interface IFishHook extends IEntity {
|
||||
|
||||
/**
|
||||
* 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();
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package noppes.npcs.api.entity;
|
||||
|
||||
|
||||
/**
|
||||
* Represents a monster entity.
|
||||
* This interface does not add new methods, but allows type checking
|
||||
* against the EntityType.MONSTER.
|
||||
*
|
||||
*/
|
||||
public interface IMonster extends IEntityLiving {
|
||||
}
|
||||
@@ -0,0 +1,165 @@
|
||||
package noppes.npcs.api.entity;
|
||||
|
||||
|
||||
/**
|
||||
* Represents a Pixelmon (a tameable creature) with additional attributes
|
||||
* such as shiny state, level, IV/EV values, nature, moves, and more.
|
||||
*
|
||||
*/
|
||||
public interface IPixelmon extends IAnimal {
|
||||
|
||||
/**
|
||||
* @return true if the Pixelmon is shiny.
|
||||
*/
|
||||
boolean getIsShiny();
|
||||
|
||||
/**
|
||||
* Sets whether the Pixelmon is shiny.
|
||||
*
|
||||
* @param bo true for shiny.
|
||||
*/
|
||||
void setIsShiny(boolean bo);
|
||||
|
||||
/**
|
||||
* @return The Pixelmon's level.
|
||||
*/
|
||||
int getLevel();
|
||||
|
||||
/**
|
||||
* Sets the Pixelmon's level.
|
||||
*
|
||||
* @param level the new level.
|
||||
*/
|
||||
void setLevel(int level);
|
||||
|
||||
/**
|
||||
* Gets the Individual Value (IV) for the specified stat.
|
||||
*
|
||||
* @param type 0: HP, 1: Attack, 2: Defense, 3: SpAttack, 4: SpDefense, 5: Speed
|
||||
* @return the IV value, or -1 if invalid.
|
||||
*/
|
||||
int getIV(int type);
|
||||
|
||||
/**
|
||||
* Sets the Individual Value (IV) for the specified stat.
|
||||
*
|
||||
* @param type 0: HP, 1: Attack, 2: Defense, 3: SpAttack, 4: SpDefense, 5: Speed
|
||||
* @param value the new IV value.
|
||||
*/
|
||||
void setIV(int type, int value);
|
||||
|
||||
/**
|
||||
* Gets the Effort Value (EV) for the specified stat.
|
||||
*
|
||||
* @param type 0: HP, 1: Attack, 2: Defense, 3: SpAttack, 4: SpDefense, 5: Speed
|
||||
* @return the EV value, or -1 if invalid.
|
||||
*/
|
||||
int getEV(int type);
|
||||
|
||||
/**
|
||||
* Sets the Effort Value (EV) for the specified stat.
|
||||
*
|
||||
* @param type 0: HP, 1: Attack, 2: Defense, 3: SpAttack, 4: SpDefense, 5: Speed
|
||||
* @param value the new EV value.
|
||||
*/
|
||||
void setEV(int type, int value);
|
||||
|
||||
/**
|
||||
* Gets the calculated stat for the specified stat type.
|
||||
*
|
||||
* @param type 0: HP, 1: Attack, 2: Defense, 3: SpAttack, 4: SpDefense, 5: Speed
|
||||
* @return the stat value, or -1 if invalid.
|
||||
*/
|
||||
int getStat(int type);
|
||||
|
||||
/**
|
||||
* Sets the calculated stat for the specified stat type.
|
||||
*
|
||||
* @param type 0: HP, 1: Attack, 2: Defense, 3: SpAttack, 4: SpDefense, 5: Speed
|
||||
* @param value the new stat value.
|
||||
*/
|
||||
void setStat(int type, int value);
|
||||
|
||||
/**
|
||||
* @return The Pixelmon's size type (0: Pygmy, 1: Runt, 2: Small, 3: Normal, 4: Huge, 5: Giant,
|
||||
* 6: Enormous, 7: Ginormous, 8: Microscopic).
|
||||
*/
|
||||
int getSize();
|
||||
|
||||
/**
|
||||
* Sets the Pixelmon's size type.
|
||||
*
|
||||
* @param type the size type.
|
||||
*/
|
||||
void setSize(int type);
|
||||
|
||||
/**
|
||||
* @return The Pixelmon's happiness (0-255).
|
||||
*/
|
||||
int getHapiness();
|
||||
|
||||
/**
|
||||
* Sets the Pixelmon's happiness.
|
||||
*
|
||||
* @param value a value between 0 and 255.
|
||||
*/
|
||||
void setHapiness(int value);
|
||||
|
||||
/**
|
||||
* @return The Pixelmon's nature as an integer (see nature definitions).
|
||||
*/
|
||||
int getNature();
|
||||
|
||||
/**
|
||||
* Sets the Pixelmon's nature.
|
||||
*
|
||||
* @param type the nature value.
|
||||
*/
|
||||
void setNature(int type);
|
||||
|
||||
/**
|
||||
* @return The type of Poké Ball in which the Pixelmon is contained
|
||||
* (-1: Uncaught, 0: Pokéball, 1: Great Ball, etc.).
|
||||
*/
|
||||
int getPokeball();
|
||||
|
||||
/**
|
||||
* Sets the type of Poké Ball for this Pixelmon.
|
||||
*
|
||||
* @param type -1 for Uncaught, 0 for Pokéball, etc.
|
||||
*/
|
||||
void setPokeball(int type);
|
||||
|
||||
/**
|
||||
* @return The Pixelmon's nickname.
|
||||
*/
|
||||
String getNickname();
|
||||
|
||||
/**
|
||||
* @return true if the Pixelmon has a nickname.
|
||||
*/
|
||||
boolean hasNickname();
|
||||
|
||||
/**
|
||||
* Sets the Pixelmon's nickname.
|
||||
*
|
||||
* @param name the new nickname.
|
||||
*/
|
||||
void setNickname(String name);
|
||||
|
||||
/**
|
||||
* Returns the name of the move in the specified slot.
|
||||
*
|
||||
* @param slot the move slot.
|
||||
* @return the move name.
|
||||
*/
|
||||
String getMove(int slot);
|
||||
|
||||
/**
|
||||
* Sets the move in the specified slot.
|
||||
*
|
||||
* @param slot the move slot.
|
||||
* @param move the move name.
|
||||
*/
|
||||
void setMove(int slot, String move);
|
||||
}
|
||||
@@ -1,187 +1,754 @@
|
||||
package noppes.npcs.api.entity;
|
||||
|
||||
import noppes.npcs.api.IPos;
|
||||
import noppes.npcs.api.IWorld;
|
||||
import noppes.npcs.api.handler.data.IAnimationData;
|
||||
import noppes.npcs.api.handler.data.IMagicData;
|
||||
import noppes.npcs.api.*;
|
||||
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.item.IItemStack;
|
||||
import noppes.npcs.api.overlay.ICustomOverlay;
|
||||
|
||||
/**
|
||||
* Platform-api version (MC-free). The src/api shadow adds generic type parameter
|
||||
* and methods requiring MC-only types (IBlock, IContainer, ICustomGui, ISound,
|
||||
* IDialog, IQuest, ITimers, IPlayerData, etc.).
|
||||
* Represents a player in the game with methods for managing dialogs, quests,
|
||||
* inventory, sound, and more.
|
||||
*/
|
||||
public interface IPlayer extends IEntityLivingBase, IAnimatable {
|
||||
|
||||
/**
|
||||
* @return Returns the displayed name of the player
|
||||
*/
|
||||
String getDisplayName();
|
||||
|
||||
/**
|
||||
* @return Returns the player's name
|
||||
*/
|
||||
String getName();
|
||||
|
||||
/**
|
||||
* Kicks the player from the server with the specified reason.
|
||||
*
|
||||
* @param reason The reason for kicking the player.
|
||||
*/
|
||||
void kick(String reason);
|
||||
|
||||
/**
|
||||
* Teleports the player to the specified coordinates in the current dimension.
|
||||
*
|
||||
* @param x The x-coordinate.
|
||||
* @param y The y-coordinate.
|
||||
* @param z The z-coordinate.
|
||||
*/
|
||||
void setPosition(double x, double y, double z);
|
||||
|
||||
/**
|
||||
* Teleports the player to the coordinates specified by the given position.
|
||||
*
|
||||
* @param pos The position object containing coordinates.
|
||||
*/
|
||||
void setPosition(IPos pos);
|
||||
|
||||
/**
|
||||
* Teleports the player to the specified coordinates in the given dimension.
|
||||
*
|
||||
* @param x The x-coordinate.
|
||||
* @param y The y-coordinate.
|
||||
* @param z The z-coordinate.
|
||||
* @param dimensionId The dimension ID.
|
||||
*/
|
||||
void setPosition(double x, double y, double z, int dimensionId);
|
||||
|
||||
/**
|
||||
* Teleports the player to the position in the specified dimension.
|
||||
*
|
||||
* @param pos The position object containing coordinates.
|
||||
* @param dimensionId The dimension ID.
|
||||
*/
|
||||
void setPosition(IPos pos, int dimensionId);
|
||||
|
||||
/**
|
||||
* Teleports the player to the specified coordinates in the dimension of the provided world.
|
||||
*
|
||||
* @param x The x-coordinate.
|
||||
* @param y The y-coordinate.
|
||||
* @param z The z-coordinate.
|
||||
* @param world The world whose dimension will be used.
|
||||
*/
|
||||
void setPosition(double x, double y, double z, IWorld world);
|
||||
|
||||
/**
|
||||
* Teleports the player to the position specified by the given position in the dimension of the provided world.
|
||||
*
|
||||
* @param pos The position object containing coordinates.
|
||||
* @param world The world whose dimension will be used.
|
||||
*/
|
||||
void setPosition(IPos pos, IWorld world);
|
||||
|
||||
/**
|
||||
* Changes the player's dimension by teleporting them to their current position in the specified dimension.
|
||||
*
|
||||
* @param dimension The dimension ID to move the player to.
|
||||
*/
|
||||
void setDimension(int dimension);
|
||||
|
||||
/**
|
||||
* @return Returns the player's current hunger level.
|
||||
*/
|
||||
int getHunger();
|
||||
|
||||
/**
|
||||
* Sets the player's hunger level.
|
||||
*
|
||||
* @param hunger The new hunger level.
|
||||
*/
|
||||
void setHunger(int hunger);
|
||||
|
||||
/**
|
||||
* @return Returns the player's current saturation level.
|
||||
*/
|
||||
float getSaturation();
|
||||
|
||||
/**
|
||||
* Sets the player's saturation level.
|
||||
*
|
||||
* @param saturation The new saturation level.
|
||||
*/
|
||||
void setSaturation(float saturation);
|
||||
|
||||
// Dialog methods (int-based — IDialog-based stay in shadow)
|
||||
/**
|
||||
* Displays the specified dialog to the player.
|
||||
*
|
||||
* @param dialog The dialog to display.
|
||||
*/
|
||||
void showDialog(IDialog dialog);
|
||||
|
||||
/**
|
||||
* Checks whether the player has read the specified dialog.
|
||||
*
|
||||
* @param dialog The dialog to check.
|
||||
* @return True if the dialog has been read, false otherwise.
|
||||
*/
|
||||
boolean hasReadDialog(IDialog dialog);
|
||||
|
||||
/**
|
||||
* Marks the specified dialog as read for the player.
|
||||
*
|
||||
* @param dialog The dialog to mark as read.
|
||||
*/
|
||||
void readDialog(IDialog dialog);
|
||||
|
||||
/**
|
||||
* Marks the specified dialog as unread for the player.
|
||||
*
|
||||
* @param dialog The dialog to mark as unread.
|
||||
*/
|
||||
void unreadDialog(IDialog dialog);
|
||||
|
||||
/**
|
||||
* Displays the dialog with the specified ID to the player.
|
||||
*
|
||||
* @param id The dialog ID.
|
||||
*/
|
||||
void showDialog(int id);
|
||||
|
||||
/**
|
||||
* Checks whether the player has read the dialog with the specified ID.
|
||||
*
|
||||
* @param id The dialog ID.
|
||||
* @return True if the dialog has been read, false otherwise.
|
||||
*/
|
||||
boolean hasReadDialog(int id);
|
||||
|
||||
/**
|
||||
* Marks the dialog with the specified ID as read for the player.
|
||||
*
|
||||
* @param id The dialog ID.
|
||||
*/
|
||||
void readDialog(int id);
|
||||
|
||||
/**
|
||||
* Marks the dialog with the specified ID as unread for the player.
|
||||
*
|
||||
* @param id The dialog ID.
|
||||
*/
|
||||
void unreadDialog(int id);
|
||||
|
||||
// Quest methods (int-based — IQuest-based stay in shadow)
|
||||
/**
|
||||
* Checks whether the player has finished the specified quest.
|
||||
*
|
||||
* @param quest The quest to check.
|
||||
* @return True if the quest has been finished, false otherwise.
|
||||
*/
|
||||
boolean hasFinishedQuest(IQuest quest);
|
||||
|
||||
/**
|
||||
* Checks whether the player has an active quest matching the specified quest.
|
||||
*
|
||||
* @param quest The quest to check.
|
||||
* @return True if the quest is active, false otherwise.
|
||||
*/
|
||||
boolean hasActiveQuest(IQuest quest);
|
||||
|
||||
/**
|
||||
* Add the quest from active quest list.
|
||||
*
|
||||
* @param quest The quest.
|
||||
*/
|
||||
void startQuest(IQuest quest);
|
||||
|
||||
/**
|
||||
* Add the quest from finished quest list.
|
||||
*
|
||||
* @param quest The quest.
|
||||
*/
|
||||
void finishQuest(IQuest quest);
|
||||
|
||||
/**
|
||||
* Removes the quest from active quest list.
|
||||
*
|
||||
* @param quest The quest.
|
||||
*/
|
||||
void stopQuest(IQuest quest);
|
||||
|
||||
/**
|
||||
* Removes the quest from active and finished quest list.
|
||||
*
|
||||
* @param quest The quest.
|
||||
*/
|
||||
void removeQuest(IQuest quest);
|
||||
|
||||
/**
|
||||
* Checks whether the player has finished the quest with the given ID.
|
||||
*
|
||||
* @param id The quest ID.
|
||||
* @return True if the quest has been finished, false otherwise.
|
||||
*/
|
||||
boolean hasFinishedQuest(int id);
|
||||
|
||||
/**
|
||||
* Checks whether the player has an active quest with the given ID.
|
||||
*
|
||||
* @param id The quest ID.
|
||||
* @return True if the quest is active, false otherwise.
|
||||
*/
|
||||
boolean hasActiveQuest(int id);
|
||||
|
||||
/**
|
||||
* @param id The quest ID.
|
||||
*/
|
||||
void startQuest(int id);
|
||||
|
||||
/**
|
||||
* @param id The quest ID.
|
||||
*/
|
||||
void finishQuest(int id);
|
||||
|
||||
/**
|
||||
* @param id The quest ID.
|
||||
*/
|
||||
void stopQuest(int id);
|
||||
|
||||
/**
|
||||
* @param id The quest ID.
|
||||
*/
|
||||
void removeQuest(int id);
|
||||
|
||||
/**
|
||||
* Returns an array of quests that the player has finished.
|
||||
*
|
||||
* @return An array of finished quests.
|
||||
*/
|
||||
IQuest[] getFinishedQuests();
|
||||
|
||||
/**
|
||||
* Returns the entity type identifier for the player.
|
||||
*
|
||||
* @return The type as an integer.
|
||||
*/
|
||||
int getType();
|
||||
|
||||
/**
|
||||
* Checks if the player is of the specified entity type.
|
||||
*
|
||||
* @param type The entity type to check.
|
||||
* @return True if the player is of the specified type, false otherwise.
|
||||
*/
|
||||
boolean typeOf(int type);
|
||||
|
||||
/**
|
||||
* @param faction The faction id.
|
||||
* @param points The points to increase. Use negative values to decrease.
|
||||
*/
|
||||
void addFactionPoints(int faction, int points);
|
||||
|
||||
/**
|
||||
* @param faction The faction id.
|
||||
* @param points The new point value for this faction.
|
||||
*/
|
||||
void setFactionPoints(int faction, int points);
|
||||
|
||||
/**
|
||||
* @param faction The faction id.
|
||||
* @return The current point total for the faction.
|
||||
*/
|
||||
int getFactionPoints(int faction);
|
||||
|
||||
/**
|
||||
* Sends a chat message to the player.
|
||||
*
|
||||
* @param message The message you want to send. Compatible with formatting codes.
|
||||
* @see <a href="https://static.wikia.nocookie.net/minecraft_gamepedia/images/7/7e/Minecraft_Formatting.gif/revision/latest/scale-to-width-down/200?cb=20200828001454">Minecraft formatting codes</a>
|
||||
*/
|
||||
void sendMessage(String message);
|
||||
|
||||
/**
|
||||
* @return Returns gamemode. 0: Survival, 1: Creative, 2: Adventure.
|
||||
*/
|
||||
int getMode();
|
||||
|
||||
/**
|
||||
* @param type The gamemode type. 0:SURVIVAL, 1:CREATIVE, 2:ADVENTURE.
|
||||
*/
|
||||
void setMode(int type);
|
||||
|
||||
/**
|
||||
* @return Returns an IItemStack array of size 36 representing the player's inventory.
|
||||
* @since 1.7.10d
|
||||
*/
|
||||
IItemStack[] getInventory();
|
||||
|
||||
/**
|
||||
* @param item The item to be checked.
|
||||
* @param ignoreNBT Whether the item's NBT tags will be checked for equality.
|
||||
* @param ignoreDamage Whether the item's damage will be checked for equality.
|
||||
* @return The total count of the specified item in the player's inventory.
|
||||
*/
|
||||
int inventoryItemCount(IItemStack item, boolean ignoreNBT, boolean ignoreDamage);
|
||||
|
||||
/**
|
||||
* @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);
|
||||
|
||||
/**
|
||||
* @param item The item type to be removed.
|
||||
* @param amount The number of items to remove.
|
||||
* @param ignoreNBT Whether the item's NBT tags will be checked for equality.
|
||||
* @param ignoreDamage Whether the item's damage will be checked for equality.
|
||||
* @return True if the items were removed successfully, false if the removal amount exceeds the player's count.
|
||||
*/
|
||||
boolean removeItem(IItemStack item, int amount, boolean ignoreNBT, boolean ignoreDamage);
|
||||
|
||||
/**
|
||||
* @param item The item to be removed from the player's inventory.
|
||||
* @param ignoreNBT Whether the item's NBT tags will be checked for equality.
|
||||
* @param ignoreDamage Whether the item's damage will be checked for equality.
|
||||
* @return The number of item stacks that were removed.
|
||||
*/
|
||||
int removeAllItems(IItemStack item, boolean ignoreNBT, boolean ignoreDamage);
|
||||
|
||||
/**
|
||||
* @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);
|
||||
|
||||
/**
|
||||
* @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);
|
||||
|
||||
/**
|
||||
* Same as the /spawnpoint command.
|
||||
*
|
||||
* @param x The x-coordinate.
|
||||
* @param y The y-coordinate.
|
||||
* @param z The z-coordinate.
|
||||
*/
|
||||
void setSpawnpoint(int x, int y, int z);
|
||||
|
||||
/**
|
||||
* Sets the player's spawnpoint to the coordinates of the provided position.
|
||||
*
|
||||
* @param pos The position containing the spawn coordinates.
|
||||
*/
|
||||
void setSpawnpoint(IPos pos);
|
||||
|
||||
/**
|
||||
* Resets the player's spawnpoint to the default spawn.
|
||||
*/
|
||||
void resetSpawnpoint();
|
||||
|
||||
/**
|
||||
* Sets the player's rotation.
|
||||
*
|
||||
* @param rotationYaw The horizontal rotation (yaw).
|
||||
* @param rotationPitch The vertical rotation (pitch).
|
||||
*/
|
||||
void setRotation(float rotationYaw, float rotationPitch);
|
||||
|
||||
/**
|
||||
* Disables mouse input for the specified time and buttons for the player.
|
||||
*
|
||||
* @param time The duration for which mouse input is disabled.
|
||||
* @param buttonIds The IDs of the mouse buttons to disable.
|
||||
*/
|
||||
void disableMouseInput(long time, int... buttonIds);
|
||||
|
||||
/**
|
||||
* Stops the player from using the currently active item.
|
||||
*/
|
||||
void stopUsingItem();
|
||||
|
||||
/**
|
||||
* Clears the currently in-use item.
|
||||
*/
|
||||
void clearItemInUse();
|
||||
|
||||
/**
|
||||
* Clears the player's entire inventory, including main and armor slots.
|
||||
*/
|
||||
void clearInventory();
|
||||
|
||||
/**
|
||||
* Plays the specified sound at the given volume and pitch for the player.
|
||||
*
|
||||
* @param name The sound name.
|
||||
* @param volume The volume level.
|
||||
* @param pitch The pitch level.
|
||||
*/
|
||||
void playSound(String name, float volume, float pitch);
|
||||
|
||||
// playSound(ISound) and playSound(int, ISound) stay in shadow — ISound not in platform-api
|
||||
/**
|
||||
* Plays the specified sound with an identifier for the player.
|
||||
*
|
||||
* @param id The sound identifier.
|
||||
* @param sound The sound to play.
|
||||
*/
|
||||
void playSound(int id, ISound sound);
|
||||
|
||||
/**
|
||||
* Plays the specified sound for the player.
|
||||
*
|
||||
* @param sound The sound to play.
|
||||
*/
|
||||
void playSound(ISound sound);
|
||||
|
||||
/**
|
||||
* Stops the sound with the given identifier for the player.
|
||||
*
|
||||
* @param id The sound identifier.
|
||||
*/
|
||||
void stopSound(int id);
|
||||
|
||||
/**
|
||||
* Pauses all sounds currently playing for the player.
|
||||
*/
|
||||
void pauseSounds();
|
||||
|
||||
/**
|
||||
* Resumes paused sounds for the player.
|
||||
*/
|
||||
void continueSounds();
|
||||
|
||||
/**
|
||||
* Stops all sounds currently playing for the player.
|
||||
*/
|
||||
void stopSounds();
|
||||
|
||||
// mountEntity(Entity) stays in shadow — raw MC type
|
||||
/**
|
||||
* Mounts the specified entity onto the player.
|
||||
*
|
||||
* @param ridingEntity The entity to mount.
|
||||
*/
|
||||
void mountEntity(Object ridingEntity);
|
||||
|
||||
/**
|
||||
* Drops one item from the player's inventory.
|
||||
*
|
||||
* @param dropStack If true, drops the entire stack; otherwise, drops a single item.
|
||||
* @return The dropped item as an IEntity.
|
||||
*/
|
||||
IEntity dropOneItem(boolean dropStack);
|
||||
|
||||
// canHarvestBlock(IBlock) stays in shadow — IBlock not in platform-api
|
||||
/**
|
||||
* Checks if the player can harvest the specified block.
|
||||
*
|
||||
* @param block The block to check.
|
||||
* @return True if the player can harvest the block, false otherwise.
|
||||
*/
|
||||
boolean canHarvestBlock(IBlock block);
|
||||
|
||||
/**
|
||||
* Interacts with the specified entity.
|
||||
*
|
||||
* @param entity The entity to interact with.
|
||||
* @return True if the interaction was successful, false otherwise.
|
||||
*/
|
||||
boolean interactWith(IEntity entity);
|
||||
|
||||
/**
|
||||
* @param achievement The achievement id. For a complete list see http://minecraft.wiki/w/Achievements
|
||||
* @return Returns whether or not the player has this achievement.
|
||||
*/
|
||||
boolean hasAchievement(String achievement);
|
||||
|
||||
/**
|
||||
* @param permission Bukkit/Cauldron permission.
|
||||
* @return Returns whether or not the player has the specified permission.
|
||||
*/
|
||||
boolean hasBukkitPermission(String permission);
|
||||
|
||||
/**
|
||||
* @return Returns the player's experience level.
|
||||
* @since 1.7.10c
|
||||
*/
|
||||
int getExpLevel();
|
||||
|
||||
/**
|
||||
* @param level The new experience level to set.
|
||||
* @since 1.7.10c
|
||||
*/
|
||||
void setExpLevel(int level);
|
||||
|
||||
// getPixelmonData(), getTimers(), getDBCPlayer(), getData(),
|
||||
// getActionManager(), getAttributes(), getScreenSize(),
|
||||
// getOpenContainer(), showCustomGui(), getCustomGui(),
|
||||
// showCustomOverlay(), getOverlays()
|
||||
// all stay in shadow — types not in platform-api
|
||||
/**
|
||||
* Requires Pixelmon to be installed.
|
||||
*
|
||||
* @return Returns the player's Pixelmon data, or null if Pixelmon is not enabled.
|
||||
* @since 1.7.10d
|
||||
*/
|
||||
IPixelmonPlayerData getPixelmonData();
|
||||
|
||||
/**
|
||||
* Returns the player's timers.
|
||||
*
|
||||
* @return The timers associated with the player.
|
||||
*/
|
||||
ITimers getTimers();
|
||||
|
||||
/**
|
||||
* Updates the player's inventory on the client side.
|
||||
*/
|
||||
void updatePlayerInventory();
|
||||
|
||||
/**
|
||||
* Returns the player's DBC (database) data, if available.
|
||||
*
|
||||
* @return The DBC data, or null if not applicable.
|
||||
*/
|
||||
IDBCPlayer getDBCPlayer();
|
||||
|
||||
/**
|
||||
* Checks if the player is currently blocking.
|
||||
*
|
||||
* @return True if blocking, false otherwise.
|
||||
*/
|
||||
boolean blocking();
|
||||
|
||||
/**
|
||||
* Returns the player's associated data (quest, faction, timers, etc.).
|
||||
*
|
||||
* @return The player's data.
|
||||
*/
|
||||
IPlayerData getData();
|
||||
|
||||
/**
|
||||
* Checks if the player is flagged as a scripting developer.
|
||||
*
|
||||
* @return True if the player is a scripting developer, false otherwise.
|
||||
*/
|
||||
boolean isScriptingDev();
|
||||
|
||||
/**
|
||||
* Returns an array of quests that the player is actively undertaking.
|
||||
*
|
||||
* @return An array of active quests.
|
||||
*/
|
||||
IQuest[] getActiveQuests();
|
||||
|
||||
/**
|
||||
* Returns the container (GUI) that the player currently has open, if any.
|
||||
*
|
||||
* @return The open container, or null if none is open.
|
||||
*/
|
||||
IContainer getOpenContainer();
|
||||
|
||||
/**
|
||||
* Displays a custom GUI to the player.
|
||||
*
|
||||
* @param gui The custom GUI to show.
|
||||
*/
|
||||
void showCustomGui(ICustomGui gui);
|
||||
|
||||
/**
|
||||
* Returns the custom GUI currently open for the player.
|
||||
*
|
||||
* @return The custom GUI, or null if none is open.
|
||||
*/
|
||||
ICustomGui getCustomGui();
|
||||
|
||||
/**
|
||||
* Closes the currently open GUI for the player.
|
||||
*/
|
||||
void closeGui();
|
||||
|
||||
/**
|
||||
* Displays a custom overlay on the player's screen.
|
||||
*
|
||||
* @param overlay The custom overlay to display.
|
||||
*/
|
||||
void showCustomOverlay(ICustomOverlay overlay);
|
||||
|
||||
/**
|
||||
* Closes the custom overlay with the specified identifier.
|
||||
*
|
||||
* @param id The overlay ID.
|
||||
*/
|
||||
void closeOverlay(int id);
|
||||
|
||||
/**
|
||||
* Returns the player's overlay handler which manages custom overlays.
|
||||
*
|
||||
* @return The overlay handler.
|
||||
*/
|
||||
IOverlayHandler getOverlays();
|
||||
|
||||
/**
|
||||
* Returns the player's animation data.
|
||||
*
|
||||
* @return The animation data.
|
||||
*/
|
||||
IAnimationData getAnimationData();
|
||||
|
||||
/**
|
||||
* Sets whether the player has conquered the End dimension.
|
||||
*
|
||||
* @param conqueredEnd True if the End is conquered, false otherwise.
|
||||
*/
|
||||
void setConqueredEnd(boolean conqueredEnd);
|
||||
|
||||
/**
|
||||
* Checks whether the player has conquered the End dimension.
|
||||
*
|
||||
* @return True if the End has been conquered, false otherwise.
|
||||
*/
|
||||
boolean conqueredEnd();
|
||||
|
||||
/**
|
||||
* Returns the player's screen size information.
|
||||
*
|
||||
* @return The screen size.
|
||||
*/
|
||||
IScreenSize getScreenSize();
|
||||
|
||||
/**
|
||||
* Returns the player's magic-related data.
|
||||
*
|
||||
* @return The magic data.
|
||||
*/
|
||||
IMagicData getMagicData();
|
||||
|
||||
/**
|
||||
* Returns the player's item attribute combination
|
||||
*
|
||||
* @return Player Attributes Data
|
||||
*/
|
||||
IPlayerAttributes getAttributes();
|
||||
|
||||
/**
|
||||
*
|
||||
* @return player's ActionManager
|
||||
*/
|
||||
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();
|
||||
|
||||
Object getMCEntity();
|
||||
/**
|
||||
* Returns all active energy projectiles fired by this player.
|
||||
*
|
||||
* @return Array of active energy projectiles, empty array if none
|
||||
*/
|
||||
IEnergyProjectile[] getActiveEnergyProjectiles();
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
package noppes.npcs.api.entity;
|
||||
|
||||
import noppes.npcs.api.item.IItemStack;
|
||||
|
||||
/**
|
||||
* Represents a projectile entity.
|
||||
* Provides methods to access and modify the projectile's item, gravity, accuracy, heading,
|
||||
* and to enable scripting events.
|
||||
*/
|
||||
public interface IProjectile {
|
||||
|
||||
/**
|
||||
* Returns the item associated with the projectile (e.g. arrow, fireball).
|
||||
*
|
||||
* @return the item as an IItemStack.
|
||||
*/
|
||||
IItemStack getItem();
|
||||
|
||||
/**
|
||||
* Sets the item for the projectile.
|
||||
*
|
||||
* @param item the item to set.
|
||||
*/
|
||||
void setItem(IItemStack item);
|
||||
|
||||
/**
|
||||
* @return true if the projectile is affected by gravity; false if it flies straight.
|
||||
*/
|
||||
boolean getHasGravity();
|
||||
|
||||
/**
|
||||
* Sets whether the projectile is affected by gravity.
|
||||
*
|
||||
* @param bo true to enable gravity; false otherwise.
|
||||
*/
|
||||
void setHasGravity(boolean bo);
|
||||
|
||||
/**
|
||||
* Returns the accuracy value for the projectile.
|
||||
*
|
||||
* @return the accuracy.
|
||||
*/
|
||||
int getAccuracy();
|
||||
|
||||
/**
|
||||
* Sets the accuracy value for the projectile.
|
||||
*
|
||||
* @param accuracy the accuracy value.
|
||||
*/
|
||||
void setAccuracy(int accuracy);
|
||||
|
||||
/**
|
||||
* Sets the heading (target destination) for the projectile based on the target entity.
|
||||
* The projectile's position should already be set.
|
||||
*
|
||||
* @param entity the target entity.
|
||||
*/
|
||||
void setHeading(IEntity entity);
|
||||
|
||||
/**
|
||||
* Sets the heading for the projectile to the specified coordinates.
|
||||
* The projectile's position should already be set.
|
||||
*
|
||||
* @param x the target x coordinate.
|
||||
* @param y the target y coordinate.
|
||||
* @param z the target z coordinate.
|
||||
*/
|
||||
void setHeading(double x, double y, double z);
|
||||
|
||||
/**
|
||||
* Sets the heading using yaw and pitch values.
|
||||
*
|
||||
* @param yaw the yaw angle.
|
||||
* @param pitch the pitch angle.
|
||||
*/
|
||||
void setHeading(float yaw, float pitch);
|
||||
|
||||
/**
|
||||
* Returns the thrower (the entity that launched the projectile).
|
||||
*
|
||||
* @return the thrower as an IEntity.
|
||||
*/
|
||||
IEntity getThrower();
|
||||
|
||||
/**
|
||||
* Enables projectile events for the current scripting container.
|
||||
* Must be called during a script.
|
||||
**/
|
||||
void enableEvents();
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package noppes.npcs.api.entity;
|
||||
|
||||
|
||||
/**
|
||||
* Represents a throwable entity with additional methods.
|
||||
*
|
||||
*/
|
||||
public interface IThrowable extends IEntity {
|
||||
|
||||
/**
|
||||
* 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();
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package noppes.npcs.api.entity;
|
||||
|
||||
|
||||
/**
|
||||
* Represents a villager entity with additional trading-related methods.
|
||||
*
|
||||
*/
|
||||
public interface IVillager extends IEntityLiving {
|
||||
|
||||
/**
|
||||
* @return The profession of the villager.
|
||||
*/
|
||||
int getProfession();
|
||||
|
||||
/**
|
||||
* @return true if the villager is currently trading.
|
||||
*/
|
||||
boolean getIsTrading();
|
||||
|
||||
/**
|
||||
* Returns the customer (player) who is currently trading with the villager.
|
||||
*
|
||||
* @return the customer as an IEntityLivingBase.
|
||||
*/
|
||||
IEntityLivingBase getCustomer();
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package noppes.npcs.api.entity.data;
|
||||
|
||||
import noppes.npcs.api.handler.data.IAvailability;
|
||||
|
||||
/**
|
||||
* Represents a mark that can be applied to an entity.
|
||||
* A mark holds a type, a color, and availability conditions.
|
||||
*/
|
||||
public interface IMark {
|
||||
|
||||
/**
|
||||
* Returns the availability conditions associated with this mark.
|
||||
*
|
||||
* @return the availability.
|
||||
*/
|
||||
IAvailability getAvailability();
|
||||
|
||||
/**
|
||||
* Returns the color value of this mark.
|
||||
*
|
||||
* @return the color as an integer.
|
||||
*/
|
||||
int getColor();
|
||||
|
||||
/**
|
||||
* Sets the color value of this mark.
|
||||
*
|
||||
* @param color the new color.
|
||||
*/
|
||||
void setColor(int color);
|
||||
|
||||
/**
|
||||
* Returns the type of this mark.
|
||||
*
|
||||
* @return the mark type as an integer.
|
||||
*/
|
||||
int getType();
|
||||
|
||||
/**
|
||||
* Sets the type of this mark.
|
||||
*
|
||||
* @param type the new type.
|
||||
*/
|
||||
void setType(int type);
|
||||
|
||||
/**
|
||||
* Calling this will send the changes you've made to the clients.
|
||||
*/
|
||||
void update();
|
||||
}
|
||||
@@ -0,0 +1,163 @@
|
||||
package noppes.npcs.api.entity.data;
|
||||
|
||||
/**
|
||||
* Provides configuration data for a model including wearable settings,
|
||||
* hidden parts, rotation, and scale.
|
||||
* <p>
|
||||
* This interface allows controlling the appearance of an entity's model
|
||||
* such as headwear, bodywear, arm and leg configurations, and the ability
|
||||
* to hide parts. It also manages model rotation and scaling settings as well
|
||||
* as the association with an entity type.
|
||||
*/
|
||||
public interface IModelData {
|
||||
|
||||
/**
|
||||
* Sets the headwear configuration.
|
||||
* Valid values: 0 (hidden), 1 (2D), 2 (3D).
|
||||
*
|
||||
* @param config the headwear configuration.
|
||||
*/
|
||||
void headWear(byte config);
|
||||
|
||||
/**
|
||||
* Gets the current headwear configuration.
|
||||
*
|
||||
* @return the headwear configuration.
|
||||
*/
|
||||
byte headWear();
|
||||
|
||||
/**
|
||||
* Sets the bodywear configuration.
|
||||
* Valid values: 0 (hidden), 1 (2D), 2 (3D).
|
||||
*
|
||||
* @param config the bodywear configuration.
|
||||
*/
|
||||
void bodyWear(byte config);
|
||||
|
||||
/**
|
||||
* Gets the current bodywear configuration.
|
||||
*
|
||||
* @return the bodywear configuration.
|
||||
*/
|
||||
byte bodyWear();
|
||||
|
||||
/**
|
||||
* Sets the right arm wear configuration.
|
||||
* Valid values: 0 (hidden), 1 (2D), 2 (3D).
|
||||
*
|
||||
* @param config the right arm configuration.
|
||||
*/
|
||||
void rightArmWear(byte config);
|
||||
|
||||
/**
|
||||
* Gets the current right arm wear configuration.
|
||||
*
|
||||
* @return the right arm configuration.
|
||||
*/
|
||||
byte rightArmWear();
|
||||
|
||||
/**
|
||||
* Sets the left arm wear configuration.
|
||||
* Valid values: 0 (hidden), 1 (2D), 2 (3D).
|
||||
*
|
||||
* @param config the left arm configuration.
|
||||
*/
|
||||
void leftArmWear(byte config);
|
||||
|
||||
/**
|
||||
* Gets the current left arm wear configuration.
|
||||
*
|
||||
* @return the left arm configuration.
|
||||
*/
|
||||
byte leftArmWear();
|
||||
|
||||
/**
|
||||
* Sets the right leg wear configuration.
|
||||
* Valid values: 0 (hidden), 1 (2D), 2 (3D).
|
||||
*
|
||||
* @param config the right leg configuration.
|
||||
*/
|
||||
void rightLegWear(byte config);
|
||||
|
||||
/**
|
||||
* Gets the current right leg wear configuration.
|
||||
*
|
||||
* @return the right leg configuration.
|
||||
*/
|
||||
byte rightLegWear();
|
||||
|
||||
/**
|
||||
* Sets the left leg wear configuration.
|
||||
* Valid values: 0 (hidden), 1 (2D), 2 (3D).
|
||||
*
|
||||
* @param config the left leg configuration.
|
||||
*/
|
||||
void leftLegWear(byte config);
|
||||
|
||||
/**
|
||||
* Gets the current left leg wear configuration.
|
||||
*
|
||||
* @return the left leg configuration.
|
||||
*/
|
||||
byte leftLegWear();
|
||||
|
||||
/**
|
||||
* Hide Body Parts
|
||||
* part: [0: Head, 1: Body, 2: Arms, 3: Legs]
|
||||
* hide: [0: None, 1: Both, 2: Right, 3: Left], only values 0 and 1 used for head and body.
|
||||
*
|
||||
* @param part the part index.
|
||||
* @param hide the hide configuration.
|
||||
*/
|
||||
void hidePart(int part, byte hide);
|
||||
|
||||
/**
|
||||
* Returns the hide configuration for the specified part.
|
||||
*
|
||||
* @param part the part index.
|
||||
* @return the current hide configuration.
|
||||
*/
|
||||
int hidden(int part);
|
||||
|
||||
/**
|
||||
* Enables or disables rotation for the model.
|
||||
*
|
||||
* @param enableRotation true to enable rotation; false to disable.
|
||||
*/
|
||||
void enableRotation(boolean enableRotation);
|
||||
|
||||
/**
|
||||
* Checks whether rotation is enabled for the model.
|
||||
*
|
||||
* @return true if rotation is enabled; false otherwise.
|
||||
*/
|
||||
boolean enableRotation();
|
||||
|
||||
/**
|
||||
* Returns the model rotation configuration.
|
||||
*
|
||||
* @return the rotation settings.
|
||||
*/
|
||||
IModelRotate getRotation();
|
||||
|
||||
/**
|
||||
* Returns the model scaling configuration.
|
||||
*
|
||||
* @return the scale settings.
|
||||
*/
|
||||
IModelScale getScale();
|
||||
|
||||
/**
|
||||
* Associates this model data with an entity using its class name.
|
||||
*
|
||||
* @param string the fully qualified class name of the entity.
|
||||
*/
|
||||
void setEntity(String string);
|
||||
|
||||
/**
|
||||
* Gets the entity class name associated with this model data.
|
||||
*
|
||||
* @return the entity class name, or null if not set.
|
||||
*/
|
||||
String getEntity();
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package noppes.npcs.api.entity.data;
|
||||
|
||||
/**
|
||||
* Represents the rotation configuration for a model.
|
||||
* It controls how different parts of a model rotate under various conditions.
|
||||
*/
|
||||
public interface IModelRotate {
|
||||
|
||||
/**
|
||||
* Checks if rotation is applied while the entity is standing.
|
||||
*
|
||||
* @return true if rotation while standing is enabled; false otherwise.
|
||||
*/
|
||||
boolean whileStanding();
|
||||
|
||||
/**
|
||||
* Sets whether rotation should be applied while the entity is standing.
|
||||
*
|
||||
* @param whileStanding true to enable; false to disable.
|
||||
*/
|
||||
void whileStanding(boolean whileStanding);
|
||||
|
||||
/**
|
||||
* Checks if rotation is applied while the entity is attacking.
|
||||
*
|
||||
* @return true if rotation while attacking is enabled; false otherwise.
|
||||
*/
|
||||
boolean whileAttacking();
|
||||
|
||||
/**
|
||||
* Sets whether rotation should be applied while the entity is attacking.
|
||||
*
|
||||
* @param whileAttacking true to enable; false to disable.
|
||||
*/
|
||||
void whileAttacking(boolean whileAttacking);
|
||||
|
||||
/**
|
||||
* Checks if rotation is applied while the entity is moving.
|
||||
*
|
||||
* @return true if rotation while moving is enabled; false otherwise.
|
||||
*/
|
||||
boolean whileMoving();
|
||||
|
||||
/**
|
||||
* Sets whether rotation should be applied while the entity is moving.
|
||||
*
|
||||
* @param whileMoving true to enable; false to disable.
|
||||
*/
|
||||
void whileMoving(boolean whileMoving);
|
||||
|
||||
/**
|
||||
* Retrieves the rotation settings for a specific part of the model.
|
||||
* Parts are indexed as follows: 0 - head, 1 - body, 2 - left arm, 3 - right arm, 4 - left leg, 5 - right leg.
|
||||
*
|
||||
* @param part the index of the model part.
|
||||
* @return the rotation settings for the specified part.
|
||||
*/
|
||||
IModelRotatePart getPart(int part);
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package noppes.npcs.api.entity.data;
|
||||
|
||||
/**
|
||||
* Represents the rotation settings for a specific part of a model.
|
||||
* Allows configuring the rotation angles along the X, Y, and Z axes
|
||||
* as well as enabling/disabling the rotation.
|
||||
*/
|
||||
public interface IModelRotatePart {
|
||||
|
||||
/**
|
||||
* Sets the rotation angles for this model part.
|
||||
*
|
||||
* @param x the rotation angle around the X-axis.
|
||||
* @param y the rotation angle around the Y-axis.
|
||||
* @param z the rotation angle around the Z-axis.
|
||||
*/
|
||||
void setRotation(float x, float y, float z);
|
||||
|
||||
/**
|
||||
* Returns the rotation angle around the X-axis.
|
||||
*
|
||||
* @return the X-axis rotation.
|
||||
*/
|
||||
float getRotateX();
|
||||
|
||||
/**
|
||||
* Returns the rotation angle around the Y-axis.
|
||||
*
|
||||
* @return the Y-axis rotation.
|
||||
*/
|
||||
float getRotateY();
|
||||
|
||||
/**
|
||||
* Returns the rotation angle around the Z-axis.
|
||||
*
|
||||
* @return the Z-axis rotation.
|
||||
*/
|
||||
float getRotateZ();
|
||||
|
||||
/**
|
||||
* Enables or disables rotation for this part.
|
||||
*
|
||||
* @param enabled true to disable rotation; false to enable.
|
||||
*/
|
||||
void disabled(boolean enabled);
|
||||
|
||||
/**
|
||||
* Checks whether rotation is disabled for this part.
|
||||
*
|
||||
* @return true if rotation is disabled; false otherwise.
|
||||
*/
|
||||
boolean disabled();
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package noppes.npcs.api.entity.data;
|
||||
|
||||
/**
|
||||
* Represents the scaling configuration for a model.
|
||||
* Provides access to scaling data for individual parts of a model.
|
||||
*/
|
||||
public interface IModelScale {
|
||||
|
||||
/**
|
||||
* Retrieves the scaling settings for a specified model part.
|
||||
* Parts are indexed as follows: 0 - head, 1 - body, 2 - arms, 3 - legs.
|
||||
*
|
||||
* @param part the index of the model part.
|
||||
* @return the scale configuration for that part.
|
||||
*/
|
||||
IModelScalePart getPart(int part);
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package noppes.npcs.api.entity.data;
|
||||
|
||||
/**
|
||||
* Represents the scale configuration for a specific part of a model.
|
||||
* Allows setting and retrieving scale factors along the X, Y, and Z axes.
|
||||
*/
|
||||
public interface IModelScalePart {
|
||||
|
||||
/**
|
||||
* Sets the scale factors for this model part.
|
||||
*
|
||||
* @param x the scale factor along the X-axis.
|
||||
* @param y the scale factor along the Y-axis.
|
||||
* @param z the scale factor along the Z-axis.
|
||||
*/
|
||||
void setScale(float x, float y, float z);
|
||||
|
||||
/**
|
||||
* Returns the scale factor along the X-axis.
|
||||
*
|
||||
* @return the X-axis scale.
|
||||
*/
|
||||
float getScaleX();
|
||||
|
||||
/**
|
||||
* Returns the scale factor along the Y-axis.
|
||||
*
|
||||
* @return the Y-axis scale.
|
||||
*/
|
||||
float getScaleY();
|
||||
|
||||
/**
|
||||
* Returns the scale factor along the Z-axis.
|
||||
*
|
||||
* @return the Z-axis scale.
|
||||
*/
|
||||
float getScaleZ();
|
||||
}
|
||||
@@ -0,0 +1,173 @@
|
||||
package noppes.npcs.api.event;
|
||||
|
||||
import noppes.npcs.api.Cancelable;
|
||||
import noppes.npcs.api.IDamageSource;
|
||||
import noppes.npcs.api.ability.IAbility;
|
||||
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();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package noppes.npcs.api.event;
|
||||
|
||||
import noppes.npcs.api.Cancelable;
|
||||
import noppes.npcs.api.entity.IAnimatable;
|
||||
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 noppes.npcs.api.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();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
package noppes.npcs.api.event;
|
||||
|
||||
import noppes.npcs.api.Cancelable;
|
||||
import noppes.npcs.api.IBlock;
|
||||
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 {
|
||||
IEntity getEntity();
|
||||
|
||||
float getDistanceFallen();
|
||||
}
|
||||
|
||||
@Cancelable
|
||||
interface InteractEvent extends IBlockEvent {
|
||||
IPlayer getPlayer();
|
||||
|
||||
float getHitX();
|
||||
|
||||
float getHitY();
|
||||
|
||||
float getHitZ();
|
||||
|
||||
int getSide();
|
||||
}
|
||||
|
||||
interface RedstoneEvent extends IBlockEvent {
|
||||
int getPrevPower();
|
||||
|
||||
int getPower();
|
||||
}
|
||||
|
||||
/**
|
||||
* @hookName broken
|
||||
*/
|
||||
interface BreakEvent extends IBlockEvent {
|
||||
|
||||
}
|
||||
|
||||
@Cancelable
|
||||
interface ExplodedEvent extends IBlockEvent {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @hookName rainFilled
|
||||
*/
|
||||
interface RainFillEvent extends IBlockEvent {
|
||||
|
||||
}
|
||||
|
||||
interface NeighborChangedEvent extends IBlockEvent {
|
||||
IPos getChangedPos();
|
||||
}
|
||||
|
||||
interface InitEvent extends IBlockEvent {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @hookName tick
|
||||
*/
|
||||
interface UpdateEvent extends IBlockEvent {
|
||||
|
||||
}
|
||||
|
||||
interface ClickedEvent extends IBlockEvent {
|
||||
IPlayer getPlayer();
|
||||
}
|
||||
|
||||
@Cancelable
|
||||
interface HarvestedEvent extends IBlockEvent {
|
||||
IPlayer getPlayer();
|
||||
}
|
||||
|
||||
interface CollidedEvent extends IBlockEvent {
|
||||
IEntity getEntity();
|
||||
}
|
||||
|
||||
interface TimerEvent extends IBlockEvent {
|
||||
int getId();
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package noppes.npcs.api.event;
|
||||
|
||||
import noppes.npcs.api.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();
|
||||
|
||||
boolean doubleClick();
|
||||
|
||||
int getScrollIndex();
|
||||
}
|
||||
|
||||
/**
|
||||
* @hookName customGuiSlot
|
||||
*/
|
||||
interface SlotEvent extends ICustomGuiEvent {
|
||||
IItemStack getStack();
|
||||
}
|
||||
|
||||
/**
|
||||
* @hookName customGuiSlotClicked
|
||||
*/
|
||||
@Cancelable
|
||||
interface SlotClickEvent extends ICustomGuiEvent {
|
||||
IItemStack getStack();
|
||||
|
||||
int getDragType();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package noppes.npcs.api.event;
|
||||
|
||||
import noppes.npcs.api.Cancelable;
|
||||
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();
|
||||
|
||||
void setAttemptPosition(IPos attemptPosition);
|
||||
|
||||
IPos getAttemptPosition();
|
||||
|
||||
boolean animalSpawnPassed();
|
||||
|
||||
boolean monsterSpawnPassed();
|
||||
|
||||
boolean liquidSpawnPassed();
|
||||
|
||||
boolean airSpawnPassed();
|
||||
}
|
||||
|
||||
interface ScriptedCommandEvent extends ICustomNPCsEvent {
|
||||
IWorld getSenderWorld();
|
||||
|
||||
IPos getSenderPosition();
|
||||
|
||||
String getSenderName();
|
||||
|
||||
void setReplyMessage(String message);
|
||||
|
||||
String getId();
|
||||
|
||||
String[] getArgs();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package noppes.npcs.api.event;
|
||||
|
||||
import noppes.npcs.api.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,63 @@
|
||||
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 {
|
||||
int getTick();
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package noppes.npcs.api.event;
|
||||
|
||||
import noppes.npcs.api.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();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package noppes.npcs.api.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. */
|
||||
Object 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 {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,190 @@
|
||||
package noppes.npcs.api.event;
|
||||
|
||||
import noppes.npcs.api.Cancelable;
|
||||
import noppes.npcs.api.entity.IEntity;
|
||||
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();
|
||||
}
|
||||
|
||||
/**
|
||||
* 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();
|
||||
}
|
||||
|
||||
/**
|
||||
* 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();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +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 {
|
||||
|
||||
/**
|
||||
* 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 {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,235 @@
|
||||
package noppes.npcs.api.event;
|
||||
|
||||
import noppes.npcs.api.Cancelable;
|
||||
import noppes.npcs.api.IDamageSource;
|
||||
import noppes.npcs.api.entity.ICustomNpc;
|
||||
import noppes.npcs.api.entity.IEntity;
|
||||
import noppes.npcs.api.entity.IEntityLivingBase;
|
||||
import noppes.npcs.api.entity.IPlayer;
|
||||
import noppes.npcs.api.handler.data.IDialog;
|
||||
import noppes.npcs.api.item.IItemStack;
|
||||
|
||||
/**
|
||||
* Events fired for CustomNPC entities during their lifecycle and interactions.
|
||||
*/
|
||||
public interface INpcEvent extends ICustomNPCsEvent {
|
||||
|
||||
/** @return the NPC associated with this event. */
|
||||
ICustomNpc getNpc();
|
||||
|
||||
/**
|
||||
* Fired when an NPC timer triggers.
|
||||
* @hookName timer
|
||||
*/
|
||||
interface TimerEvent extends INpcEvent {
|
||||
/** @return the timer ID. */
|
||||
int getId();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when an entity collides with the NPC.
|
||||
* @hookName collide
|
||||
*/
|
||||
interface CollideEvent extends INpcEvent {
|
||||
/** @return the colliding entity. */
|
||||
IEntity getEntity();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when the NPC takes damage. Cancelable.
|
||||
* @hookName damaged
|
||||
*/
|
||||
@Cancelable
|
||||
interface DamagedEvent extends INpcEvent {
|
||||
/** @return the entity that caused the damage, or null. */
|
||||
IEntity getSource();
|
||||
|
||||
/** @return the damage source details. */
|
||||
IDamageSource getDamageSource();
|
||||
|
||||
/** @return the damage amount. */
|
||||
float getDamage();
|
||||
|
||||
/** @param damage the new damage amount. */
|
||||
void setDamage(float damage);
|
||||
|
||||
/** @param bo whether to clear the NPC's current target after damage. */
|
||||
void setClearTarget(boolean bo);
|
||||
|
||||
/** @return whether the NPC's target will be cleared after damage. */
|
||||
boolean getClearTarget();
|
||||
|
||||
/** @return the damage type string. */
|
||||
String getType();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when the NPC launches a ranged attack. Cancelable.
|
||||
* @hookName rangedLaunched
|
||||
*/
|
||||
@Cancelable
|
||||
interface RangedLaunchedEvent extends INpcEvent {
|
||||
/** @return the target entity. */
|
||||
IEntityLivingBase getTarget();
|
||||
|
||||
/** @param damage the new ranged damage. */
|
||||
void setDamage(float damage);
|
||||
|
||||
/** @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 {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
package noppes.npcs.api.event;
|
||||
|
||||
import noppes.npcs.api.Cancelable;
|
||||
import noppes.npcs.api.entity.IPlayer;
|
||||
import noppes.npcs.api.handler.data.IParty;
|
||||
import noppes.npcs.api.handler.data.IQuest;
|
||||
|
||||
/**
|
||||
* Events fired during party operations such as quest progress, invitations, kicks, and disbanding.
|
||||
*/
|
||||
public interface IPartyEvent {
|
||||
|
||||
/** @return the party involved in this event. */
|
||||
IParty getParty();
|
||||
|
||||
/** @return the quest associated with this party event. */
|
||||
IQuest getQuest();
|
||||
|
||||
/**
|
||||
* Fired when a party quest is completed.
|
||||
* @hookName partyQuestCompleted
|
||||
*/
|
||||
interface PartyQuestCompletedEvent extends IPartyEvent {
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when a quest is assigned to the party. Cancelable.
|
||||
* @hookName partyQuestSet
|
||||
*/
|
||||
@Cancelable
|
||||
interface PartyQuestSetEvent extends IPartyEvent {
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when a party quest is turned in. Cancelable.
|
||||
* @hookName partyQuestTurnedIn
|
||||
*/
|
||||
@Cancelable
|
||||
interface PartyQuestTurnedInEvent extends IPartyEvent {
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when a player is invited to the party. Cancelable.
|
||||
* @hookName partyInvite
|
||||
*/
|
||||
@Cancelable
|
||||
interface PartyInviteEvent extends IPartyEvent {
|
||||
/** @return the invited player. */
|
||||
IPlayer getPlayer();
|
||||
|
||||
/** @return the invited player's name. */
|
||||
String getPlayerName();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when a player is kicked from the party. Cancelable.
|
||||
* @hookName partyKick
|
||||
*/
|
||||
@Cancelable
|
||||
interface PartyKickEvent extends IPartyEvent {
|
||||
/** @return the kicked player. */
|
||||
IPlayer getPlayer();
|
||||
|
||||
/** @return the kicked player's name. */
|
||||
String getPlayerName();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when a player voluntarily leaves the party.
|
||||
* @hookName partyLeave
|
||||
*/
|
||||
interface PartyLeaveEvent extends IPartyEvent {
|
||||
/** @return the leaving player. */
|
||||
IPlayer getPlayer();
|
||||
|
||||
/** @return the leaving player's name. */
|
||||
String getPlayerName();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when the party is disbanded.
|
||||
* @hookName partyDisband
|
||||
*/
|
||||
interface PartyDisbandEvent extends IPartyEvent {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,628 @@
|
||||
package noppes.npcs.api.event;
|
||||
|
||||
import noppes.npcs.api.Cancelable;
|
||||
import noppes.npcs.api.IBlock;
|
||||
import noppes.npcs.api.IContainer;
|
||||
import noppes.npcs.api.IDamageSource;
|
||||
import noppes.npcs.api.entity.IEntity;
|
||||
import noppes.npcs.api.entity.IEntityLivingBase;
|
||||
import noppes.npcs.api.entity.IPlayer;
|
||||
import noppes.npcs.api.handler.data.IPlayerEffect;
|
||||
import noppes.npcs.api.handler.data.IProfile;
|
||||
import noppes.npcs.api.item.IItemStack;
|
||||
|
||||
/**
|
||||
* Events fired for player actions including combat, items, movement, and interactions.
|
||||
*/
|
||||
public interface IPlayerEvent extends ICustomNPCsEvent {
|
||||
|
||||
/** @return the player associated with this event. */
|
||||
IPlayer getPlayer();
|
||||
|
||||
/**
|
||||
* Fired when the player sends a chat message. Cancelable.
|
||||
* @hookName chat
|
||||
*/
|
||||
@Cancelable
|
||||
interface ChatEvent extends IPlayerEvent {
|
||||
/** @param message the new chat message. */
|
||||
void setMessage(String message);
|
||||
|
||||
/** @return the chat message. */
|
||||
String getMessage();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when the player presses or releases a key.
|
||||
* @hookName keyPressed
|
||||
*/
|
||||
interface KeyPressedEvent extends IPlayerEvent {
|
||||
/** @return the key code. */
|
||||
int getKey();
|
||||
|
||||
/** @return true if Ctrl is held. */
|
||||
boolean isCtrlPressed();
|
||||
|
||||
/** @return true if Alt is held. */
|
||||
boolean isAltPressed();
|
||||
|
||||
/** @return true if Shift is held. */
|
||||
boolean isShiftPressed();
|
||||
|
||||
/** @return true if Meta is held. */
|
||||
boolean isMetaPressed();
|
||||
|
||||
/** @return true if the key is being pressed down, false if released. */
|
||||
boolean keyDown();
|
||||
|
||||
/** @return array of currently held key codes. */
|
||||
int[] getKeysDown();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when the player clicks a mouse button.
|
||||
* @hookName mouseClicked
|
||||
*/
|
||||
interface MouseClickedEvent extends IPlayerEvent {
|
||||
/** @return the mouse button index. */
|
||||
int getButton();
|
||||
|
||||
/** @return the mouse wheel scroll delta. */
|
||||
int getMouseWheel();
|
||||
|
||||
/** @return true if the button is being pressed down. */
|
||||
boolean buttonDown();
|
||||
|
||||
/** @return true if Ctrl is held. */
|
||||
boolean isCtrlPressed();
|
||||
|
||||
/** @return true if Alt is held. */
|
||||
boolean isAltPressed();
|
||||
|
||||
/** @return true if Shift is held. */
|
||||
boolean isShiftPressed();
|
||||
|
||||
/** @return true if Meta is held. */
|
||||
boolean isMetaPressed();
|
||||
|
||||
/** @return array of currently held key codes. */
|
||||
int[] getKeysDown();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when the player picks up experience orbs.
|
||||
* @hookName pickupXP
|
||||
*/
|
||||
interface PickupXPEvent extends IPlayerEvent {
|
||||
/** @return the amount of XP picked up. */
|
||||
int getAmount();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when the player levels up.
|
||||
* @hookName levelUp
|
||||
*/
|
||||
interface LevelUpEvent extends IPlayerEvent {
|
||||
/** @return the number of levels gained. */
|
||||
int getChange();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when the player logs out.
|
||||
* @hookName logout
|
||||
*/
|
||||
interface LogoutEvent extends IPlayerEvent {
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when the player logs in.
|
||||
* @hookName login
|
||||
*/
|
||||
interface LoginEvent extends IPlayerEvent {
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when the player respawns after death.
|
||||
* @hookName respawn
|
||||
*/
|
||||
interface RespawnEvent extends IPlayerEvent {
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when the player changes dimensions.
|
||||
* @hookName changedDim
|
||||
*/
|
||||
interface ChangedDimension extends IPlayerEvent {
|
||||
/** @return the dimension ID the player came from. */
|
||||
int getFromDim();
|
||||
|
||||
/** @return the dimension ID the player traveled to. */
|
||||
int getToDim();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when a player timer triggers.
|
||||
* @hookName timer
|
||||
*/
|
||||
interface TimerEvent extends IPlayerEvent {
|
||||
/** @return the timer ID. */
|
||||
int getId();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when the player is attacked (before armor reduction). Cancelable.
|
||||
* @hookName attacked
|
||||
*/
|
||||
@Cancelable
|
||||
interface AttackedEvent extends IPlayerEvent {
|
||||
/** @return the damage source details. */
|
||||
IDamageSource getDamageSource();
|
||||
|
||||
/** @return the attacking entity, or null. */
|
||||
IEntity getSource();
|
||||
|
||||
/** @return the raw damage amount. */
|
||||
float getDamage();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when the player takes damage (after armor reduction). Cancelable.
|
||||
* @hookName damaged
|
||||
*/
|
||||
@Cancelable
|
||||
interface DamagedEvent extends IPlayerEvent {
|
||||
/** @return the damage source details. */
|
||||
IDamageSource getDamageSource();
|
||||
|
||||
/** @return the damaging entity, or null. */
|
||||
IEntity getSource();
|
||||
|
||||
/** @return the damage amount after reduction. */
|
||||
float getDamage();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when the player is about to be struck by lightning. Cancelable.
|
||||
* @hookName lightning
|
||||
*/
|
||||
@Cancelable
|
||||
interface LightningEvent extends IPlayerEvent {
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when a sound is played for the player. Cancelable.
|
||||
* @hookName playSound
|
||||
*/
|
||||
@Cancelable
|
||||
interface SoundEvent extends IPlayerEvent {
|
||||
/** @return the sound resource name. */
|
||||
String getName();
|
||||
|
||||
/** @return the sound pitch. */
|
||||
float getPitch();
|
||||
|
||||
/** @return the sound volume. */
|
||||
float getVolume();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when the player falls. Cancelable.
|
||||
* @hookName fall
|
||||
*/
|
||||
@Cancelable
|
||||
interface FallEvent extends IPlayerEvent {
|
||||
/** @return the fall distance in blocks. */
|
||||
float getDistance();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when the player jumps.
|
||||
* @hookName jump
|
||||
*/
|
||||
interface JumpEvent extends IPlayerEvent {
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when the player kills an entity.
|
||||
* @hookName kills
|
||||
*/
|
||||
interface KilledEntityEvent extends IPlayerEvent {
|
||||
/** @return the killed entity. */
|
||||
IEntityLivingBase getEntity();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when the player dies.
|
||||
* @hookName killed
|
||||
*/
|
||||
interface DiedEvent extends IPlayerEvent {
|
||||
/** @return the damage source that killed the player. */
|
||||
IDamageSource getDamageSource();
|
||||
|
||||
/** @return the damage type string. */
|
||||
String getType();
|
||||
|
||||
/** @return the entity that killed the player, or null. */
|
||||
IEntity getSource();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when the player launches a ranged weapon (e.g., bow). Cancelable.
|
||||
* @hookName rangedLaunched
|
||||
*/
|
||||
@Cancelable
|
||||
interface RangedLaunchedEvent extends IPlayerEvent {
|
||||
/** @return the bow item. */
|
||||
IItemStack getBow();
|
||||
|
||||
/** @return the charge level of the bow. */
|
||||
int getCharge();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when the player attacks an entity. Cancelable.
|
||||
* @hookName attack
|
||||
*/
|
||||
@Cancelable
|
||||
interface AttackEvent extends IPlayerEvent {
|
||||
/** @return the damage source details. */
|
||||
IDamageSource getDamageSource();
|
||||
|
||||
/** @return the target entity. */
|
||||
IEntity getTarget();
|
||||
|
||||
/** @return the attack damage. */
|
||||
float getDamage();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when the player deals damage to an entity (after hit). Cancelable.
|
||||
* @hookName damagedEntity
|
||||
*/
|
||||
@Cancelable
|
||||
interface DamagedEntityEvent extends IPlayerEvent {
|
||||
/** @return the damage source details. */
|
||||
IDamageSource getDamageSource();
|
||||
|
||||
/** @return the damaged entity. */
|
||||
IEntity getTarget();
|
||||
|
||||
/** @return the damage dealt. */
|
||||
float getDamage();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when the player closes a container.
|
||||
* @hookName containerClosed
|
||||
*/
|
||||
interface ContainerClosed extends IPlayerEvent {
|
||||
/** @return the closed container. */
|
||||
IContainer getContainer();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when the player opens a container.
|
||||
* @hookName containerOpen
|
||||
*/
|
||||
interface ContainerOpen extends IPlayerEvent {
|
||||
/** @return the opened container. */
|
||||
IContainer getContainer();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when the player picks up an item. Cancelable.
|
||||
* @hookName pickUp
|
||||
*/
|
||||
@Cancelable
|
||||
interface PickUpEvent extends IPlayerEvent {
|
||||
/** @return the picked up item. */
|
||||
IItemStack getItem();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when items are dropped from the player's inventory (e.g., on death). Cancelable.
|
||||
* @hookName drop
|
||||
*/
|
||||
@Cancelable
|
||||
interface DropEvent extends IPlayerEvent {
|
||||
/** @return the dropped items. */
|
||||
IItemStack[] getItems();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when the player tosses a single item. Cancelable.
|
||||
* @hookName toss
|
||||
*/
|
||||
@Cancelable
|
||||
interface TossEvent extends IPlayerEvent {
|
||||
/** @return the tossed item. */
|
||||
IItemStack getItem();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when the player interacts with an entity. Cancelable.
|
||||
* @hookName interact
|
||||
*/
|
||||
@Cancelable
|
||||
interface InteractEvent extends IPlayerEvent {
|
||||
/** @return the interaction type. */
|
||||
int getType();
|
||||
|
||||
/** @return the target entity. */
|
||||
IEntity getTarget();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when the player right-clicks. Cancelable.
|
||||
* @hookName rightClick
|
||||
*/
|
||||
@Cancelable
|
||||
interface RightClickEvent extends IPlayerEvent {
|
||||
/** @return the click type. */
|
||||
int getType();
|
||||
|
||||
/** @return the target (entity, block, or null). */
|
||||
Object getTarget();
|
||||
|
||||
/** @return the player. */
|
||||
IPlayer getPlayer();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired each tick for the player.
|
||||
* @hookName tick
|
||||
*/
|
||||
interface UpdateEvent extends IPlayerEvent {
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when the player script is initialized.
|
||||
* @hookName init
|
||||
*/
|
||||
interface InitEvent extends IPlayerEvent {
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when the player starts using an item (e.g., drawing a bow).
|
||||
* @hookName startItem
|
||||
*/
|
||||
interface StartUsingItem extends IPlayerEvent {
|
||||
/** @return the item being used. */
|
||||
IItemStack getItem();
|
||||
|
||||
/** @return the use duration in ticks. */
|
||||
int getDuration();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired each tick while the player is using an item.
|
||||
* @hookName usingItem
|
||||
*/
|
||||
interface UsingItem extends IPlayerEvent {
|
||||
/** @return the item being used. */
|
||||
IItemStack getItem();
|
||||
|
||||
/** @return the remaining use duration in ticks. */
|
||||
int getDuration();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when the player stops using an item before completion.
|
||||
* @hookName stopItem
|
||||
*/
|
||||
interface StopUsingItem extends IPlayerEvent {
|
||||
/** @return the item that was being used. */
|
||||
IItemStack getItem();
|
||||
|
||||
/** @return the remaining use duration in ticks. */
|
||||
int getDuration();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when the player finishes using an item (full duration).
|
||||
* @hookName finishItem
|
||||
*/
|
||||
interface FinishUsingItem extends IPlayerEvent {
|
||||
/** @return the item that was used. */
|
||||
IItemStack getItem();
|
||||
|
||||
/** @return the total use duration in ticks. */
|
||||
int getDuration();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when the player breaks a block. Cancelable.
|
||||
* @hookName breakBlock
|
||||
*/
|
||||
@Cancelable
|
||||
interface BreakEvent extends IPlayerEvent {
|
||||
/** @return the block being broken. */
|
||||
IBlock getBlock();
|
||||
|
||||
/** @return the experience dropped from breaking the block. */
|
||||
int getExp();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when the player uses a hoe on a block.
|
||||
* @hookName useHoe
|
||||
*/
|
||||
interface UseHoeEvent extends IPlayerEvent {
|
||||
/** @return the hoe item. */
|
||||
IItemStack getHoe();
|
||||
|
||||
/** @return the X coordinate of the hoed block. */
|
||||
int getX();
|
||||
|
||||
/** @return the Y coordinate of the hoed block. */
|
||||
int getY();
|
||||
|
||||
/** @return the Z coordinate of the hoed block. */
|
||||
int getZ();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when the player wakes up from a bed.
|
||||
* @hookName wakeUp
|
||||
*/
|
||||
interface WakeUpEvent extends IPlayerEvent {
|
||||
/** @return true if the bed position was set as spawn. */
|
||||
boolean setSpawn();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when the player sleeps in a bed.
|
||||
* @hookName sleep
|
||||
*/
|
||||
interface SleepEvent extends IPlayerEvent {
|
||||
/** @return the X coordinate of the bed. */
|
||||
int getX();
|
||||
|
||||
/** @return the Y coordinate of the bed. */
|
||||
int getY();
|
||||
|
||||
/** @return the Z coordinate of the bed. */
|
||||
int getZ();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when the player earns an achievement.
|
||||
* @hookName achievement
|
||||
*/
|
||||
interface AchievementEvent extends IPlayerEvent {
|
||||
/** @return the achievement description. */
|
||||
String getDescription();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when the player fills a bucket.
|
||||
* @hookName fillBucket
|
||||
*/
|
||||
interface FillBucketEvent extends IPlayerEvent {
|
||||
/** @return the empty bucket item. */
|
||||
IItemStack getCurrent();
|
||||
|
||||
/** @return the filled bucket item. */
|
||||
IItemStack getFilled();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when the player uses bonemeal on a block.
|
||||
* @hookName bonemeal
|
||||
*/
|
||||
interface BonemealEvent extends IPlayerEvent {
|
||||
/** @return the block that was bonemealed. */
|
||||
IBlock getBlock();
|
||||
|
||||
/** @return the X coordinate. */
|
||||
int getX();
|
||||
|
||||
/** @return the Y coordinate. */
|
||||
int getY();
|
||||
|
||||
/** @return the Z coordinate. */
|
||||
int getZ();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when the player begins charging a ranged weapon.
|
||||
* @hookName rangedCharge
|
||||
*/
|
||||
interface RangedChargeEvent extends IPlayerEvent {
|
||||
}
|
||||
|
||||
/**
|
||||
* Events fired for player custom effects (add, tick, remove).
|
||||
* @hookName onEffect
|
||||
*/
|
||||
interface EffectEvent extends IPlayerEvent {
|
||||
|
||||
/** @return the player effect. */
|
||||
IPlayerEffect getEffect();
|
||||
|
||||
/**
|
||||
* Fired when an effect is added to the player.
|
||||
* @hookName onEffectAdd
|
||||
*/
|
||||
interface Added extends EffectEvent {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired each tick while the effect is active.
|
||||
* @hookName onEffectTick
|
||||
*/
|
||||
interface Ticked extends EffectEvent {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when an effect is removed from the player.
|
||||
* @hookName onEffectRemove
|
||||
*/
|
||||
interface Removed extends EffectEvent {
|
||||
|
||||
/**
|
||||
* @return If the effect timer has ticked down to 0.
|
||||
*/
|
||||
boolean hasTimerRunOut();
|
||||
|
||||
/**
|
||||
* @return If the effect was removed on death.
|
||||
*/
|
||||
boolean causedByDeath();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Events fired for profile operations (create, change, remove). Cancelable.
|
||||
* @hookName profile
|
||||
*/
|
||||
@Cancelable
|
||||
interface ProfileEvent extends IPlayerEvent {
|
||||
|
||||
/**
|
||||
* @return IProfile Object of the Operation
|
||||
*/
|
||||
IProfile getProfile();
|
||||
|
||||
/**
|
||||
* @return Slot ID in question
|
||||
*/
|
||||
int getSlot();
|
||||
|
||||
/**
|
||||
* @return returns true if it occurs after the operation (not cancellable)
|
||||
*/
|
||||
boolean isPost();
|
||||
|
||||
/**
|
||||
* Fired when the player switches profile slots. Cancelable.
|
||||
* @hookName profileChange
|
||||
*/
|
||||
@Cancelable
|
||||
interface Changed extends ProfileEvent {
|
||||
/**
|
||||
* @return The previous slot before the switch
|
||||
*/
|
||||
int getPrevSlot();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when a new profile is created. Cancelable.
|
||||
* @hookName profileCreate
|
||||
*/
|
||||
@Cancelable
|
||||
interface Create extends ProfileEvent {
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when a profile is removed. Cancelable.
|
||||
* @hookName profileRemove
|
||||
*/
|
||||
@Cancelable
|
||||
interface Removed extends ProfileEvent {
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package noppes.npcs.api.event;
|
||||
|
||||
import noppes.npcs.api.IBlock;
|
||||
import noppes.npcs.api.entity.IEntity;
|
||||
import noppes.npcs.api.entity.IProjectile;
|
||||
|
||||
/**
|
||||
* Events fired during NPC projectile lifecycle and impacts.
|
||||
*/
|
||||
public interface IProjectileEvent extends ICustomNPCsEvent {
|
||||
|
||||
/** @return the projectile entity. */
|
||||
public IProjectile getProjectile();
|
||||
|
||||
/** @return the entity that launched this projectile. */
|
||||
public IEntity getSource();
|
||||
|
||||
/**
|
||||
* Fired each tick while the projectile exists.
|
||||
* @hookName projectileTick
|
||||
*/
|
||||
interface UpdateEvent extends IProjectileEvent {
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when the projectile hits something.
|
||||
* @hookName projectileImpact
|
||||
*/
|
||||
interface ImpactEvent extends IProjectileEvent {
|
||||
/** @return the impact type. */
|
||||
public int getType();
|
||||
|
||||
/** @return the entity hit, or null if a block was hit. */
|
||||
public IEntity getEntity();
|
||||
|
||||
/** @return the block hit, or null if an entity was hit. */
|
||||
public IBlock getBlock();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package noppes.npcs.api.event;
|
||||
|
||||
import noppes.npcs.api.Cancelable;
|
||||
import noppes.npcs.api.handler.data.IQuest;
|
||||
import noppes.npcs.api.item.IItemStack;
|
||||
|
||||
/**
|
||||
* Events fired during quest lifecycle: starting, completing, and turning in.
|
||||
*/
|
||||
public interface IQuestEvent extends IPlayerEvent {
|
||||
|
||||
/** @return the quest associated with this event. */
|
||||
IQuest getQuest();
|
||||
|
||||
/**
|
||||
* Fired when a quest's objectives are all completed.
|
||||
* @hookName questCompleted
|
||||
*/
|
||||
interface QuestCompletedEvent extends IQuestEvent {
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when a quest is started/accepted. Cancelable.
|
||||
* @hookName questStart
|
||||
*/
|
||||
@Cancelable
|
||||
interface QuestStartEvent extends IQuestEvent {
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when a completed quest is turned in. Cancelable.
|
||||
* @hookName questTurnIn
|
||||
*/
|
||||
@Cancelable
|
||||
interface QuestTurnedInEvent extends IQuestEvent {
|
||||
/** @param expReward the experience reward to give. */
|
||||
void setExpReward(int expReward);
|
||||
|
||||
/** @param itemRewards the item rewards to give. */
|
||||
void setItemRewards(IItemStack[] itemRewards);
|
||||
|
||||
/** @return the experience reward. */
|
||||
int getExpReward();
|
||||
|
||||
/** @return the item rewards. */
|
||||
IItemStack[] getItemRewards();
|
||||
}
|
||||
}
|
||||
Loaded 100 of 215 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user