Class Entity
- All Implemented Interfaces:
Metadatable
,Cloneable
- Direct Known Subclasses:
EntityAreaEffectCloud
,EntityArmorStand
,EntityEndCrystal
,EntityFallingBlock
,EntityFirework
,EntityHanging
,EntityItem
,EntityLightning
,EntityLiving
,EntityPrimedTNT
,EntityProjectile
,EntityVehicle
,EntityXPOrb
- Author:
- MagicDroidX
-
Field Summary
Modifier and TypeFieldDescriptionprotected float
protected int
boolean
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
Deprecated.static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
Deprecated.This is from NukkitX but it has a typo which we can't remove unless NukkitX removes from their side.static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
Deprecated.static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
protected final EntityMetadata
int
static final Entity[]
double
static long
protected UUID
float
boolean
int
boolean
int
double
protected float
double
protected long
boolean
protected boolean
int
boolean
boolean
boolean
boolean
protected boolean
protected boolean
boolean
boolean
Player do not useprotected EntityDamageEvent
double
double
double
double
double
int
double
double
double
double
int
boolean
double
double
double
static final int
boolean
int
final AxisAlignedBB
boolean
double
boolean
这个实体骑在谁身上protected boolean
float
protected Server
临时向量,其值没有任何含义int
double
protected float
Player do not use -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
void
addFreezingTicks
(int increments) void
addMotion
(double motionX, double motionY, double motionZ) void
addMovement
(double x, double y, double z, double yaw, double pitch, double headYaw) 增加运动 (仅发送数据包,如果需要请使用setMotion(cn.nukkit.math.Vector3)
)void
void
applyEntityCollision
(Entity entity) boolean
attack
(float damage) boolean
attack
(EntityDamageEvent source) 当一个实体被攻击时(即接受一个实体伤害事件 这个事件可以是由其他实体攻击导致,也可能是自然伤害)调用.protected void
broadcastLinkPacket
(Entity rider, byte type) protected void
boolean
Returns whether this entity can be moved by currents in liquids.boolean
boolean
boolean
canClimb()
boolean
boolean
boolean
canCollideWith
(Entity entity) boolean
boolean
protected void
protected void
protected void
checkGroundState
(double movX, double movY, double movZ, double dx, double dy, double dz) protected boolean
checkObstruction
(double x, double y, double z) void
close()
<T extends Block>
booleancollideWithBlock
(Class<T> classType) boolean
containTag
(String tag) protected DataPacket
static Entity
createEntity
(int type, FullChunk chunk, CompoundTag nbt, Object... args) 创建一个实体从网络idstatic Entity
createEntity
(int type, Position pos, Object... args) 创建一个实体从网络idstatic Entity
createEntity
(Identifier identifier, Position pos, Object... args) 从mc标准实体标识符创建实体,形如(minecraft:sheep)static Entity
createEntity
(String name, FullChunk chunk, CompoundTag nbt, Object... args) static Entity
createEntity
(String name, Position pos, Object... args) 创建一个实体从实体名,名称从registerEntities
源代码查询void
despawnFrom
(Player player) void
boolean
dismountEntity
(Entity entity) boolean
dismountEntity
(Entity entity, boolean sendLinks) boolean
Whether the entity can active pressure plates.boolean
boolean
boolean
entityBaseTick
(int tickDiff) boolean
void
void
fall
(float fallDistance) boolean
fastMove
(double dx, double dy, double dz) float
int
getAge()
protected float
float
boolean
getDataFlag
(int propertyId, int id) getDataProperty
(int id) boolean
getDataPropertyBoolean
(int id) int
getDataPropertyByte
(int id) float
getDataPropertyFloat
(int id) int
getDataPropertyInt
(int id) long
getDataPropertyLong
(int id) getDataPropertyNBT
(int id) getDataPropertyPos
(int id) int
getDataPropertyShort
(int id) getDataPropertyString
(int id) int
getDataPropertyType
(int id) getDataPropertyVector3f
(int id) static CompoundTag
getDefaultNBT
(Vector3 pos) static CompoundTag
getDefaultNBT
(Vector3 pos, Vector3 motion) static CompoundTag
getDefaultNBT
(Vector3 pos, Vector3 motion, float yaw, float pitch) 获得该实体的默认NBT,带有位置,motion,yaw pitch等信息protected float
getDrag()
getEffect
(int effectId) static Set<CustomEntityDefinition>
获取全部自定义实体定义的拷贝float
float
int
int
protected float
float
float
实体高度long
getId()
获取该实体的标识符static Identifier
getIdentifier
(int networkID) 获取指定网络id实体的标识符Deprecated.static it.unimi.dsi.fastutil.ints.IntCollection
获得全部实体的网络idstatic Map<String,
EntityProvider<? extends Entity>> Deprecated.float
int
getMetadata
(String metadataKey) getMountedOffset
(Entity entity) getName()
The current name used by this entity in the name tag, or the static name if the entity don't have nametag.abstract int
获得该实体的网络IDThe name that English name of the type of this entity.final String
static String
getSaveId
(int id) 从网络id 查询该实体的Name,对应knownEntities
keystatic OptionalInt
从key id 查询该实体的网络id,knownEntities
获取全部已经注册的实体提供者float
getScale()
protected double
float
final String
Similar togetName()
, but if the name is blank or empty it returns the static name instead.float
getWidth()
void
boolean
boolean
boolean
hasEffect
(int effectId) int
hashCode()
boolean
hasMetadata
(String metadataKey) boolean
hasWaterAt
(float height) protected boolean
hasWaterAt
(float height, boolean tickCached) void
heal
(float amount) void
heal
(EntityRegainHealthEvent source) static void
init()
protected final void
init
(FullChunk chunk, CompoundTag nbt) protected void
实体初始化顺序,先初始化Entity类字段->Entity构造函数->进入init方法->调用initEntity方法->子类字段初始化->子类构造函数boolean
isAlive()
boolean
isBoss()
boolean
isClosed()
boolean
isControlling
(Entity entity) boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
isNoClip()
boolean
isOnFire()
boolean
boolean
boolean
isPassenger
(Entity entity) boolean
isPreventingSleep
(Player player) boolean
boolean
boolean
boolean
boolean
boolean
isUndead()
boolean
void
kill()
boolean
mountEntity
(Entity entity) boolean
mountEntity
(Entity entity, byte mode) Mount an Entity from a/into vehicleboolean
move
(double dx, double dy, double dz) void
moveFlying
(float strafe, float forward, float friction) void
onCollideWithPlayer
(EntityHuman entityPlayer) boolean
onInteract
(Player player, Item item) boolean
onInteract
(Player player, Item item, Vector3 clickedPos) protected boolean
onPhysicalInteraction
(Block block, boolean cancelled) void
onPushByPiston
(BlockEntityPistonArm piston) void
onStruckByLightning
(Entity entity) boolean
onUpdate
(int currentTick) void
playActionAnimation
(AnimatePacket.Action action, float rowingTime) void
playActionAnimation
(AnimatePacket.Action action, float rowingTime, Collection<Player> players) Play the action animation of this entity to a specified group of playersvoid
playAnimation
(AnimateEntityPacket.Animation animation) void
playAnimation
(AnimateEntityPacket.Animation animation, Collection<Player> players) Play the animation of this entity to a specified group of playersstatic void
playAnimationOnEntities
(AnimateEntityPacket.Animation animation, Collection<Entity> entities) static void
playAnimationOnEntities
(AnimateEntityPacket.Animation animation, Collection<Entity> entities, Collection<Player> players) Batch play animation on entity groups
This method is recommended if you need to play the same animation on a large number of entities at the same time, as it only sends packets once for each player, which greatly reduces bandwidth pressurevoid
void
recalculateBoundingBox
(boolean send) protected void
static OK<?>
registerCustomEntity
(CustomEntityProvider customEntityProvider) 注册一个自定义实体static boolean
registerEntity
(EntityProvider<? extends Entity> provider) static boolean
registerEntity
(EntityProvider<? extends Entity> provider, boolean force) 注册一个实体,仅供内部使用,自定义实体请使用registerCustomEntity
static boolean
registerEntity
(String name, Class<? extends Entity> clazz) static boolean
registerEntity
(String name, Class<? extends Entity> clazz, boolean force) 注册一个实体,仅供内部使用,自定义实体请使用registerCustomEntity
void
void
removeEffect
(int effectId) void
removeMetadata
(String metadataKey, Plugin owningPlugin) void
void
void
void
saveNBT()
final void
void
void
void
sendData
(Player[] players, EntityMetadata data) void
sendData
(Player player, EntityMetadata data) void
sendPotionEffects
(Player player) void
setAbsorption
(float absorption) void
setAmbientSoundEvent
(Sound sound) void
setAmbientSoundEventName
(String eventName) void
setAmbientSoundInterval
(float interval) void
setAmbientSoundIntervalRange
(float range) final boolean
setBooleanEntityProperty
(String identifier, boolean value) void
setCanBeSavedWithChunk
(boolean saveWithChunk) void
void
setCanClimb
(boolean value) void
void
setCanClimbWalls
(boolean value) void
setDataFlag
(int propertyId, int id) void
setDataFlag
(int propertyId, int id, boolean value) boolean
setDataProperty
(EntityData data) boolean
setDataProperty
(EntityData data, boolean send) final boolean
setEnumEntityProperty
(String identifier, String value) final boolean
setFloatEntityProperty
(String identifier, float value) void
setFreezingEffectStrength
(float strength) void
setFreezingTicks
(int ticks) void
void
setGliding
(boolean value) void
setHealth
(float health) void
void
setImmobile
(boolean value) final boolean
setIntEntityProperty
(String identifier, int value) void
void
setMaxHealth
(int maxHealth) void
setMetadata
(String metadataKey, MetadataValue newMetadataValue) boolean
设置一个运动向量(会使得实体移动这个向量的距离,非精准移动)void
setNameTag
(String name) void
void
setNameTagAlwaysVisible
(boolean value) void
void
setNameTagVisible
(boolean value) void
setNoClip
(boolean noClip) void
setOnFire
(int seconds) boolean
setPosition
(Vector3 pos) boolean
setPositionAndRotation
(Vector3 pos, double yaw, double pitch) boolean
setPositionAndRotation
(Vector3 pos, double yaw, double pitch, double headYaw) Sets position and rotation.void
setRotation
(double yaw, double pitch) void
setRotation
(double yaw, double pitch, double headYaw) void
setScale
(float scale) void
setScoreTag
(String score) void
setSeatPosition
(Vector3f pos) void
void
setSneaking
(boolean value) void
void
setSpinAttacking
(boolean value) void
void
setSprinting
(boolean value) void
void
setSwimming
(boolean value) void
将这个实体在客户端生成,让该玩家可以看到它void
protected boolean
switchLevel
(Level targetLevel) boolean
boolean
teleport
(Location location, PlayerTeleportEvent.TeleportCause cause) boolean
boolean
teleport
(Position pos, PlayerTeleportEvent.TeleportCause cause) boolean
boolean
teleport
(Vector3 pos, PlayerTeleportEvent.TeleportCause cause) protected void
updateFallState
(boolean onGround) void
protected void
updatePassengerPosition
(Entity passenger) void
Methods inherited from class cn.nukkit.level.Location
abs, add, add, add, add, ceil, clone, divide, floor, fromObject, fromObject, fromObject, fromObject, fromObject, getHeadYaw, getPitch, getYaw, multiply, round, setHeadYaw, setPitch, setX, setY, setYaw, setZ, subtract, subtract, subtract, subtract, subtract, toString
Methods inherited from class cn.nukkit.level.Position
getChunk, getLevel, getLevelBlock, getLevelBlock, getLevelBlock, getLevelBlock, getLevelBlockAround, getLevelBlockAtLayer, getLevelBlockEntity, getLevelBlockState, getLevelBlockState, getLevelName, getSide, getSide, getSidePos, getTickCachedLevelBlock, getTickCachedLevelBlockAtLayer, getTypedBlockEntity, getValidLevel, isValid, setComponents, setComponents, setLevel, setStrong, setWeak
Methods inherited from class cn.nukkit.positiontracking.NamedPosition
matchesNamedPosition
Methods inherited from class cn.nukkit.math.Vector3
asBlockVector3, asVector3f, cross, distance, distance, distanceManhattan, distanceSquared, distanceSquared, dot, down, down, east, east, getAxis, getChunkSectionY, getChunkVector, getChunkX, getChunkZ, getFloorX, getFloorY, getFloorZ, getForward, getIntermediateWithXValue, getIntermediateWithYValue, getIntermediateWithZValue, getRight, getSideVec, getSouth, getUp, getWest, getX, getY, getZ, length, lengthSquared, maxPlainDistance, maxPlainDistance, maxPlainDistance, maxPlainDistance, maxPlainDistance, normalize, north, north, rawHashCode, setComponentsAdding, setComponentsAdding, south, south, up, up, west, west
-
Field Details
-
EMPTY_ARRAY
-
NETWORK_ID
public static final int NETWORK_ID- See Also:
-
DATA_TYPE_BYTE
public static final int DATA_TYPE_BYTE- See Also:
-
DATA_TYPE_SHORT
public static final int DATA_TYPE_SHORT- See Also:
-
DATA_TYPE_INT
public static final int DATA_TYPE_INT- See Also:
-
DATA_TYPE_FLOAT
public static final int DATA_TYPE_FLOAT- See Also:
-
DATA_TYPE_STRING
public static final int DATA_TYPE_STRING- See Also:
-
DATA_TYPE_NBT
public static final int DATA_TYPE_NBT- See Also:
-
DATA_TYPE_POS
public static final int DATA_TYPE_POS- See Also:
-
DATA_TYPE_LONG
public static final int DATA_TYPE_LONG- See Also:
-
DATA_TYPE_VECTOR3F
public static final int DATA_TYPE_VECTOR3F- See Also:
-
DATA_FLAGS
public static final int DATA_FLAGS -
DATA_HEALTH
public static final int DATA_HEALTH -
DATA_VARIANT
public static final int DATA_VARIANT -
DATA_COLOR
public static final int DATA_COLOR -
DATA_COLOUR
public static final int DATA_COLOUR -
DATA_NAMETAG
public static final int DATA_NAMETAG -
DATA_OWNER_EID
public static final int DATA_OWNER_EID -
DATA_TARGET_EID
public static final int DATA_TARGET_EID -
DATA_AIR
public static final int DATA_AIR -
DATA_POTION_COLOR
public static final int DATA_POTION_COLOR -
DATA_POTION_AMBIENT
public static final int DATA_POTION_AMBIENT -
DATA_JUMP_DURATION
public static final int DATA_JUMP_DURATION -
DATA_HURT_TIME
public static final int DATA_HURT_TIME -
DATA_HURT_DIRECTION
public static final int DATA_HURT_DIRECTION -
DATA_PADDLE_TIME_LEFT
public static final int DATA_PADDLE_TIME_LEFT -
DATA_PADDLE_TIME_RIGHT
public static final int DATA_PADDLE_TIME_RIGHT -
DATA_EXPERIENCE_VALUE
public static final int DATA_EXPERIENCE_VALUE -
DATA_DISPLAY_ITEM
public static final int DATA_DISPLAY_ITEM -
DATA_DISPLAY_OFFSET
public static final int DATA_DISPLAY_OFFSET -
DATA_HAS_DISPLAY
public static final int DATA_HAS_DISPLAY -
DATA_SWELL
-
DATA_OLD_SWELL
-
DATA_SWELL_DIR
-
DATA_CHARGE_AMOUNT
-
DATA_ENDERMAN_HELD_RUNTIME_ID
public static final int DATA_ENDERMAN_HELD_RUNTIME_ID -
DATA_CLIENT_EVENT
-
DATA_ENTITY_AGE
@Deprecated @DeprecationDetails(since="1.4.0.0-PN", by="PowerNukkit", reason="Apparently this the ID 24 was reused to represent CLIENT_EVENT but Cloudburst Nukkit is still mapping it as age") public static final int DATA_ENTITY_AGEDeprecated. -
DATA_PLAYER_FLAG_SLEEP
public static final int DATA_PLAYER_FLAG_SLEEP- See Also:
-
DATA_PLAYER_FLAG_DEAD
public static final int DATA_PLAYER_FLAG_DEAD- See Also:
-
DATA_USING_ITEM
-
DATA_PLAYER_FLAGS
public static final int DATA_PLAYER_FLAGS -
DATA_PLAYER_INDEX
-
DATA_PLAYER_BED_POSITION
public static final int DATA_PLAYER_BED_POSITION -
DATA_PLAYER_BUTTON_TEXT
public static final int DATA_PLAYER_BUTTON_TEXT- See Also:
-
DATA_FIREBALL_POWER_X
public static final int DATA_FIREBALL_POWER_X -
DATA_FIREBALL_POWER_Y
public static final int DATA_FIREBALL_POWER_Y -
DATA_FIREBALL_POWER_Z
public static final int DATA_FIREBALL_POWER_Z -
DATA_AUX_POWER
-
DATA_FISH_X
-
DATA_FISH_Z
-
DATA_FISH_ANGLE
-
DATA_POTION_AUX_VALUE
public static final int DATA_POTION_AUX_VALUE -
DATA_LEAD_HOLDER_EID
public static final int DATA_LEAD_HOLDER_EID -
DATA_SCALE
public static final int DATA_SCALE -
DATA_HAS_NPC_COMPONENT
-
DATA_NPC_SKIN_DATA
public static final int DATA_NPC_SKIN_DATA -
DATA_NPC_ACTIONS
public static final int DATA_NPC_ACTIONS -
DATA_MAX_AIR
public static final int DATA_MAX_AIR -
DATA_MARK_VARIANT
public static final int DATA_MARK_VARIANT -
DATA_CONTAINER_TYPE
public static final int DATA_CONTAINER_TYPE -
DATA_CONTAINER_BASE_SIZE
public static final int DATA_CONTAINER_BASE_SIZE -
DATA_CONTAINER_EXTRA_SLOTS_PER_STRENGTH
public static final int DATA_CONTAINER_EXTRA_SLOTS_PER_STRENGTH -
DATA_BLOCK_TARGET
public static final int DATA_BLOCK_TARGET -
DATA_WITHER_INVULNERABLE_TICKS
public static final int DATA_WITHER_INVULNERABLE_TICKS -
DATA_WITHER_TARGET_1
public static final int DATA_WITHER_TARGET_1 -
DATA_WITHER_TARGET_2
public static final int DATA_WITHER_TARGET_2 -
DATA_WITHER_TARGET_3
public static final int DATA_WITHER_TARGET_3 -
DATA_AERIAL_ATTACK
-
DATA_BOUNDING_BOX_WIDTH
public static final int DATA_BOUNDING_BOX_WIDTH -
DATA_BOUNDING_BOX_HEIGHT
public static final int DATA_BOUNDING_BOX_HEIGHT -
DATA_FUSE_LENGTH
public static final int DATA_FUSE_LENGTH -
DATA_RIDER_SEAT_POSITION
public static final int DATA_RIDER_SEAT_POSITION -
DATA_RIDER_ROTATION_LOCKED
public static final int DATA_RIDER_ROTATION_LOCKED -
DATA_RIDER_MAX_ROTATION
public static final int DATA_RIDER_MAX_ROTATION -
DATA_RIDER_MIN_ROTATION
public static final int DATA_RIDER_MIN_ROTATION -
DATA_RIDER_ROTATION_OFFSET
-
DATA_AREA_EFFECT_CLOUD_RADIUS
public static final int DATA_AREA_EFFECT_CLOUD_RADIUS -
DATA_AREA_EFFECT_CLOUD_WAITING
public static final int DATA_AREA_EFFECT_CLOUD_WAITING -
DATA_AREA_EFFECT_CLOUD_PARTICLE_ID
public static final int DATA_AREA_EFFECT_CLOUD_PARTICLE_ID -
DATA_SHULKER_PEEK_ID
-
DATA_SHULKER_ATTACH_FACE
public static final int DATA_SHULKER_ATTACH_FACE -
DATA_SHULKER_ATTACHED
-
DATA_SHULKER_ATTACH_POS
public static final int DATA_SHULKER_ATTACH_POS -
DATA_TRADING_PLAYER_EID
public static final int DATA_TRADING_PLAYER_EID -
DATA_TRADING_CAREER
-
DATA_HAS_COMMAND_BLOCK
-
DATA_COMMAND_BLOCK_COMMAND
-
DATA_COMMAND_BLOCK_LAST_OUTPUT
public static final int DATA_COMMAND_BLOCK_LAST_OUTPUT -
DATA_COMMAND_BLOCK_TRACK_OUTPUT
public static final int DATA_COMMAND_BLOCK_TRACK_OUTPUT -
DATA_CONTROLLING_RIDER_SEAT_NUMBER
public static final int DATA_CONTROLLING_RIDER_SEAT_NUMBER -
DATA_STRENGTH
public static final int DATA_STRENGTH -
DATA_MAX_STRENGTH
public static final int DATA_MAX_STRENGTH -
DATA_SPELL_CASTING_COLOR
-
DATA_LIMITED_LIFE
public static final int DATA_LIMITED_LIFE -
DATA_ARMOR_STAND_POSE_INDEX
public static final int DATA_ARMOR_STAND_POSE_INDEX -
DATA_ENDER_CRYSTAL_TIME_OFFSET
public static final int DATA_ENDER_CRYSTAL_TIME_OFFSET -
DATA_ALWAYS_SHOW_NAMETAG
public static final int DATA_ALWAYS_SHOW_NAMETAG -
DATA_COLOR_2
public static final int DATA_COLOR_2 -
DATA_NAME_AUTHOR
-
DATA_SCORE_TAG
public static final int DATA_SCORE_TAG -
DATA_BALLOON_ATTACHED_ENTITY
public static final int DATA_BALLOON_ATTACHED_ENTITY -
DATA_PUFFERFISH_SIZE
public static final int DATA_PUFFERFISH_SIZE -
DATA_BUBBLE_TIME
-
DATA_AGENT
-
DATA_SITTING_AMOUNT
-
DATA_SITTING_AMOUNT_PREVIOUS
-
DATA_EATING_COUNTER
-
DATA_FLAGS_EXTENDED
public static final int DATA_FLAGS_EXTENDED -
DATA_LAYING_AMOUNT
-
DATA_LAYING_AMOUNT_PREVIOUS
-
DATA_DURATION
-
DATA_SPAWN_TIME
-
DATA_CHANGE_RATE
-
DATA_CHANGE_ON_PICKUP
-
DATA_PICKUP_COUNT
-
DATA_INTERACTIVE_TAG
-
DATA_INTERACT_TEXT
@PowerNukkitOnly("Removed from Cloudburst Nukkit") @Deprecated @DeprecationDetails(by="Cloudburst Nukkit", reason="Duplicated and removed", replaceWith="DATA_INTERACTIVE_TAG", since="FUTURE") @Since("1.2.0.0-PN") public static final int DATA_INTERACT_TEXTDeprecated. -
DATA_TRADE_TIER
public static final int DATA_TRADE_TIER -
DATA_MAX_TRADE_TIER
public static final int DATA_MAX_TRADE_TIER -
DATA_TRADE_EXPERIENCE
-
DATA_SKIN_ID
-
DATA_SPAWNING_FRAMES
-
DATA_COMMAND_BLOCK_TICK_DELAY
-
DATA_COMMAND_BLOCK_EXECUTE_ON_FIRST_TICK
-
DATA_AMBIENT_SOUND_INTERVAL
-
DATA_AMBIENT_SOUND_INTERVAL_RANGE
-
DATA_AMBIENT_SOUND_EVENT_NAME
-
DATA_FALL_DAMAGE_MULTIPLIER
-
DATA_NAME_RAW_TEXT
-
DATA_CAN_RIDE_TARGET
-
DATA_LOW_TIER_CURED_DISCOUNT
-
DATA_HIGH_TIER_CURED_DISCOUNT
-
DATA_NEARBY_CURED_DISCOUNT
-
DATA_NEARBY_CURED_DISCOUNT_TIMESTAMP
-
DATA_HITBOX
-
DATA_IS_BUOYANT
-
DATA_FREEZING_EFFECT_STRENGTH
-
DATA_BUOYANCY_DATA
-
DATA_GOAT_HORN_COUNT
-
DATA_BASE_RUNTIME_ID
-
DATA_MOVEMENT_SOUND_DISTANCE_OFFSET
public static final int DATA_MOVEMENT_SOUND_DISTANCE_OFFSET -
DATA_HEARTBEAT_INTERVAL_TICKS
public static final int DATA_HEARTBEAT_INTERVAL_TICKS -
DATA_HEARTBEAT_SOUND_EVENT
public static final int DATA_HEARTBEAT_SOUND_EVENT -
DATA_PLAYER_LAST_DEATH_POS
- See Also:
-
DATA_PLAYER_LAST_DEATH_DIMENSION
- See Also:
-
DATA_PLAYER_HAS_DIED
- See Also:
-
DATA_COLLISION_BOX
- See Also:
-
DATA_FLAG_ONFIRE
public static final int DATA_FLAG_ONFIRE -
DATA_FLAG_SNEAKING
public static final int DATA_FLAG_SNEAKING -
DATA_FLAG_RIDING
public static final int DATA_FLAG_RIDING -
DATA_FLAG_SPRINTING
public static final int DATA_FLAG_SPRINTING -
DATA_FLAG_ACTION
public static final int DATA_FLAG_ACTION -
DATA_FLAG_INVISIBLE
public static final int DATA_FLAG_INVISIBLE -
DATA_FLAG_TEMPTED
public static final int DATA_FLAG_TEMPTED -
DATA_FLAG_INLOVE
public static final int DATA_FLAG_INLOVE -
DATA_FLAG_SADDLED
public static final int DATA_FLAG_SADDLED -
DATA_FLAG_POWERED
public static final int DATA_FLAG_POWERED -
DATA_FLAG_IGNITED
public static final int DATA_FLAG_IGNITED -
DATA_FLAG_BABY
public static final int DATA_FLAG_BABY -
DATA_FLAG_CONVERTING
public static final int DATA_FLAG_CONVERTING -
DATA_FLAG_CRITICAL
public static final int DATA_FLAG_CRITICAL -
DATA_FLAG_CAN_SHOW_NAMETAG
public static final int DATA_FLAG_CAN_SHOW_NAMETAG -
DATA_FLAG_ALWAYS_SHOW_NAMETAG
public static final int DATA_FLAG_ALWAYS_SHOW_NAMETAG -
DATA_FLAG_IMMOBILE
public static final int DATA_FLAG_IMMOBILE -
DATA_FLAG_NO_AI
public static final int DATA_FLAG_NO_AI -
DATA_FLAG_SILENT
public static final int DATA_FLAG_SILENT -
DATA_FLAG_WALLCLIMBING
public static final int DATA_FLAG_WALLCLIMBING -
DATA_FLAG_CAN_CLIMB
public static final int DATA_FLAG_CAN_CLIMB -
DATA_FLAG_SWIMMER
public static final int DATA_FLAG_SWIMMER -
DATA_FLAG_CAN_FLY
public static final int DATA_FLAG_CAN_FLY -
DATA_FLAG_WALKER
public static final int DATA_FLAG_WALKER -
DATA_FLAG_RESTING
public static final int DATA_FLAG_RESTING -
DATA_FLAG_SITTING
public static final int DATA_FLAG_SITTING -
DATA_FLAG_ANGRY
public static final int DATA_FLAG_ANGRY -
DATA_FLAG_INTERESTED
public static final int DATA_FLAG_INTERESTED -
DATA_FLAG_CHARGED
public static final int DATA_FLAG_CHARGED -
DATA_FLAG_TAMED
public static final int DATA_FLAG_TAMED -
DATA_FLAG_ORPHANED
public static final int DATA_FLAG_ORPHANED -
DATA_FLAG_LEASHED
public static final int DATA_FLAG_LEASHED -
DATA_FLAG_SHEARED
public static final int DATA_FLAG_SHEARED -
DATA_FLAG_GLIDING
public static final int DATA_FLAG_GLIDING -
DATA_FLAG_ELDER
public static final int DATA_FLAG_ELDER -
DATA_FLAG_MOVING
public static final int DATA_FLAG_MOVING -
DATA_FLAG_BREATHING
public static final int DATA_FLAG_BREATHING -
DATA_FLAG_CHESTED
public static final int DATA_FLAG_CHESTED -
DATA_FLAG_STACKABLE
public static final int DATA_FLAG_STACKABLE -
DATA_FLAG_SHOWBASE
public static final int DATA_FLAG_SHOWBASE -
DATA_FLAG_REARING
public static final int DATA_FLAG_REARING -
DATA_FLAG_VIBRATING
public static final int DATA_FLAG_VIBRATING -
DATA_FLAG_IDLING
public static final int DATA_FLAG_IDLING -
DATA_FLAG_EVOKER_SPELL
public static final int DATA_FLAG_EVOKER_SPELL -
DATA_FLAG_CHARGE_ATTACK
public static final int DATA_FLAG_CHARGE_ATTACK -
DATA_FLAG_WASD_CONTROLLED
public static final int DATA_FLAG_WASD_CONTROLLED -
DATA_FLAG_CAN_POWER_JUMP
public static final int DATA_FLAG_CAN_POWER_JUMP -
DATA_FLAG_CAN_DASH
public static final int DATA_FLAG_CAN_DASH -
DATA_FLAG_LINGER
public static final int DATA_FLAG_LINGER -
DATA_FLAG_HAS_COLLISION
public static final int DATA_FLAG_HAS_COLLISION -
DATA_FLAG_GRAVITY
public static final int DATA_FLAG_GRAVITY -
DATA_FLAG_FIRE_IMMUNE
public static final int DATA_FLAG_FIRE_IMMUNE -
DATA_FLAG_DANCING
public static final int DATA_FLAG_DANCING -
DATA_FLAG_ENCHANTED
public static final int DATA_FLAG_ENCHANTED -
DATA_FLAG_SHOW_TRIDENT_ROPE
public static final int DATA_FLAG_SHOW_TRIDENT_ROPE -
DATA_FLAG_CONTAINER_PRIVATE
public static final int DATA_FLAG_CONTAINER_PRIVATE -
DATA_FLAG_IS_TRANSFORMING
-
DATA_FLAG_SPIN_ATTACK
public static final int DATA_FLAG_SPIN_ATTACK -
DATA_FLAG_SWIMMING
public static final int DATA_FLAG_SWIMMING -
DATA_FLAG_BRIBED
public static final int DATA_FLAG_BRIBED -
DATA_FLAG_PREGNANT
public static final int DATA_FLAG_PREGNANT -
DATA_FLAG_LAYING_EGG
public static final int DATA_FLAG_LAYING_EGG -
DATA_FLAG_RIDER_CAN_PICK
-
DATA_FLAG_TRANSITION_SITTING
-
DATA_FLAG_TRANSITION_SETTING
@Deprecated @DeprecationDetails(reason="This is from NukkitX but it has a typo which we can\'t remove unless NukkitX removes from their side.", since="1.2.0.0-PN", replaceWith="DATA_FLAG_TRANSITION_SITTING") @Since("1.2.0.0-PN") public static final int DATA_FLAG_TRANSITION_SETTINGDeprecated.This is from NukkitX but it has a typo which we can't remove unless NukkitX removes from their side.- See Also:
-
DATA_FLAG_EATING
public static final int DATA_FLAG_EATING -
DATA_FLAG_LAYING_DOWN
public static final int DATA_FLAG_LAYING_DOWN -
DATA_FLAG_SNEEZING
public static final int DATA_FLAG_SNEEZING -
DATA_FLAG_TRUSTING
public static final int DATA_FLAG_TRUSTING -
DATA_FLAG_ROLLING
public static final int DATA_FLAG_ROLLING -
DATA_FLAG_SCARED
public static final int DATA_FLAG_SCARED -
DATA_FLAG_IN_SCAFFOLDING
public static final int DATA_FLAG_IN_SCAFFOLDING -
DATA_FLAG_OVER_SCAFFOLDING
public static final int DATA_FLAG_OVER_SCAFFOLDING -
DATA_FLAG_FALL_THROUGH_SCAFFOLDING
public static final int DATA_FLAG_FALL_THROUGH_SCAFFOLDING -
DATA_FLAG_BLOCKING
public static final int DATA_FLAG_BLOCKING -
DATA_FLAG_TRANSITION_BLOCKING
-
DATA_FLAG_BLOCKED_USING_SHIELD
-
DATA_FLAG_BLOCKED_USING_DAMAGED_SHIELD
-
DATA_FLAG_SLEEPING
-
DATA_FLAG_ENTITY_GROW_UP
-
DATA_FLAG_TRADE_INTEREST
-
DATA_FLAG_DOOR_BREAKER
-
DATA_FLAG_BREAKING_OBSTRUCTION
-
DATA_FLAG_DOOR_OPENER
-
DATA_FLAG_IS_ILLAGER_CAPTAIN
-
DATA_FLAG_STUNNED
-
DATA_FLAG_ROARING
-
DATA_FLAG_DELAYED_ATTACK
-
DATA_FLAG_IS_AVOIDING_MOBS
-
DATA_FLAG_IS_AVOIDING_BLOCKS
-
DATA_FLAG_FACING_TARGET_TO_RANGE_ATTACK
-
DATA_FLAG_HIDDEN_WHEN_INVISIBLE
-
DATA_FLAG_IS_IN_UI
-
DATA_FLAG_STALKING
-
DATA_FLAG_EMOTING
-
DATA_FLAG_CELEBRATING
-
DATA_FLAG_ADMIRING
-
DATA_FLAG_CELEBRATING_SPECIAL
-
DATA_FLAG_RAM_ATTACK
-
DATA_FLAG_PLAYING_DEAD
-
DATA_FLAG_IN_ASCENDABLE_BLOCK
-
DATA_FLAG_OVER_DESCENDABLE_BLOCK
-
DATA_FLAG_CROAKING
-
DATA_FLAG_EAT_MOB
-
DATA_FLAG_JUMP_GOAL_JUMP
-
DATA_FLAG_EMERGING
-
DATA_FLAG_SNIFFING
-
DATA_FLAG_DIGGING
-
DATA_FLAG_SONIC_BOOM
-
DATA_FLAG_HAS_DASH_COOLDOWN
-
DATA_FLAG_PUSH_TOWARDS_CLOSEST_SPACE
-
DATA_FLAG_SCENTING
-
DATA_FLAG_RISING
-
DATA_FLAG_FEELING_HAPPY
-
DATA_FLAG_SEARCHING
-
DATA_FLAG_CRAWLING
-
entityCount
public static long entityCount -
passengers
-
offsetBoundingBox
-
hasSpawned
-
effects
-
dataProperties
-
riding
这个实体骑在谁身上Who is this entity riding on
-
chunk
-
blocksAround
-
collisionBlocks
-
lastX
public double lastX -
lastY
public double lastY -
lastZ
public double lastZ -
firstMove
public boolean firstMove -
motionX
public double motionX -
motionY
public double motionY -
motionZ
public double motionZ -
temporalVector
临时向量,其值没有任何含义 -
lastMotionX
public double lastMotionX -
lastMotionY
public double lastMotionY -
lastMotionZ
public double lastMotionZ -
lastPitch
public double lastPitch -
lastYaw
-
lastHeadYaw
-
pitchDelta
public double pitchDelta -
yawDelta
-
headYawDelta
-
entityCollisionReduction
public double entityCollisionReduction -
boundingBox
-
onGround
public boolean onGround -
inBlock
public boolean inBlock -
positionChanged
public boolean positionChanged -
motionChanged
public boolean motionChanged -
deadTicks
public int deadTicks -
keepMovement
public boolean keepMovementPlayer do not use -
fallDistance
public float fallDistance -
ticksLived
public int ticksLived -
lastUpdate
public int lastUpdate -
maxFireTicks
public int maxFireTicks -
fireTicks
public int fireTicks -
inPortalTicks
public int inPortalTicks -
freezingTicks
-
scale
public float scale -
namedTag
-
isCollided
public boolean isCollided -
isCollidedHorizontally
public boolean isCollidedHorizontally -
isCollidedVertically
public boolean isCollidedVertically -
noDamageTicks
public int noDamageTicks -
justCreated
public boolean justCreated -
fireProof
public boolean fireProof -
invulnerable
public boolean invulnerable -
highestPosition
public double highestPosition -
closed
public boolean closed -
noClip
-
entityUniqueId
-
id
protected long id -
lastDamageCause
-
age
protected int age -
health
protected float health -
absorption
protected float absorption -
ySize
protected float ySizePlayer do not use -
inEndPortal
-
isStatic
protected boolean isStatic -
server
-
isPlayer
protected boolean isPlayer -
saveWithChunk
-
-
Constructor Details
-
Entity
-
-
Method Details
-
createEntity
@PowerNukkitXOnly @Since("1.19.60-r1") @Nullable public static Entity createEntity(Identifier identifier, @NotNull Position pos, @Nullable Object... args) 从mc标准实体标识符创建实体,形如(minecraft:sheep)Create an entity from the entity identifier, like (minecraft:sheep)
- Parameters:
identifier
- the identifierpos
- the posargs
- the args- Returns:
- the entity
-
createEntity
@Nullable public static Entity createEntity(@NotNull String name, @NotNull Position pos, @Nullable Object... args) 创建一个实体从实体名,名称从registerEntities
源代码查询Create an entity from entity name, name from
registerEntities
source code query- Parameters:
name
- the namepos
- the posargs
- the args- Returns:
- the entity
-
createEntity
@Nullable public static Entity createEntity(int type, @NotNull Position pos, @Nullable Object... args) 创建一个实体从网络idCreate an entity from the network id
- Parameters:
type
- 网络ID
network idpos
- the posargs
- the args- Returns:
- the entity
-
createEntity
@Nullable public static Entity createEntity(int type, @NotNull FullChunk chunk, @NotNull CompoundTag nbt, @Nullable Object... args) 创建一个实体从网络idCreate an entity from the network id
- Parameters:
type
- 网络ID
network idchunk
- the chunknbt
- the nbtargs
- the args- Returns:
- the entity
-
createEntity
@Nullable public static Entity createEntity(@NotNull String name, @NotNull FullChunk chunk, @NotNull CompoundTag nbt, @Nullable Object... args) -
registerEntity
-
registerEntity
@PowerNukkitXDifference(since="1.19.21-r1", info="Use internal provider instead.") public static boolean registerEntity(String name, Class<? extends Entity> clazz, boolean force) 注册一个实体,仅供内部使用,自定义实体请使用registerCustomEntity
Register an entity for internal use only, for custom entities please use
registerCustomEntity
- Parameters:
name
- the nameclazz
- the clazzforce
- the force- Returns:
- the boolean
-
registerEntity
@PowerNukkitXOnly @Since("1.19.21-r2") public static boolean registerEntity(EntityProvider<? extends Entity> provider) -
registerEntity
@PowerNukkitXOnly @Since("1.19.21-r2") public static boolean registerEntity(EntityProvider<? extends Entity> provider, boolean force) 注册一个实体,仅供内部使用,自定义实体请使用registerCustomEntity
Register an entity for internal use only, for custom entities please use
registerCustomEntity
- Parameters:
provider
- the providerforce
- the force- Returns:
- the boolean
-
getEntityDefinitions
获取全部自定义实体定义的拷贝Get a copy of all custom entity definitions
- Returns:
- the entity definitions
-
registerCustomEntity
@PowerNukkitXOnly @Since("1.19.21-r2") public static OK<?> registerCustomEntity(CustomEntityProvider customEntityProvider) 注册一个自定义实体Register a custom entity
- Parameters:
customEntityProvider
- the custom entity provider- Returns:
- the ok
-
getKnownEntityIds
@NotNull @PowerNukkitOnly @Since("1.5.1.0-PN") public static it.unimi.dsi.fastutil.ints.IntCollection getKnownEntityIds()获得全部实体的网络idGet the network id of all entities
- Returns:
- the known entity ids
-
getKnownEntities
@NotNull @PowerNukkitXOnly @Since("1.19.20-r4") @Deprecated public static Map<String,Class<? extends Entity>> getKnownEntities()Deprecated.获取全部已经注册的实体,包括自定义实体Get all registered entities, including custom entities
- Returns:
- the known entities
-
getKnownEntityProviders
@NotNull @PowerNukkitXOnly @Since("1.19.20-r4") @Deprecated public static Map<String,EntityProvider<? extends Entity>> getKnownEntityProviders()Deprecated. -
getSaveIds
获取全部已经注册的实体提供者Get all registered entity providers
- Returns:
- the known entity providers
-
getSaveId
从key id 查询该实体的网络id,knownEntities
Query the network id of the entity from the key id,
knownEntities
- Parameters:
id
- the id- Returns:
- the save id
-
getSaveId
从网络id 查询该实体的Name,对应knownEntities
keyQuery the name of the entity from its network id, corresponding to
knownEntities
key- Parameters:
id
- the id- Returns:
- the save id
-
getIdentifier
获取指定网络id实体的标识符Get the identifier of the specified network id entity
- Returns:
- the identifier
-
getDefaultNBT
-
getDefaultNBT
-
getDefaultNBT
@NotNull public static CompoundTag getDefaultNBT(@NotNull Vector3 pos, @Nullable Vector3 motion, float yaw, float pitch) 获得该实体的默认NBT,带有位置,motion,yaw pitch等信息Get the default NBT of the entity, with information such as position, motion, yaw pitch, etc.
- Parameters:
pos
- the posmotion
- the motionyaw
- the yawpitch
- the pitch- Returns:
- the default nbt
-
playAnimationOnEntities
@PowerNukkitXOnly @Since("1.19.50-r3") public static void playAnimationOnEntities(AnimateEntityPacket.Animation animation, Collection<Entity> entities, Collection<Player> players) Batch play animation on entity groups
This method is recommended if you need to play the same animation on a large number of entities at the same time, as it only sends packets once for each player, which greatly reduces bandwidth pressure在实体群上批量播放动画
若你需要同时在大量实体上播放同一动画,建议使用此方法,因为此方法只会针对每个玩家发送一次包,这能极大地缓解带宽压力- Parameters:
animation
- 动画对象 Animation objectsentities
- 需要播放动画的实体群 Group of entities that need to play animationsplayers
- 可视玩家 Visible Player
-
playAnimationOnEntities
@PowerNukkitXOnly @Since("1.19.50-r3") public static void playAnimationOnEntities(AnimateEntityPacket.Animation animation, Collection<Entity> entities) -
init
-
getIdentifier
获取该实体的标识符Get the identifier of the entity
- Returns:
- the identifier
-
getNetworkId
public abstract int getNetworkId()获得该实体的网络IDGet the network ID of the entity
- Returns:
- the network id
-
getHeight
public float getHeight()实体高度entity Height
- Returns:
- the height
-
getCurrentHeight
-
getEyeHeight
public float getEyeHeight() -
getWidth
public float getWidth() -
getLength
public float getLength() -
getStepHeight
protected double getStepHeight() -
canCollide
public boolean canCollide() -
getGravity
protected float getGravity() -
getDrag
protected float getDrag() -
getBaseOffset
protected float getBaseOffset() -
getFrostbiteInjury
-
initEntity
protected void initEntity()实体初始化顺序,先初始化Entity类字段->Entity构造函数->进入init方法->调用initEntity方法->子类字段初始化->子类构造函数用于初始化实体的NBT和实体字段的方法
Entity initialization order, first initialize the Entity class field->Entity constructor->Enter the init method->Call the init Entity method-> subclass field initialization-> subclass constructor
The method used to initialize the NBT and entity fields of the entity
-
init
-
hasCustomName
public boolean hasCustomName() -
getNameTag
-
setNameTag
-
isNameTagVisible
public boolean isNameTagVisible() -
setNameTagVisible
public void setNameTagVisible(boolean value) -
isNameTagAlwaysVisible
public boolean isNameTagAlwaysVisible() -
setNameTagAlwaysVisible
public void setNameTagAlwaysVisible(boolean value) -
setNameTagVisible
public void setNameTagVisible() -
setNameTagAlwaysVisible
public void setNameTagAlwaysVisible() -
getScoreTag
-
setScoreTag
-
isSneaking
public boolean isSneaking() -
setSneaking
public void setSneaking(boolean value) -
setSneaking
public void setSneaking() -
isSwimming
public boolean isSwimming() -
setSwimming
public void setSwimming(boolean value) -
getSwimmingHeight
-
setSwimming
public void setSwimming() -
isSprinting
public boolean isSprinting() -
setSprinting
public void setSprinting(boolean value) -
setSprinting
public void setSprinting() -
isGliding
public boolean isGliding() -
setGliding
public void setGliding(boolean value) -
setGliding
public void setGliding() -
isImmobile
public boolean isImmobile() -
setImmobile
public void setImmobile(boolean value) -
setImmobile
public void setImmobile() -
canClimb
public boolean canClimb() -
setCanClimb
public void setCanClimb() -
setCanClimb
public void setCanClimb(boolean value) -
canClimbWalls
public boolean canClimbWalls() -
setCanClimbWalls
public void setCanClimbWalls() -
setCanClimbWalls
public void setCanClimbWalls(boolean value) -
getScale
public float getScale() -
setScale
public void setScale(float scale) -
getPassengers
-
getPassenger
-
isPassenger
-
isControlling
-
hasControllingPassenger
public boolean hasControllingPassenger() -
getRiding
-
getEffects
-
removeAllEffects
public void removeAllEffects() -
removeEffect
public void removeEffect(int effectId) -
getEffect
-
hasEffect
public boolean hasEffect(int effectId) -
addEffect
-
recalculateBoundingBox
public void recalculateBoundingBox() -
recalculateBoundingBox
public void recalculateBoundingBox(boolean send) -
recalculateEffectColor
protected void recalculateEffectColor() -
saveNBT
public void saveNBT() -
getOriginalName
The name that English name of the type of this entity. -
getVisibleName
Similar togetName()
, but if the name is blank or empty it returns the static name instead. -
getName
The current name used by this entity in the name tag, or the static name if the entity don't have nametag. -
getSaveId
-
spawnTo
将这个实体在客户端生成,让该玩家可以看到它Spawn this entity on the client side so that the player can see it
- Parameters:
player
- the player
-
createAddEntityPacket
-
getViewers
-
sendPotionEffects
-
sendData
-
sendData
-
sendData
-
sendData
-
despawnFrom
-
attack
当一个实体被攻击时(即接受一个实体伤害事件 这个事件可以是由其他实体攻击导致,也可能是自然伤害)调用.Called when an entity is attacked (i.e. receives an entity damage event. This event can be caused by an attack by another entity, or it can be a natural damage).
- Parameters:
source
- 记录伤害源的事件
Record the event of the source of the attack- Returns:
- 是否攻击成功
Whether the attack was successful
-
attack
public boolean attack(float damage) -
getAge
-
heal
-
heal
public void heal(float amount) -
getHealth
public float getHealth() -
setHealth
public void setHealth(float health) -
isAlive
public boolean isAlive() -
isClosed
public boolean isClosed() -
getLastDamageCause
-
setLastDamageCause
-
getMaxHealth
public int getMaxHealth() -
setMaxHealth
public void setMaxHealth(int maxHealth) -
canCollideWith
-
canBeSavedWithChunk
-
setCanBeSavedWithChunk
-
checkObstruction
protected boolean checkObstruction(double x, double y, double z) -
entityBaseTick
public boolean entityBaseTick() -
entityBaseTick
public boolean entityBaseTick(int tickDiff) -
updateMovement
@PowerNukkitDifference(since="1.6.0.0-PNX", info="add support for the new movement packet MoveEntityDeltaPacket") public void updateMovement() -
enableHeadYaw
-
addMovement
public void addMovement(double x, double y, double z, double yaw, double pitch, double headYaw) 增加运动 (仅发送数据包,如果需要请使用setMotion(cn.nukkit.math.Vector3)
)Add motion (just sending packet will not make the entity actually move, use
setMotion(cn.nukkit.math.Vector3)
if needed)- Parameters:
x
- xy
- yz
- zyaw
- 左右旋转pitch
- 上下旋转headYaw
- headYaw
-
addMotion
public void addMotion(double motionX, double motionY, double motionZ) -
broadcastMovement
-
getDirectionVector
@PowerNukkitXDifference(info="There is no need to set the temporalVector, because the result is prone to change in an asynchronous environment.") public Vector3 getDirectionVector()- Overrides:
getDirectionVector
in classLocation
-
getDirectionPlane
-
getHorizontalFacing
-
onUpdate
public boolean onUpdate(int currentTick) -
mountEntity
-
mountEntity
Mount an Entity from a/into vehicle- Parameters:
entity
- The target Entity- Returns:
true
if the mounting successful
-
dismountEntity
-
dismountEntity
-
broadcastLinkPacket
-
updatePassengers
public void updatePassengers() -
updatePassengerPosition
-
getSeatPosition
-
setSeatPosition
-
getMountedOffset
-
scheduleUpdate
public final void scheduleUpdate() -
isOnFire
public boolean isOnFire() -
setOnFire
public void setOnFire(int seconds) -
getAbsorption
public float getAbsorption() -
setAbsorption
public void setAbsorption(float absorption) -
canBePushed
-
getDirection
-
extinguish
public void extinguish() -
canTriggerWalking
public boolean canTriggerWalking() -
resetFallDistance
-
updateFallState
protected void updateFallState(boolean onGround) -
getBoundingBox
-
fall
public void fall(float fallDistance) -
onPhysicalInteraction
@PowerNukkitXDifference(info="change to protected") protected boolean onPhysicalInteraction(Block block, boolean cancelled) -
handleLavaMovement
public void handleLavaMovement() -
moveFlying
public void moveFlying(float strafe, float forward, float friction) -
onCollideWithPlayer
-
applyEntityCollision
-
onStruckByLightning
-
onPushByPiston
-
onInteract
-
onInteract
-
switchLevel
-
getPosition
-
getLocation
- Overrides:
getLocation
in classLocation
-
isTouchingWater
-
isInsideOfWater
public boolean isInsideOfWater() -
isUnderBlock
-
hasWaterAt
@PowerNukkitOnly @Since("1.4.0.0-PN") @PowerNukkitXDifference(info="Make as public method", since="1.19.60-r1") public boolean hasWaterAt(float height) -
hasWaterAt
@PowerNukkitXOnly @Since("1.19.60-r1") protected boolean hasWaterAt(float height, boolean tickCached) -
isInsideOfSolid
public boolean isInsideOfSolid() -
isInsideOfFire
public boolean isInsideOfFire() -
collideWithBlock
@PowerNukkitOnly @Since("1.4.0.0-PN") public <T extends Block> boolean collideWithBlock(Class<T> classType) -
isInsideOfLava
-
isOnLadder
public boolean isOnLadder() -
fastMove
public boolean fastMove(double dx, double dy, double dz) -
move
@PowerNukkitXDifference(since="1.19.60-r1", info="The onGround is updated when the entity motion is 0") public boolean move(double dx, double dy, double dz) -
checkGroundState
protected void checkGroundState(double movX, double movY, double movZ, double dx, double dy, double dz) -
getBlocksAround
-
getTickCachedBlocksAround
-
getCollisionBlocks
-
getTickCachedCollisionBlocks
-
canBeMovedByCurrents
public boolean canBeMovedByCurrents()Returns whether this entity can be moved by currents in liquids.- Returns:
- boolean
-
checkBlockCollision
protected void checkBlockCollision() -
setPositionAndRotation
-
setPositionAndRotation
Sets position and rotation.- Parameters:
pos
- the posyaw
- the yawpitch
- the pitchheadYaw
- the head yaw- Returns:
- 切换地图失败会返回false
-
setRotation
public void setRotation(double yaw, double pitch) -
setRotation
-
doesTriggerPressurePlate
public boolean doesTriggerPressurePlate()Whether the entity can active pressure plates. Used forEntityBat
s only.- Returns:
- triggers pressure plate
-
canPassThrough
public boolean canPassThrough() -
checkChunks
protected void checkChunks() -
setPosition
-
getMotion
-
setMotion
设置一个运动向量(会使得实体移动这个向量的距离,非精准移动)Set a motion vector (will make the entity move the distance of this vector, not move precisely)
- Parameters:
motion
- 运动向量
a motion vector- Returns:
- boolean
-
isOnGround
public boolean isOnGround() -
kill
public void kill() -
teleport
-
teleport
-
teleport
-
teleport
-
teleport
-
teleport
-
getId
public long getId() -
getUniqueId
-
respawnToAll
public void respawnToAll() -
spawnToAll
public void spawnToAll() -
despawnFromAll
public void despawnFromAll() -
close
public void close() -
setDataProperty
-
setDataProperty
-
getDataProperties
-
getDataProperty
-
getDataPropertyInt
public int getDataPropertyInt(int id) -
getDataPropertyShort
public int getDataPropertyShort(int id) -
getDataPropertyByte
public int getDataPropertyByte(int id) -
getDataPropertyBoolean
public boolean getDataPropertyBoolean(int id) -
getDataPropertyLong
public long getDataPropertyLong(int id) -
getDataPropertyString
-
getDataPropertyFloat
public float getDataPropertyFloat(int id) -
getDataPropertyNBT
-
getDataPropertyPos
-
getDataPropertyVector3f
-
getDataPropertyType
public int getDataPropertyType(int id) -
setDataFlag
public void setDataFlag(int propertyId, int id) -
setDataFlag
public void setDataFlag(int propertyId, int id, boolean value) -
getDataFlag
public boolean getDataFlag(int propertyId, int id) -
setMetadata
- Specified by:
setMetadata
in interfaceMetadatable
-
getMetadata
- Specified by:
getMetadata
in interfaceMetadatable
-
hasMetadata
- Specified by:
hasMetadata
in interfaceMetadatable
-
removeMetadata
- Specified by:
removeMetadata
in interfaceMetadatable
-
getServer
-
isUndead
-
isInEndPortal
-
isPreventingSleep
-
equals
-
hashCode
public int hashCode() -
isSpinAttacking
-
setSpinAttacking
-
setSpinAttacking
-
isNoClip
-
setNoClip
-
isBoss
-
addTag
-
removeTag
-
containTag
-
getAllTags
-
getFreezingEffectStrength
-
setFreezingEffectStrength
-
getFreezingTicks
-
setFreezingTicks
-
addFreezingTicks
-
setAmbientSoundInterval
-
setAmbientSoundIntervalRange
-
setAmbientSoundEvent
-
setAmbientSoundEventName
-
playAnimation
@PowerNukkitXOnly @Since("1.19.50-r3") public void playAnimation(AnimateEntityPacket.Animation animation) -
playAnimation
@PowerNukkitXOnly @Since("1.19.50-r3") public void playAnimation(AnimateEntityPacket.Animation animation, Collection<Player> players) Play the animation of this entity to a specified group of players向指定玩家群体播放此实体的动画
- Parameters:
animation
- 动画对象 Animation objectsplayers
- 可视玩家 Visible Player
-
playActionAnimation
@PowerNukkitXOnly @Since("1.19.60-r1") public void playActionAnimation(AnimatePacket.Action action, float rowingTime) -
playActionAnimation
@PowerNukkitXOnly @Since("1.19.60-r1") public void playActionAnimation(AnimatePacket.Action action, float rowingTime, Collection<Player> players) Play the action animation of this entity to a specified group of players向指定玩家群体播放此实体的action动画
- Parameters:
action
- the actionrowingTime
- the rowing timeplayers
- 可视玩家 Visible Player
-
setIntEntityProperty
@PowerNukkitXOnly @Since("1.20.10-r2") public final boolean setIntEntityProperty(String identifier, int value) -
setBooleanEntityProperty
@PowerNukkitXOnly @Since("1.20.10-r2") public final boolean setBooleanEntityProperty(String identifier, boolean value) -
setFloatEntityProperty
@PowerNukkitXOnly @Since("1.20.10-r2") public final boolean setFloatEntityProperty(String identifier, float value) -
setEnumEntityProperty
@PowerNukkitXOnly @Since("1.20.10-r2") public final boolean setEnumEntityProperty(String identifier, String value)
-