Package noppes.npcs.api.entity
Interface IEntity<T extends net.minecraft.world.entity.Entity>
- All Known Subinterfaces:
IAnimal<T>
,IArrow<T>
,ICustomNpc<T>
,IEntityItem<T>
,IEntityLiving<T>
,IMob<T>
,IMonster<T>
,IPixelmon<T>
,IPlayer<T>
,IProjectile<T>
,IThrowable<T>
,IVillager<T>
public interface IEntity<T extends net.minecraft.world.entity.Entity>
-
Method Summary
Modifier and TypeMethodDescriptionvoid
void
void
void
damage
(float amount) void
void
despawn()
Despawns this entity.dropItem
(IItemStack item) void
Removes fire from this entitylong
getAge()
IEntity[]
int
int
int
This is not a function you should be calling every tick.float
float
Expert users onlydouble
double
double
getMount()
getName()
getNbt()
The Entity's extra stored NBT datafloat
getPitch()
getPos()
IEntity[]
float
Stored data persists through world restart.String[]
getTags()
Tags are used by scoreboards and can be used in commandsTemp data stores anything but only untill it's reloadedint
getType()
getUUID()
float
getWidth()
getWorld()
double
getX()
double
getY()
double
getZ()
boolean
boolean
boolean
inFire()
boolean
inLava()
boolean
inWater()
boolean
isAlive()
boolean
boolean
boolean
void
kill()
Kill the entity, doesnt't despawn itvoid
knockback
(int power, float direction) void
playAnimation
(int type) Play specific minecraft animations client side 0 and 3 are for LivingEntity entities and 2 is only for playersrayTraceBlock
(double distance, boolean stopOnLiquid, boolean ignoreBlockWithoutBoundingBox) Gets the first block within distance the npc is looking atIEntity[]
rayTraceEntities
(double distance, boolean stopOnLiquid, boolean ignoreBlockWithoutBoundingBox) Gets the entities within distance the npc is looking at sorted by distancevoid
void
setBurning
(int seconds) void
setEntityNbt
(INbt nbt) This is not a function you should be calling every tickvoid
setMotionX
(double motion) void
setMotionY
(double motion) void
setMotionZ
(double motion) void
void
void
setPitch
(float pitch) void
void
setPosition
(double x, double y, double z) void
setRotation
(float rotation) void
setX
(double x) void
setY
(double y) void
setZ
(double z) void
spawn()
Spawns this entity into the world (For NPCs dont forget to set their home position)void
storeAsClone
(int tab, String name) Stores the entity as clone server sideboolean
typeOf
(int type)
-
Method Details
-
getX
double getX() -
setX
void setX(double x) -
getY
double getY() -
setY
void setY(double y) -
getZ
double getZ() -
setZ
void setZ(double z) -
getBlockX
int getBlockX() -
getBlockY
int getBlockY() -
getBlockZ
int getBlockZ() -
getPos
IPos getPos() -
setPos
-
setPosition
void setPosition(double x, double y, double z) -
setRotation
void setRotation(float rotation) - Parameters:
rotation
- The rotation to be set (0-360)
-
getRotation
float getRotation()- Returns:
- Current rotation of the entity
-
getHeight
float getHeight()- Returns:
- Returns the height of the bounding box
-
getEyeHeight
float getEyeHeight()- Returns:
- Returns the eye height of the entity, used in this like canSee and such
-
getWidth
float getWidth()- Returns:
- Returns the width of the bounding box
-
setPitch
void setPitch(float pitch) - Parameters:
pitch
- The viewing pitch
-
getPitch
float getPitch()- Returns:
- Entities viewing pitch
-
getMount
IEntity getMount() -
setMount
-
getRiders
IEntity[] getRiders()- Returns:
- Returns the entities riding this entity
-
getAllRiders
IEntity[] getAllRiders()- Returns:
- Returns the entities riding this entity including the entities riding those entities
-
addRider
-
clearRiders
void clearRiders() -
knockback
void knockback(int power, float direction) - Parameters:
power
- How strong the knockback isdirection
- The direction in which he flies back (0-360). Usually based on getRotation()
-
isSneaking
boolean isSneaking() -
isSprinting
boolean isSprinting() -
dropItem
-
inWater
boolean inWater() -
inFire
boolean inFire() -
inLava
boolean inLava() -
getTempdata
IData getTempdata()Temp data stores anything but only untill it's reloaded -
getStoreddata
IData getStoreddata()Stored data persists through world restart. Unlike tempdata only Strings and Numbers can be saved -
getNbt
INbt getNbt()The Entity's extra stored NBT data- Returns:
- The Entity's extra stored NBT data
-
isAlive
boolean isAlive() -
getAge
long getAge()- Returns:
- The age of this entity in ticks
-
despawn
void despawn()Despawns this entity. Removes it permanently -
spawn
void spawn()Spawns this entity into the world (For NPCs dont forget to set their home position) -
kill
void kill()Kill the entity, doesnt't despawn it -
isBurning
boolean isBurning()- Returns:
- Return whether or not this entity is on fire
-
setBurning
void setBurning(int seconds) - Parameters:
seconds
- Amount of seconds this entity will burn.
-
extinguish
void extinguish()Removes fire from this entity -
getWorld
IWorld getWorld()- Returns:
- Returns the
IWorld
-
getTypeName
String getTypeName()- Returns:
- Name as which it's registered in minecraft
-
getType
int getType()- Returns:
- Returns the
EntitiesType
of this entity
-
typeOf
boolean typeOf(int type) - Parameters:
type
-EntitiesType
to check- Returns:
- Returns whether the entity is type of the given
EntitiesType
-
getMCEntity
T getMCEntity()Expert users only- Returns:
- Returns minecrafts entity
-
getUUID
String getUUID() -
generateNewUUID
String generateNewUUID() -
storeAsClone
Stores the entity as clone server side- Parameters:
tab
-name
-
-
getEntityNbt
INbt getEntityNbt()This is not a function you should be calling every tick. Returns the entire entity as nbt -
setEntityNbt
This is not a function you should be calling every tick -
rayTraceBlock
IRayTrace rayTraceBlock(double distance, boolean stopOnLiquid, boolean ignoreBlockWithoutBoundingBox) Gets the first block within distance the npc is looking at- Parameters:
distance
-stopOnLiquid
-ignoreBlockWithoutBoundingBox
-- Returns:
-
rayTraceEntities
IEntity[] rayTraceEntities(double distance, boolean stopOnLiquid, boolean ignoreBlockWithoutBoundingBox) Gets the entities within distance the npc is looking at sorted by distance- Parameters:
distance
-stopOnLiquid
-ignoreBlockWithoutBoundingBox
-- Returns:
-
getTags
String[] getTags()Tags are used by scoreboards and can be used in commands -
addTag
-
hasTag
-
removeTag
-
playAnimation
void playAnimation(int type) Play specific minecraft animations client side 0 and 3 are for LivingEntity entities and 2 is only for players- Parameters:
type
- 0:Swing main hand, 1:Hurt animation, 2:Wakeup Player 3:Swing offhand hand, 4:Crit particle, 5:Spell crit particle
-
damage
void damage(float amount) -
damage
-
getMotionX
double getMotionX() -
getMotionY
double getMotionY() -
getMotionZ
double getMotionZ() -
setMotionX
void setMotionX(double motion) -
setMotionY
void setMotionY(double motion) -
setMotionZ
void setMotionZ(double motion) -
getName
String getName()- Returns:
- Returns the current name displayed by the entity
-
setName
- Parameters:
name
- Set a custom name for this entity
-
hasCustomName
boolean hasCustomName() -
getEntityName
String getEntityName()- Returns:
- Returns the original name incase a custom name has been set
-