본문으로 건너뛰기
버전: Minecraft 26.2

dev.polymodloader.api.content.entity

자동 생성

이 페이지는 소스의 Javadoc에서 ./gradlew apiReference로 만든 것입니다. 설명은 코드에 적힌 영어 그대로입니다. 직접 고치지 말고 소스의 주석을 고친 뒤 다시 만드세요.

형식종류설명
AiGoal인터페이스One behaviour of a mod mob, run by the game's goal scheduler on the server thread: every tick the scheduler starts the best-priority goals that canStart and whose controls are free, ticks running goals, and stops those that no longer shouldContinue.
EntityBehavior인터페이스Code that runs for a mod mob.
EntityDefinition레코드A mod mob: a pathfinding creature with the game's standard AI goals, drawn with the humanoid (player-shaped) model and a 64×64 skin-layout texture, or with its own box model().
EntityDefinition.Builder클래스Builds an EntityDefinition.
EntityDefinition.GoalEntry레코드An extra AI goal.
EntityDefinition.Movement열거형How a mob moves and finds paths.
EntityDefinition.Riding열거형How players ride a mob.
EntityHandle인터페이스A declared entity type.
EntityInteraction레코드A player using (right-clicking) a mod mob.
GoalControl열거형What an AiGoal controls.
MobCategory열거형Spawn group of a mob, which decides despawning and difficulty rules like the game's categories.
NaturalSpawn레코드Where and how often a mob spawns by itself.
ProjectileBehavior인터페이스Code that runs when a mod projectile hits something; on the server thread.
ProjectileDefinition레코드A thrown projectile such as a snowball: it flies, falls with gravity, and on its first hit deals damage, calls the behaviour, and disappears.
ProjectileDefinition.Builder클래스Builds a ProjectileDefinition.
ProjectileHit레코드What a projectile hit.

AiGoal​

인터페이스 · 안정성 PREVIEW · 추가된 버전 0.1.0-alpha.4 또는 그 이전

public interface AiGoal

One behaviour of a mod mob, run by the game's goal scheduler on the server thread: every tick the scheduler starts the best-priority goals that canStart and whose controls are free, ticks running goals, and stops those that no longer shouldContinue. Each mob gets its own goal object from the factory given to EntityDefinition.Builder.goal, so goals may keep state in fields.

controls()​

default Set<GoalControl> controls()

추가된 버전 0.1.0-alpha.4 또는 그 이전

The controls this goal needs while it runs; default GoalControl.MOVE.

반환 Set<GoalControl>

canStart(MobView)​

boolean canStart(MobView mob)

추가된 버전 0.1.0-alpha.4 또는 그 이전

Whether the goal should start now. Called often; keep it cheap.

인자타입설명
mobMobView—

반환 boolean

shouldContinue(MobView)​

default boolean shouldContinue(MobView mob)

추가된 버전 0.1.0-alpha.4 또는 그 이전

Whether a running goal keeps running; default canStart.

인자타입설명
mobMobView—

반환 boolean

start(MobView)​

default void start(MobView mob)

추가된 버전 0.1.0-alpha.4 또는 그 이전

The goal started.

인자타입설명
mobMobView—

tick(MobView)​

default void tick(MobView mob)

추가된 버전 0.1.0-alpha.4 또는 그 이전

Every tick while running.

인자타입설명
mobMobView—

stop(MobView)​

default void stop(MobView mob)

추가된 버전 0.1.0-alpha.4 또는 그 이전

The goal stopped or was interrupted.

인자타입설명
mobMobView—

EntityBehavior​

인터페이스 · 안정성 PREVIEW · 추가된 버전 0.1.0-alpha.4 또는 그 이전

public interface EntityBehavior

Code that runs for a mod mob. Defaults keep the game's behaviour.

onServerTick(LivingEntityView)​

default void onServerTick(LivingEntityView entity)

추가된 버전 0.1.0-alpha.4 또는 그 이전

Every server tick while the mob is alive. Keep it cheap.

인자타입설명
entityLivingEntityView—

onInteract(EntityInteraction)​

default InteractionResult onInteract(EntityInteraction interaction)

추가된 버전 0.1.0-alpha.4 또는 그 이전

A player used the mob (both sides; check world().isClientSide()).

인자타입설명
interactionEntityInteraction—

반환 InteractionResult

EntityDefinition​

레코드 · 안정성 PREVIEW · 추가된 버전 0.1.0-alpha.4 또는 그 이전

public record EntityDefinition(float width, float height, MobCategory category, double maxHealth, double movementSpeed, double attackDamage, boolean wander, boolean lookAtPlayers, boolean panicWhenHurt, boolean attackPlayers, Optional<ResourceId> temptedBy, ResourceId texture, Optional<CreativeTab> spawnEggTab, EntityBehavior behavior, List<NaturalSpawn> naturalSpawns, List<EntityDefinition.GoalEntry> goals, EntityDefinition.Riding riding, boolean noGravity, boolean pushable, Optional<EntityModelDefinition> model, EntityDefinition.Movement movement, double flyingSpeed)

A mod mob: a pathfinding creature with the game's standard AI goals, drawn with the humanoid (player-shaped) model and a 64×64 skin-layout texture, or with its own box model().

구성 요소타입설명
widthfloathitbox width in blocks
heightfloathitbox height in blocks
categoryMobCategoryspawn group
maxHealthdoublehealth in half-hearts
movementSpeeddoublebase speed (zombie 0.23, villager 0.5)
attackDamagedoublemelee damage; used only with attackPlayers()
wanderbooleanwalk around randomly
lookAtPlayersbooleanlook at nearby players
panicWhenHurtbooleanrun away when hurt
attackPlayersbooleanchase and hit players
temptedByOptional<ResourceId>follow players holding this item, if set
textureResourceIdskin texture, for example my_mod:textures/entity/golem.png
spawnEggTabOptional<CreativeTab>when present, declares <id>_spawn_egg in this creative tab
behaviorEntityBehaviorcallbacks
naturalSpawnsList<NaturalSpawn>where the mob spawns by itself; empty for never
goalsList<EntityDefinition.GoalEntry>extra AI goals, each created per mob
ridingEntityDefinition.Ridingwhether and how players ride the mob
noGravitybooleanwhether the mob floats
pushablebooleanwhether other entities push the mob
modelOptional<EntityModelDefinition>a box model drawn with texture, or empty for the player-shaped model
movementEntityDefinition.Movementhow the mob moves and finds paths
flyingSpeeddoublespeed in the air for Movement.FLY (parrot 0.4); ignored otherwise

builder(ResourceId)​

public static EntityDefinition.Builder builder(ResourceId texture)

추가된 버전 0.1.0-alpha.4 또는 그 이전

A builder for a 0.6×1.95 creature (player-sized) with the given skin texture.

인자타입설명
textureResourceId—

반환 EntityDefinition.Builder

EntityDefinition.Builder​

클래스 · 추가된 버전 0.1.0-alpha.4 또는 그 이전

public static final class Builder

Builds an EntityDefinition.

size(float, float)​

public EntityDefinition.Builder size(float width, float height)

추가된 버전 0.1.0-alpha.4 또는 그 이전

Hitbox width and height in blocks.

인자타입설명
widthfloat—
heightfloat—

반환 EntityDefinition.Builder

category(MobCategory)​

public EntityDefinition.Builder category(MobCategory category)

추가된 버전 0.1.0-alpha.4 또는 그 이전

Spawn group; MobCategory.CREATURE by default.

인자타입설명
categoryMobCategory—

반환 EntityDefinition.Builder

maxHealth(double)​

public EntityDefinition.Builder maxHealth(double maxHealth)

추가된 버전 0.1.0-alpha.4 또는 그 이전

Health in half-hearts; 20 by default.

인자타입설명
maxHealthdouble—

반환 EntityDefinition.Builder

movementSpeed(double)​

public EntityDefinition.Builder movementSpeed(double movementSpeed)

추가된 버전 0.1.0-alpha.4 또는 그 이전

Base speed (zombie 0.23, villager 0.5); 0.25 by default.

인자타입설명
movementSpeeddouble—

반환 EntityDefinition.Builder

noWandering()​

public EntityDefinition.Builder noWandering()

추가된 버전 0.1.0-alpha.4 또는 그 이전

The mob stands still.

반환 EntityDefinition.Builder

panicWhenHurt()​

public EntityDefinition.Builder panicWhenHurt()

추가된 버전 0.1.0-alpha.4 또는 그 이전

The mob runs away for a while after being hurt.

반환 EntityDefinition.Builder

attackPlayers(double)​

public EntityDefinition.Builder attackPlayers(double damage)

추가된 버전 0.1.0-alpha.4 또는 그 이전

The mob chases and hits players for damage.

인자타입설명
damagedouble—

반환 EntityDefinition.Builder

temptedBy(ResourceId)​

public EntityDefinition.Builder temptedBy(ResourceId item)

추가된 버전 0.1.0-alpha.4 또는 그 이전

The mob follows players holding item.

인자타입설명
itemResourceId—

반환 EntityDefinition.Builder

spawnEgg(CreativeTab)​

public EntityDefinition.Builder spawnEgg(CreativeTab tab)

추가된 버전 0.1.0-alpha.4 또는 그 이전

Declares a spawn egg item <id>_spawn_egg listed in tab.

인자타입설명
tabCreativeTab—

반환 EntityDefinition.Builder

behavior(EntityBehavior)​

public EntityDefinition.Builder behavior(EntityBehavior behavior)

추가된 버전 0.1.0-alpha.4 또는 그 이전

Callbacks for ticks and interaction.

인자타입설명
behaviorEntityBehavior—

반환 EntityDefinition.Builder

spawnsNaturally(BiomeSelector, int, int, int)​

public EntityDefinition.Builder spawnsNaturally(BiomeSelector biomes, int weight, int minGroup, int maxGroup)

추가된 버전 0.1.0-alpha.4 또는 그 이전

The mob spawns by itself in biomes, in groups of minGroup..maxGroup.

인자타입설명
biomesBiomeSelector—
weightint—
minGroupint—
maxGroupint—

반환 EntityDefinition.Builder

goal(int, Supplier<AiGoal>)​

public EntityDefinition.Builder goal(int priority, Supplier<AiGoal> factory)

추가된 버전 0.1.0-alpha.4 또는 그 이전

Adds an AI goal created for each mob by factory.

인자타입설명
priorityint—
factorySupplier<AiGoal>—

반환 EntityDefinition.Builder

targetGoal(int, Supplier<AiGoal>)​

public EntityDefinition.Builder targetGoal(int priority, Supplier<AiGoal> factory)

추가된 버전 0.1.0-alpha.4 또는 그 이전

Adds a target goal (chooses whom to attack) created for each mob by factory.

인자타입설명
priorityint—
factorySupplier<AiGoal>—

반환 EntityDefinition.Builder

rideable(boolean)​

public EntityDefinition.Builder rideable(boolean steerable)

추가된 버전 0.1.0-alpha.4 또는 그 이전

Players can ride the mob; with steerable they also steer it.

인자타입설명
steerableboolean—

반환 EntityDefinition.Builder

noGravity()​

public EntityDefinition.Builder noGravity()

추가된 버전 0.1.0-alpha.4 또는 그 이전

The mob is not pulled down by gravity.

반환 EntityDefinition.Builder

notPushable()​

public EntityDefinition.Builder notPushable()

추가된 버전 0.1.0-alpha.4 또는 그 이전

Other entities do not push the mob.

반환 EntityDefinition.Builder

model(EntityModelDefinition)​

public EntityDefinition.Builder model(EntityModelDefinition model)

추가된 버전 0.1.0-alpha.4 또는 그 이전

Draws the mob with a box model instead of the player-shaped one.

인자타입설명
modelEntityModelDefinition—

반환 EntityDefinition.Builder

flying(double)​

public EntityDefinition.Builder flying(double flyingSpeed)

추가된 버전 0.1.0-alpha.4 또는 그 이전

The mob flies and hovers (Movement.FLY) at flyingSpeed (parrot 0.4) in the air; movementSpeed still applies on the ground.

인자타입설명
flyingSpeeddouble—

반환 EntityDefinition.Builder

swimming()​

public EntityDefinition.Builder swimming()

추가된 버전 0.1.0-alpha.4 또는 그 이전

The mob swims under water (Movement.SWIM) at movementSpeed.

반환 EntityDefinition.Builder

build()​

public EntityDefinition build()

추가된 버전 0.1.0-alpha.4 또는 그 이전

Creates the definition; invalid values throw IllegalArgumentException.

반환 EntityDefinition

EntityDefinition.GoalEntry​

레코드 · 추가된 버전 0.1.0-alpha.4 또는 그 이전

public static record GoalEntry(int priority, Supplier<AiGoal> factory, boolean target)

An extra AI goal.

구성 요소타입설명
priorityintlower runs first; the built-in goals use 0 (float), 1 (panic), 2 (attack), 3 (tempt), 5 (wander), 6–7 (look around)
factorySupplier<AiGoal>creates the goal for each mob
targetbooleanwhether it is a target goal (chooses whom to attack) rather than a behaviour goal

EntityDefinition.Movement​

열거형 · 추가된 버전 0.1.0-alpha.4 또는 그 이전

public static enum Movement

How a mob moves and finds paths.

상수설명
WALKWalks and jumps; swims to the surface in water.
FLYFlies in any direction and hovers when it stops, like a bee; takes no fall damage. Paths go through the air.
SWIMSwims in any direction under water, like a dolphin, and breathes there; paths stay in water. Out of water it only crawls slowly. Use MobCategory.WATER_CREATURE to spawn it in water.

EntityDefinition.Riding​

열거형 · 추가된 버전 0.1.0-alpha.4 또는 그 이전

public static enum Riding

How players ride a mob.

상수설명
NONENot at all.
PASSENGERPlayers climb on by using the mob with an empty hand and are carried along.
STEERABLELike PASSENGER, and the rider steers with the movement keys, like a horse.

EntityHandle​

인터페이스 · 안정성 PREVIEW · 추가된 버전 0.1.0-alpha.4 또는 그 이전

public interface EntityHandle extends ContentHandle

A declared entity type.

상위 형식: ContentHandle

EntityInteraction​

레코드 · 안정성 PREVIEW · 추가된 버전 0.1.0-alpha.4 또는 그 이전

public record EntityInteraction(WorldView world, LivingEntityView entity, PlayerView player)

A player using (right-clicking) a mod mob.

구성 요소타입설명
worldWorldViewthe world, client or server copy
entityLivingEntityViewthe mob
playerPlayerViewthe player

GoalControl​

열거형 · 안정성 PREVIEW · 추가된 버전 0.1.0-alpha.4 또는 그 이전

public enum GoalControl

What an AiGoal controls. Two running goals never share a control; a goal with a better (lower) priority takes it from a worse one.

상수설명
MOVEWalking and pathfinding.
LOOKWhere the head looks.
JUMPJumping.
TARGETChoosing an attack target (target goals).

MobCategory​

열거형 · 안정성 PREVIEW · 추가된 버전 0.1.0-alpha.4 또는 그 이전

public enum MobCategory

Spawn group of a mob, which decides despawning and difficulty rules like the game's categories.

상수설명
CREATUREPeaceful animals; persistent.
MONSTERHostile mobs; removed on peaceful difficulty and despawn far from players.
AMBIENTAmbient creatures such as bats.
WATER_CREATUREWater animals.

NaturalSpawn​

레코드 · 안정성 PREVIEW · 추가된 버전 0.1.0-alpha.4 또는 그 이전

public record NaturalSpawn(BiomeSelector biomes, int weight, int minGroup, int maxGroup)

Where and how often a mob spawns by itself. Creatures spawn on #minecraft:animals_spawnable_on blocks in daylight, monsters in the dark, water creatures in water, like the game's mobs of the same category.

구성 요소타입설명
biomesBiomeSelectorwhere
weightintchance relative to the biome's other mobs of the category (pig 10, zombie 100)
minGroupintsmallest group
maxGroupintlargest group

ProjectileBehavior​

인터페이스 · 안정성 PREVIEW · 추가된 버전 0.1.0-alpha.4 또는 그 이전

public interface ProjectileBehavior

Code that runs when a mod projectile hits something; on the server thread.

onHitEntity(ProjectileHit)​

default void onHitEntity(ProjectileHit hit)

추가된 버전 0.1.0-alpha.4 또는 그 이전

The projectile hit an entity, after its damage was dealt.

인자타입설명
hitProjectileHit—

onHitBlock(ProjectileHit)​

default void onHitBlock(ProjectileHit hit)

추가된 버전 0.1.0-alpha.4 또는 그 이전

The projectile hit a block.

인자타입설명
hitProjectileHit—

ProjectileDefinition​

레코드 · 안정성 PREVIEW · 추가된 버전 0.1.0-alpha.4 또는 그 이전

public record ProjectileDefinition(ResourceId item, float size, double gravity, float damage, ProjectileBehavior behavior)

A thrown projectile such as a snowball: it flies, falls with gravity, and on its first hit deals damage, calls the behaviour, and disappears. Clients draw it as the item. Launch it with LivingEntityView.launchProjectile.

구성 요소타입설명
itemResourceIditem drawn in flight
sizefloathitbox width and height in blocks
gravitydoubledownward acceleration per tick (snowball 0.03)
damagefloatdamage to a hit entity, 0 for none
behaviorProjectileBehaviorhit callbacks

builder(ResourceId)​

public static ProjectileDefinition.Builder builder(ResourceId item)

추가된 버전 0.1.0-alpha.4 또는 그 이전

A builder for a 0.25-block projectile drawn as item, with snowball gravity and no damage.

인자타입설명
itemResourceId—

반환 ProjectileDefinition.Builder

ProjectileDefinition.Builder​

클래스 · 추가된 버전 0.1.0-alpha.4 또는 그 이전

public static final class Builder

Builds a ProjectileDefinition.

size(float)​

public ProjectileDefinition.Builder size(float size)

추가된 버전 0.1.0-alpha.4 또는 그 이전

Hitbox width and height in blocks.

인자타입설명
sizefloat—

반환 ProjectileDefinition.Builder

gravity(double)​

public ProjectileDefinition.Builder gravity(double gravity)

추가된 버전 0.1.0-alpha.4 또는 그 이전

Downward acceleration per tick (snowball 0.03).

인자타입설명
gravitydouble—

반환 ProjectileDefinition.Builder

damage(float)​

public ProjectileDefinition.Builder damage(float damage)

추가된 버전 0.1.0-alpha.4 또는 그 이전

Damage to a hit entity, 0 for none.

인자타입설명
damagefloat—

반환 ProjectileDefinition.Builder

behavior(ProjectileBehavior)​

public ProjectileDefinition.Builder behavior(ProjectileBehavior behavior)

추가된 버전 0.1.0-alpha.4 또는 그 이전

Callbacks for hitting blocks and entities.

인자타입설명
behaviorProjectileBehavior—

반환 ProjectileDefinition.Builder

build()​

public ProjectileDefinition build()

추가된 버전 0.1.0-alpha.4 또는 그 이전

Creates the definition; invalid values throw IllegalArgumentException.

반환 ProjectileDefinition

ProjectileHit​

레코드 · 안정성 PREVIEW · 추가된 버전 0.1.0-alpha.4 또는 그 이전

public record ProjectileHit(WorldView world, EntityView projectile, Optional<EntityView> owner, Optional<EntityView> entity, Optional<BlockPos> block)

What a projectile hit.

구성 요소타입설명
worldWorldViewthe server world
projectileEntityViewthe projectile, removed after the callback
ownerOptional<EntityView>who launched it, if known
entityOptional<EntityView>the hit entity, for entity hits
blockOptional<BlockPos>the hit block, for block hits
Buy me a coffee