dev.polymodloader.api.entity
이 페이지는 소스의 Javadoc에서 ./gradlew apiReference로 만든 것입니다. 설명은 코드에 적힌 영어 그대로입니다. 직접 고치지 말고 소스의 주석을 고친 뒤 다시 만드세요.
| 형식 | 종류 | 설명 |
|---|---|---|
DamageInfo | 레코드 | What hurt an entity. |
EntityView | 인터페이스 | An entity in a loaded world. |
Hand | 열거형 | One of a player's or mob's two hands. |
LivingEntityView | 인터페이스 | An entity with health and status effects: players and mobs. |
MobView | 인터페이스 | A mob with AI: pathfinding, looking, and an attack target. |
PlayerView | 인터페이스 | A player. |
DamageInfo
레코드 · 안정성 PREVIEW · 추가된 버전 0.1.0-alpha.4 또는 그 이전
public record DamageInfo(ResourceId type, float amount, Optional<EntityView> attacker)
What hurt an entity.
| 구성 요소 | 타입 | 설명 |
|---|---|---|
type | ResourceId | damage type, for example minecraft:fall or minecraft:player_attack |
amount | float | damage before armour, in half-hearts |
attacker | Optional<EntityView> | the entity responsible, if any |
EntityView
인터페이스 · 안정성 PREVIEW · 추가된 버전 0.1.0-alpha.4 또는 그 이전
public interface EntityView
An entity in a loaded world. Same thread and lifetime rules as WorldView.
uuid()
UUID uuid()
추가된 버전 0.1.0-alpha.4 또는 그 이전
Unique, persistent entity ID.
반환 UUID
type()
ResourceId type()
추가된 버전 0.1.0-alpha.4 또는 그 이전
Entity type, for example minecraft:pig.
반환 ResourceId
isIn(TagKey)
boolean isIn(TagKey tag)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Whether the entity's type is in an entity type tag, for example #minecraft:skeletons.
| 인자 | 타입 | 설명 |
|---|---|---|
tag | TagKey | — |
반환 boolean
예외 IllegalArgumentException — when tag is not an entity type tag
name()
String name()
추가된 버전 0.1.0-alpha.4 또는 그 이전
Display name as plain text.
반환 String
x()
double x()
추가된 버전 0.1.0-alpha.4 또는 그 이전
X coordinate.
반환 double
y()
double y()
추가된 버전 0.1.0-alpha.4 또는 그 이전
Y coordinate (feet).
반환 double
z()
double z()
추가된 버전 0.1.0-alpha.4 또는 그 이전
Z coordinate.
반환 double
blockPos()
BlockPos blockPos()
추가된 버전 0.1.0-alpha.4 또는 그 이전
The block the entity stands in.
반환 BlockPos
world()
WorldView world()
추가된 버전 0.1.0-alpha.4 또는 그 이전
The world the entity is in.
반환 WorldView
isAlive()
boolean isAlive()
추가된 버전 0.1.0-alpha.4 또는 그 이전
Whether the entity is alive and in a world.
반환 boolean
remove()
void remove()
추가된 버전 0.1.0-alpha.4 또는 그 이전
Removes the entity without dropping loot; server side only.
teleport(double, double, double)
void teleport(double x, double y, double z)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Moves the entity within its dimension; server side only.
| 인자 | 타입 | 설명 |
|---|---|---|
x | double | — |
y | double | — |
z | double | — |
changeDimension(ResourceId, double, double, double)
EntityView changeDimension(ResourceId dimension, double x, double y, double z)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Moves the entity to another dimension, for example minecraft:the_nether or a mod dimension from data; server side only.
| 인자 | 타입 | 설명 |
|---|---|---|
dimension | ResourceId | — |
x | double | — |
y | double | — |
z | double | — |
반환 EntityView — the view of the entity in the new dimension (it may be a new object)
예외 IllegalArgumentException — for an unknown or unloaded dimension
velocity()
Vector3 velocity()
추가된 버전 0.1.0-alpha.4 또는 그 이전
Velocity in blocks per tick.
반환 Vector3
setVelocity(double, double, double)
void setVelocity(double x, double y, double z)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Sets the velocity; for players it reaches their client. Server side only.
| 인자 | 타입 | 설명 |
|---|---|---|
x | double | — |
y | double | — |
z | double | — |
isOnGround()
boolean isOnGround()
추가된 버전 0.1.0-alpha.4 또는 그 이전
Whether the entity stands on a block.
반환 boolean
yaw()
float yaw()
추가된 버전 0.1.0-alpha.4 또는 그 이전
Horizontal facing in degrees (0 south, 90 west, 180 north, 270 east).
반환 float
pitch()
float pitch()
추가된 버전 0.1.0-alpha.4 또는 그 이전
Vertical facing in degrees (-90 up, 90 down).
반환 float
setRotation(float, float)
void setRotation(float yaw, float pitch)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Turns the entity. Server side only.
| 인자 | 타입 | 설명 |
|---|---|---|
yaw | float | — |
pitch | float | — |
hasNoGravity()
boolean hasNoGravity()
추가된 버전 0.1.0-alpha.4 또는 그 이전
Whether gravity is off for this entity.
반환 boolean
setNoGravity(boolean)
void setNoGravity(boolean noGravity)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Turns gravity off or on. Server side only.
| 인자 | 타입 | 설명 |
|---|---|---|
noGravity | boolean | — |
vehicle()
Optional<EntityView> vehicle()
추가된 버전 0.1.0-alpha.4 또는 그 이전
What the entity rides, if anything.
반환 Optional<EntityView>
passengers()
List<EntityView> passengers()
추가된 버전 0.1.0-alpha.4 또는 그 이전
Who rides the entity.
반환 List<EntityView>
startRiding(EntityView)
boolean startRiding(EntityView vehicle)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Mounts vehicle. Mod mobs accept riders only when their definition is rideable.
| 인자 | 타입 | 설명 |
|---|---|---|
vehicle | EntityView | — |
반환 boolean — whether the entity now rides it
stopRiding()
void stopRiding()
추가된 버전 0.1.0-alpha.4 또는 그 이전
Dismounts, if riding.
data(EntityDataKey)
StoredData data(EntityDataKey key)
추가된 버전 0.1.0-alpha.4 또는 그 이전
The entity's data for key; call markChanged() after changing it. On the client this is the synchronised copy (the local player's, or any visible entity's for keys synchronised to trackers), read-only, empty until the server sends it.
| 인자 | 타입 | 설명 |
|---|---|---|
key | EntityDataKey | — |
반환 StoredData
예외 IllegalArgumentException — for an undeclared key
Hand
열거형 · 안정성 PREVIEW · 추가된 버전 0.1.0-alpha.4 또는 그 이전
public enum Hand
One of a player's or mob's two hands.
| 상수 | 설명 |
|---|---|
MAIN_HAND | The main hand: the selected hotbar slot for players. |
OFF_HAND | The off hand (shield slot). |
LivingEntityView
인터페이스 · 안정성 PREVIEW · 추가된 버전 0.1.0-alpha.4 또는 그 이전
public interface LivingEntityView extends EntityView
An entity with health and status effects: players and mobs. Same rules as EntityView.
상위 형식: EntityView
health()
float health()
추가된 버전 0.1.0-alpha.4 또는 그 이전
Current health in half-hearts.
반환 float
maxHealth()
float maxHealth()
추가된 버전 0.1.0-alpha.4 또는 그 이전
Maximum health.
반환 float
setHealth(float)
void setHealth(float health)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Sets health, clamped to [0, maxHealth]; server side only.
| 인자 | 타입 | 설명 |
|---|---|---|
health | float | — |
hurt(float)
boolean hurt(float amount)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Deals generic damage on the server, as if from /damage. Armour and EntityEvents.ALLOW_DAMAGE apply.
| 인자 | 타입 | 설명 |
|---|---|---|
amount | float | — |
반환 boolean — whether the entity was hurt
예외 IllegalStateException — on the client side
hurt(ResourceId, float)
boolean hurt(ResourceId damageType, float amount)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Deals damage of a data-defined damage type, such as minecraft:magic or one from the mod's data/<mod id>/damage_type/.
| 인자 | 타입 | 설명 |
|---|---|---|
damageType | ResourceId | — |
amount | float | — |
반환 boolean
예외 IllegalArgumentException — for an unknown damage type
예외 IllegalStateException — on the client side
addEffect(ResourceId, int, int)
void addEffect(ResourceId effect, int ticks, int amplifier)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Adds a status effect, such as minecraft:speed or a mod effect.
| 인자 | 타입 | 설명 |
|---|---|---|
effect | ResourceId | — |
ticks | int | duration in ticks (20 per second) |
amplifier | int | 0 for level I |
예외 IllegalArgumentException — for an unknown effect
예외 IllegalStateException — on the client side
hasEffect(ResourceId)
boolean hasEffect(ResourceId effect)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Whether the entity has the effect.
| 인자 | 타입 | 설명 |
|---|---|---|
effect | ResourceId | — |
반환 boolean
launchProjectile(ResourceId, float, float)
EntityView launchProjectile(ResourceId type, float speed, float inaccuracy)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Launches a projectile, such as a mod projectile or minecraft:snowball, from the eyes in the look direction.
| 인자 | 타입 | 설명 |
|---|---|---|
type | ResourceId | — |
speed | float | blocks per tick (snowball 1.5) |
inaccuracy | float | random spread (players 1.0, 0 for none) |
반환 EntityView — the launched projectile
예외 IllegalArgumentException — when type is not a projectile
예외 IllegalStateException — on the client side
MobView
인터페이스 · 안정성 PREVIEW · 추가된 버전 0.1.0-alpha.4 또는 그 이전
public interface MobView extends LivingEntityView
A mob with AI: pathfinding, looking, and an attack target. Server side for changes.
상위 형식: LivingEntityView
navigateTo(double, double, double, double)
boolean navigateTo(double x, double y, double z, double speed)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Starts walking to a position along a path.
| 인자 | 타입 | 설명 |
|---|---|---|
x | double | — |
y | double | — |
z | double | — |
speed | double | multiplier of the mob's speed (1.0 normal) |
반환 boolean — whether a path was found
isNavigating()
boolean isNavigating()
추가된 버전 0.1.0-alpha.4 또는 그 이전
Whether the mob is following a path.
반환 boolean
stopNavigating()
void stopNavigating()
추가된 버전 0.1.0-alpha.4 또는 그 이전
Stops following the path.
lookAt(double, double, double)
void lookAt(double x, double y, double z)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Turns the head towards a position this tick.
| 인자 | 타입 | 설명 |
|---|---|---|
x | double | — |
y | double | — |
z | double | — |
target()
Optional<LivingEntityView> target()
추가된 버전 0.1.0-alpha.4 또는 그 이전
The attack target, if any.
반환 Optional<LivingEntityView>
setTarget(LivingEntityView)
void setTarget(LivingEntityView target)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Sets the attack target, or clears it with null.
| 인자 | 타입 | 설명 |
|---|---|---|
target | LivingEntityView | — |
playAnimation(String)
void playAnimation(String name)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Plays one of the mob's ON_DEMAND model animations from the start on every client that sees the mob. Server only.
| 인자 | 타입 | 설명 |
|---|---|---|
name | String | the animation's name in the mob's EntityModelDefinition |
예외 IllegalArgumentException — if the mob is not a mod mob with a model that has such an animation
stopAnimation(String)
void stopAnimation(String name)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Stops an ON_DEMAND animation on every client; a non-looping one also stops by itself at its end. Server only.
| 인자 | 타입 | 설명 |
|---|---|---|
name | String | the animation's name |
예외 IllegalArgumentException — if the mob has no such animation
PlayerView
인터페이스 · 안정성 PREVIEW · 추가된 버전 0.1.0-alpha.4 또는 그 이전
public interface PlayerView extends LivingEntityView
A player. Same thread and lifetime rules as WorldView.
상위 형식: LivingEntityView
sendMessage(String)
void sendMessage(String text)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Shows text in the player's chat. On the client this is only shown locally.
| 인자 | 타입 | 설명 |
|---|---|---|
text | String | — |
give(ResourceId, int)
void give(ResourceId item, int count)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Gives the player count of item; what does not fit is dropped at their feet.
| 인자 | 타입 | 설명 |
|---|---|---|
item | ResourceId | — |
count | int | — |
예외 IllegalArgumentException — when item is not a registered item or count < 1
예외 IllegalStateException — on the client side
countItem(ResourceId)
int countItem(ResourceId item)
추가된 버전 0.1.0-alpha.4 또는 그 이전
How many of item the player carries in their inventory.
| 인자 | 타입 | 설명 |
|---|---|---|
item | ResourceId | — |
반환 int
mainHandItem()
ResourceId mainHandItem()
추가된 버전 0.1.0-alpha.4 또는 그 이전
The item in the main hand, minecraft:air when empty.
반환 ResourceId
mainHandStack()
ItemStackRef mainHandStack()
추가된 버전 0.1.0-alpha.4 또는 그 이전
The live stack in the main hand.
반환 ItemStackRef
inventory()
InventoryView inventory()
추가된 버전 0.1.0-alpha.4 또는 그 이전
The player's inventory: 36 main slots (hotbar 0–8), then armour and off hand.
반환 InventoryView
openMenu(BlockPos)
boolean openMenu(BlockPos pos)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Opens the menu of the block entity at pos (a chest-style or laid-out mod menu, or a game container such as a furnace) for this player.
| 인자 | 타입 | 설명 |
|---|---|---|
pos | BlockPos | — |
반환 boolean — whether the block has a menu
예외 IllegalStateException — on the client side
hasAdvancement(ResourceId)
boolean hasAdvancement(ResourceId advancement)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Whether the player has completed an advancement, such as minecraft:story/mine_stone.
| 인자 | 타입 | 설명 |
|---|---|---|
advancement | ResourceId | — |
반환 boolean
예외 IllegalArgumentException — for an unknown advancement
예외 IllegalStateException — on the client side
grantAdvancement(ResourceId)
boolean grantAdvancement(ResourceId advancement)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Completes every criterion of an advancement, with its rewards and announcement.
| 인자 | 타입 | 설명 |
|---|---|---|
advancement | ResourceId | — |
반환 boolean — whether anything changed
revokeAdvancement(ResourceId)
boolean revokeAdvancement(ResourceId advancement)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Clears every criterion of an advancement.
| 인자 | 타입 | 설명 |
|---|---|---|
advancement | ResourceId | — |
반환 boolean — whether anything changed
hasPermission(PermissionNode)
boolean hasPermission(PermissionNode node)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Whether the player has the permission: the first deciding provider, else the node's default operator level. Server side only.
| 인자 | 타입 | 설명 |
|---|---|---|
node | PermissionNode | — |
반환 boolean