Zone NPC and Mob Refresh
On this page(12)
A zone can have an NPC: a fake player by the mob area that throws each new mob to its spot. Every few minutes the mob refresh swaps a player's mobs for fresh ones with new rarities. Sword enchants can also ask for extra mobs above the area's count.
| Files | npc: of modules/zones/zones/<zone>.yml; npc-launch:, mobs.refresh and mobs.max-extra-mobs of modules/zones/config.yml |
| Admin command | /dungeons admin zones setnpc <zone> [skin] |
| Settings | core.sounds (the throw sound), core.particles (the trail of a thrown mob) |
| Needs | The packet layer (nms.enabled: true in config.yml) |
The zone NPC
A zone file with an npc: has an NPC. It is a fake player at npc.location, in the world of the zone's mob area.
- Only for you. Each player sees their own NPC, like their mobs, whatever their visibility mode. It never shows in the tab list.
- Its name shows above it only when
name-visibleistrue. A missingname-visibleisfalse. - Rest facing. Before its first throw it faces the side the mobs look at (
mobs.facing). Withnpc-launch.rest-facing: file, or withmobs.facing: RANDOM, it faces theyawandpitchofnpc.locationinstead. - After a throw it keeps looking where it threw. It returns to its rest facing only when drawn anew: after another zone or stage, or a new place or skin.
A zone without an npc: spawns its new mobs in place.
Placing it
Stand where the NPC goes, facing where it should look, and run /dungeons admin zones setnpc <zone> [skin].
- It writes
npc.locationwith the way you look. It also writesname(the zone's name) andname-visible: falsewhen they are missing. - With a player name, it also writes
skin.playerand removes anytextureandsignature. - It moves the NPC of every player who sees that zone.
- In another world than the mob area, or with a word that is not a Minecraft name, it writes nothing.
- On a zone without a mob area, the NPC is written and shows once the zone has one.
The skin
| Form | What it does |
|---|---|
skin: {player: Notch} | The skin of that Minecraft account. It is looked up once and kept until the module is turned off. The NPC wears the default skin until it arrives. |
skin: {texture: '...', signature: '...'} | A Mojang skin value and its signature. Works on any server. A texture without its signature is refused. |
A name that is not an account, or a lookup that fails, is one console warning per reload and the default skin. The lookup needs the server, or its proxy, in online mode and a connection to Mojang. On an offline-mode server without an online-mode proxy, use texture + signature.
The npc keys
npc:
location:
world: dungeons
x: 10.5
y: 64
z: 3.5
yaw: 90
pitch: 0
name: '&6&lFarmer'
name-visible: false
skin:
player: 'Notch'| Key | Default | What it does |
|---|---|---|
npc.location.world | required | The world. It must be the world of the mob area, or the zone has no NPC. |
npc.location.x, y, z | required | Where it stands. |
npc.location.yaw | 0 | The way it looks (used with rest-facing: file or mobs.facing: RANDOM). |
npc.location.pitch | 0 | Its head tilt, -90 to 90. |
npc.name | none | The name above it, color codes allowed. |
npc.name-visible | false | true shows name above it. |
npc.skin.player | none | A Minecraft name whose skin it wears. |
npc.skin.texture, npc.skin.signature | none | A signed Mojang skin. With both a player and a texture, the texture is used, with a warning. |
npc.model | none | A model shown instead of the player look. See Models. |
A broken npc is one warning and the zone has no NPC. A broken skin is one warning and the default skin. Neither makes the zone unreadable.
How the NPC throws
The area is full the moment a player arrives. The NPC throws the NEW mobs only: one that respawns after a death, the ones of a refresh, and the extra mobs.
- Turn. The NPC turns body and head the short way toward where the mob lands. It also tilts its head toward it, over
turn-ticks. The turn is smooth, never a teleport. - Throw. The mob leaves its hand: the NPC swings its arm and
soundplays for that player alone. - Flight. The mob flies in an arc to its place,
heightblocks above the higher end, takingflight-ticks. It spins withspinand leavestrail-particlebehind. It cannot be hit while it flies. - Landing. It lands exactly where the arc ends, anywhere inside its block. It then turns the short way to its facing over
settle-ticks, and can be hit meanwhile.
Several mobs leave one every throw-interval-ticks (0 = all at once, the NPC facing the first). Once nothing is left to throw, the NPC does not turn back: the next throw turns from where it looks. When the NPC's chunk has not reached your client, the mob appears in its place at once.
npc-launch
| Key | Default | What it does |
|---|---|---|
npc-launch.height | 4.0 | Blocks the arc rises above the higher of its two ends, 0 to 64. |
npc-launch.flight-ticks | 20 | Ticks a mob takes to land, 1 to 200 (20 = one second). |
npc-launch.spin | true | Whether the mob spins while it flies. |
npc-launch.throw-interval-ticks | 3 | Ticks between two throws of the same NPC, 0 to 200. 0 = every waiting mob at once. |
npc-launch.sound | ENTITY_SNOWBALL_THROW | The sound of each throw, heard by that player only: a sound name or a key (minecraft:entity.snowball.throw). '' = none. |
npc-launch.trail-particle | CLOUD | The particle a flying mob leaves behind. '' = none. A particle that needs data (DUST, BLOCK...) is not accepted. |
npc-launch.turn-ticks | 4 | Ticks the NPC takes to turn and tilt its head toward a throw, 0 to 20. 0 = at once. |
npc-launch.settle-ticks | 6 | Ticks a landed mob takes to turn to its facing, 0 to 40. 0 = at once. |
npc-launch.rest-facing | mobs | Where the NPC faces before its first throw. mobs = the side of mobs.facing; file = the yaw of the zone file (where setnpc looked). |
The throw sound follows the player's core.sounds setting, and the trail their core.particles setting.
Mob refresh
Every mobs.refresh.interval-seconds, a player's living mobs vanish with a poof and new ones take their place. Their rarities are rolled again, and the NPC throws them when the zone has one. Each player's clock starts when their mobs appear.
The mob you are hitting goes too. Your fight ends, its boss bar and damage hologram go at once, and you attack a new one. A dying mob, one waiting to respawn and one still in the air are left alone.
| Key | Default | What it does |
|---|---|---|
mobs.refresh.enabled | true | false turns the refresh off. |
mobs.refresh.interval-seconds | 300 | Seconds between two refreshes, per player, 10 to 86400. |
Extra mobs
A sword enchant's spawn-mobs action asks for extra mobs of your stage, above the area's max-mobs. The NPC throws them like the others (without an NPC they appear in place), on free spots that keep min-mob-distance. See Actions.
- You never have more than
mobs.max-extra-mobsextra mobs at once. When no free spot is left, fewer appear. - An extra mob never comes back after its death.
- The refresh takes them away without new ones, also the one you are hitting.
- They go with the others when you leave the stage, the zone or the server.
| Key | Default | What it does |
|---|---|---|
mobs.max-extra-mobs | 20 | The most extra mobs a player has at once, 0 to 200. 0 = none. |
Limits
- A tab list or anti-cheat plugin that rewrites the tab list could show the NPC's hidden entry.
- The client's Social Interactions screen could list its profile name (
sndg ..., a name no player can have). - The NPC hides its name with a scoreboard team,
sndg_npc, that exists only in each player's client. - Each flying mob is one teleport packet per tick for its player. With
throw-interval-ticks: 0and many mobs in a refresh, measure before raisingmax-mobs.
Commands
| Command | Permission | Description |
|---|---|---|
/dungeons admin zones setnpc <zone> [skin] | sndungeons.admin.zones.setnpc | Places the zone's NPC where you stand, optionally with a player's skin. |
Tips
- Use
rest-facing: filewhen the NPC must face a fixed way, such as a path, until its first throw. - A longer
flight-tickslooks smoother, but the mob cannot be hit until it lands. /dungeons reloadredraws a moved or reskinned NPC and keeps the mobs.
Default refresh, extra mobs and npc-launch of modules/zones/config.yml
mobs:
# Every interval-seconds (10 to 86400) the mobs alive of each player vanish
# with a poof and new ones take their place, their rarity rolled again
# (thrown by the zone's NPC when it has one, see npc-launch). The mob the
# player is hitting goes too (the fight ends). Each player's clock starts
# when their mobs appear.
refresh:
enabled: true
interval-seconds: 300
# The most extra mobs a player can have at once, thrown by the zone's NPC
# above the area's max-mobs when a sword enchant asks for them (the
# spawn-mobs action), 0 to 200; 0 = none. Extra mobs never come back when
# they die, and a refresh takes them all away. Without an NPC they appear
# in place.
max-extra-mobs: 20
# How the NPC of a zone (npc: of the zone file, placed with
# /dungeons admin zones setnpc <zone>) throws the NEW mobs: one that
# respawns or comes with a refresh leaves the NPC's hand and flies in an arc
# to its spot, and cannot be hit while it flies. The area is still full the
# moment a player arrives. A zone without an NPC spawns them in place.
npc-launch:
# Blocks the arc rises above the higher of its two ends (0 to 64).
height: 4.0
# Ticks a mob takes to land (1 to 200; 20 = one second).
flight-ticks: 20
# true = the mob spins while it flies.
spin: true
# Ticks between two throws of the same player's NPC (0 to 200; 0 = every
# waiting mob at once).
throw-interval-ticks: 3
# Sound of each throw, heard by that player only ('' = none): a sound name
# (ENTITY_SNOWBALL_THROW) or key (minecraft:entity.snowball.throw).
sound: ENTITY_SNOWBALL_THROW
# Particle a flying mob leaves behind ('' = none); one that needs data
# (DUST, BLOCK, ...) is not accepted.
trail-particle: CLOUD
# Ticks the NPC takes to turn and tilt its head toward where it throws
# (0 to 20; 0 = at once). It keeps looking there until its next throw.
turn-ticks: 4
# Ticks a landed mob takes to turn the short way to the side it faces
# (0 to 40; 0 = at once). It can be hit meanwhile.
settle-ticks: 6
# Where the NPC faces before its first throw (after it, it keeps looking
# where it last threw): mobs = the side of mobs.facing (the side the mobs
# look at; with RANDOM the yaw of the zone file), file = the yaw of the
# zone file (where setnpc looked).
rest-facing: mobs