Skip to content

Add mob-data and mythic-mob custom block types#489

Merged
tastybento merged 5 commits intodevelopfrom
feature/mob-data-and-mythic-mob
Apr 8, 2026
Merged

Add mob-data and mythic-mob custom block types#489
tastybento merged 5 commits intodevelopfrom
feature/mob-data-and-mythic-mob

Conversation

@tastybento
Copy link
Copy Markdown
Member

Summary

  • Adds a new mob-data phase entry type that summons an entity via the vanilla /summon NBT/component syntax (e.g. glowing breeze with a minecraft:generic.scale attribute). Closes mob-data #488.
  • Adds a new mythic-mob phase entry type that spawns a MythicMob via BentoBox's MythicMobsHook, with no direct MythicMobs compile dependency. Closes MythicMobs Spawn Possibility #303.
  • For both types, MakeSpace runs after spawn so scaled/oversized hitboxes automatically clear surrounding blocks — mob-data schedules it one tick later (to let NBT-driven attributes like scale apply) and mythic-mob passes it as the Consumer<Entity> callback on the new MythicMobsHook.spawnMythicMob(record, loc, Consumer) overload.
  • MythicMobCustomBlock uses reflection to detect the 3-arg hook overload, so the addon still compiles and runs against BentoBox 3.13.0 and transparently lights up the MakeSpace callback once users upgrade to a BentoBox build containing the overload.

YAML example

blocks:
  - type: mob-data
    data: minecraft:breeze{Glowing:1b,attributes:[{id:"minecraft:generic.scale",base:2}]}
    underlying-block: STONE
    probability: 15

  - type: mythic-mob
    mob: SkeletalKnight
    level: 3
    power: 1.0
    display-name: "Boss"
    underlying-block: STONE
    probability: 5

Test plan

  • mvn test — 403 tests pass (10 new unit tests in MobDataCustomBlockTest and MythicMobCustomBlockTest covering parsing, defaults, invalid underlying-block handling, string-to-numeric coercion, and creator routing).
  • mvn package — builds cleanly.
  • Manual: install on a Paper server with BentoBox + MythicMobs, add both example entries to a phase, progress an island to that phase and verify the scaled breeze spawns with NBT applied and adjacent blocks break; verify the mythic mob spawns after the hook's 40-tick delay and its surrounding blocks clear.
  • Manual: remove MythicMobs plugin, confirm the mythic-mob entry logs a warning and gameplay continues without errors.

🤖 Generated with Claude Code

Adds two new phase YAML entry types so admins can summon mobs with
richer customization than the existing `mob` entry:

- `mob-data`: summons an entity via vanilla `/summon` NBT/component
  syntax, e.g. glowing breezes with a scale attribute. After summon,
  MakeSpace runs one tick later so oversized hitboxes clear the
  surrounding blocks automatically. Closes #488.
- `mythic-mob`: spawns a MythicMob via BentoBox's MythicMobsHook with
  no direct MythicMobs dependency. Uses the new Consumer<Entity>
  overload on the hook so MakeSpace can run after the hook's 40-tick
  spawn delay. Falls back to the 2-arg signature via reflection for
  compatibility with BentoBox 3.13.0 until a newer release is cut.
  Closes #303.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@tastybento tastybento mentioned this pull request Apr 8, 2026
2 tasks
tastybento and others added 4 commits April 8, 2026 07:17
The mob-data custom block glued NBT to the entity id, producing
`summon breeze{...} x y z`, which vanilla's command parser rejects with
"Unhandled exception". Split the data string at the first `{` or `[` so
the command becomes `summon <entity> <x> <y> <z> [nbt]`, matching the
vanilla grammar. Extracted into a package-private buildSummonCommand
helper with unit tests locking in the ordering for `{...}`, `[...]`,
and bare-entity inputs.

Also add an optional sibling `custom-blocks:` list in OneBlocksManager
so admins can keep their existing map-form `blocks:` section untouched
while registering custom entries like mob-data or mythic-mob — removes
the need to convert every vanilla block to list form just to add one
custom spawn. Both sections feed the same weighted pool.

Update the README examples and MobDataCustomBlock javadoc to use 1.21+
attribute syntax (`minecraft:scale`, not `minecraft:generic.scale`),
add a note about the 1.21 attribute-prefix rename, and enrich the
error log with a version-compat breadcrumb.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Expose the existing BlockDataCustomBlock under a second key `block` so
phase-file authors placing NBT-heavy blocks (preconfigured spawners,
etc.) aren't forced to use the misleading `block-data` name. Both types
route to the same handler; `block-data` stays the recommended key for
simple block states while `block` signals intent when the data string
contains NBT or a setblock mode flag.

No behavioural change — BlockDataCustomBlock.execute already falls
through to `/setblock <x> <y> <z> <data>` when Bukkit.createBlockData
can't parse the string, which is exactly what NBT payloads need.

Documented both forms in the README with a working spawner+breeze
example (single-quoted to avoid YAML delimiter clashes) and added two
routing tests in BlockCustomBlockTest to lock in the alias.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add a commented-out `custom-blocks:` sibling section to the Plains
phase showing all three custom entry types (block, mob-data,
mythic-mob) with working, single-quoted data strings. Using the
first-phase file as the on-disk reference template matches how other
optional sections (start-commands, requirements, etc.) are documented
in this file.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Placing a spawner via /setblock with only SpawnData leaves the timing
fields at their uninitialised defaults — specifically Delay:-1, which
means "inactive, never tick". The example spawner appeared correctly
but never spawned anything.

Update the README and 0_plains.yml block example to set Delay,
MinSpawnDelay, MaxSpawnDelay, SpawnCount, SpawnRange,
MaxNearbyEntities, and RequiredPlayerRange explicitly so the spawner
actually ticks. Add a README "Spawner gotcha" callout explaining why
the timing fields are necessary, and an inline comment in the phase
YAML pointing at the same trap.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Apr 8, 2026

@tastybento tastybento merged commit 5363387 into develop Apr 8, 2026
3 checks passed
@tastybento tastybento deleted the feature/mob-data-and-mythic-mob branch April 8, 2026 14:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

mob-data MythicMobs Spawn Possibility

1 participant