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 TypeMethodDescriptionvoidvoidvoidvoiddamage(float amount) voidvoiddespawn()Despawns this entity.dropItem(IItemStack item) voidRemoves fire from this entitylonggetAge()IEntity[]intintintThis is not a function you should be calling every tick.floatfloatExpert users onlydoubledoubledoublegetMount()getName()getNbt()The Entity's extra stored NBT datafloatgetPitch()getPos()IEntity[]floatStored 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 reloadedintgetType()getUUID()floatgetWidth()getWorld()doublegetX()doublegetY()doublegetZ()booleanbooleanbooleaninFire()booleaninLava()booleaninWater()booleanisAlive()booleanbooleanbooleanvoidkill()Kill the entity, doesnt't despawn itvoidknockback(int power, float direction) voidplayAnimation(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 distancevoidvoidsetBurning(int seconds) voidsetEntityNbt(INbt nbt) This is not a function you should be calling every tickvoidsetMotionX(double motion) voidsetMotionY(double motion) voidsetMotionZ(double motion) voidvoidvoidsetPitch(float pitch) voidvoidsetPosition(double x, double y, double z) voidsetRotation(float rotation) voidsetX(double x) voidsetY(double y) voidsetZ(double z) voidspawn()Spawns this entity into the world (For NPCs dont forget to set their home position)voidstoreAsClone(int tab, String name) Stores the entity as clone server sidebooleantypeOf(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
EntitiesTypeof this entity
-
typeOf
boolean typeOf(int type) - Parameters:
type-EntitiesTypeto 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
-