Package noppes.npcs.api
Interface ITelegraph
-
public interface ITelegraphA 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.To create a telegraph:
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);
Telegraph types:
- CIRCLE - A filled circle with a radius
- RING - A ring with inner and outer radius
- LINE - A rectangular line in a direction
- CONE - A cone/arc shape
- SQUARE - A square shape
- POINT - A small point marker
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description floatgetAngle()Get the angle in degrees (for CONE type).intgetColor()Get the primary color in ARGB format.intgetDuration()Get the duration in ticks.floatgetHeightOffset()Get the height offset from ground level.floatgetInnerRadius()Get the inner radius (for RING type).floatgetLength()Get the length (for LINE and CONE types).floatgetRadius()Get the radius (for CIRCLE, SQUARE and RING types).StringgetType()Get the telegraph type.intgetWarningColor()Get the warning phase color in ARGB format.intgetWarningStartTick()Get the tick at which warning phase begins.floatgetWidth()Get the width (for LINE type).booleanisAnimated()Check if pulsing animation is enabled.voidsetAngle(float angle)Set the angle in degrees (for CONE type).voidsetAnimated(boolean animated)Enable or disable pulsing animation.voidsetColor(int argb)Set the primary color in ARGB format.voidsetDuration(int ticks)Set the duration in ticks (20 ticks = 1 second).voidsetHeightOffset(float offset)Set the height offset from ground level.voidsetInnerRadius(float innerRadius)Set the inner radius (for RING type).voidsetLength(float length)Set the length (for LINE and CONE types).voidsetRadius(float radius)Set the radius (for CIRCLE, SQUARE and RING types).voidsetType(String type)Set the telegraph type.voidsetWarningColor(int argb)Set the warning phase color in ARGB format.voidsetWarningStartTick(int tick)Set the tick at which warning phase begins.voidsetWidth(float width)Set the width (for LINE type).ITelegraphInstancespawn(IEntity entity)Spawn this telegraph following an entity.ITelegraphInstancespawn(IEntity entity, float yaw)Spawn this telegraph following an entity with rotation.ITelegraphInstancespawn(IWorld world, double x, double y, double z)Spawn this telegraph at a position.ITelegraphInstancespawn(IWorld world, double x, double y, double z, float yaw)Spawn this telegraph at a position with rotation.
-
-
-
Method Detail
-
getType
String getType()
Get the telegraph type.- Returns:
- Type name: "CIRCLE", "RING", "LINE", "CONE", "SQUARE", or "POINT"
-
setType
void setType(String type)
Set the telegraph type.- Parameters:
type- Type name: "circle", "ring", "line", "cone", "square", or "point" (case insensitive)
-
getRadius
float getRadius()
Get the radius (for CIRCLE, SQUARE and RING types).- Returns:
- the circle/ring radius in blocks
-
setRadius
void setRadius(float radius)
Set the radius (for CIRCLE, SQUARE and RING types).- Parameters:
radius- circle/ring radius in blocks
-
getInnerRadius
float getInnerRadius()
Get the inner radius (for RING type).- Returns:
- the inner radius for RING type in blocks
-
setInnerRadius
void setInnerRadius(float innerRadius)
Set the inner radius (for RING type).- Parameters:
innerRadius- inner radius for RING type in blocks
-
getLength
float getLength()
Get the length (for LINE and CONE types).- Returns:
- the length for LINE/CONE types in blocks
-
setLength
void setLength(float length)
Set the length (for LINE and CONE types).- Parameters:
length- length for LINE/CONE types in blocks
-
getWidth
float getWidth()
Get the width (for LINE type).- Returns:
- the width for LINE type in blocks
-
setWidth
void setWidth(float width)
Set the width (for LINE type).- Parameters:
width- width for LINE type in blocks
-
getAngle
float getAngle()
Get the angle in degrees (for CONE type).- Returns:
- the arc angle for CONE type in degrees
-
setAngle
void setAngle(float angle)
Set the angle in degrees (for CONE type).- Parameters:
angle- arc angle for CONE type in degrees
-
getDuration
int getDuration()
Get the duration in ticks.- Returns:
- duration in ticks (20 ticks = 1 second)
-
setDuration
void setDuration(int ticks)
Set the duration in ticks (20 ticks = 1 second).- Parameters:
ticks- duration in ticks (20 ticks = 1 second)
-
getColor
int getColor()
Get the primary color in ARGB format.- Returns:
- the primary color in ARGB format
-
setColor
void setColor(int argb)
Set the primary color in ARGB format. Example: 0x80FF0000 for semi-transparent red- Parameters:
argb- primary color in ARGB format (e.g. 0x80FF0000)
-
getWarningColor
int getWarningColor()
Get the warning phase color in ARGB format.- Returns:
- the warning phase color in ARGB format
-
setWarningColor
void setWarningColor(int argb)
Set the warning phase color in ARGB format. This color is used during the final warning phase.- Parameters:
argb- warning phase color in ARGB format
-
getWarningStartTick
int getWarningStartTick()
Get the tick at which warning phase begins.- Returns:
- the tick at which warning phase begins
-
setWarningStartTick
void setWarningStartTick(int tick)
Set the tick at which warning phase begins. When remaining ticks falls below this value, the telegraph uses the warning color.- Parameters:
tick- tick at which warning phase begins
-
isAnimated
boolean isAnimated()
Check if pulsing animation is enabled.- Returns:
- true if pulsing animation is enabled
-
setAnimated
void setAnimated(boolean animated)
Enable or disable pulsing animation.- Parameters:
animated- whether pulsing animation is enabled
-
getHeightOffset
float getHeightOffset()
Get the height offset from ground level.- Returns:
- the height offset from ground level in blocks
-
setHeightOffset
void setHeightOffset(float offset)
Set the height offset from ground level. Default is 0.1 to prevent z-fighting with ground blocks.- Parameters:
offset- height offset from ground level in blocks
-
spawn
ITelegraphInstance spawn(IWorld world, double x, double y, double z)
Spawn this telegraph at a position.- Parameters:
world- The world to spawn inx- X positiony- Y positionz- Z position- Returns:
- The spawned telegraph instance
-
spawn
ITelegraphInstance spawn(IWorld world, double x, double y, double z, float yaw)
Spawn this telegraph at a position with rotation.- Parameters:
world- The world to spawn inx- X positiony- Y positionz- Z positionyaw- Rotation yaw (for directional telegraphs like LINE/CONE)- Returns:
- The spawned telegraph instance
-
spawn
ITelegraphInstance spawn(IEntity entity)
Spawn this telegraph following an entity. The telegraph will update its position to follow the entity.- Parameters:
entity- The entity to follow- Returns:
- The spawned telegraph instance
-
spawn
ITelegraphInstance spawn(IEntity entity, float yaw)
Spawn this telegraph following an entity with rotation.- Parameters:
entity- The entity to followyaw- Rotation yaw- Returns:
- The spawned telegraph instance
-
-