diff --git a/.gitignore b/.gitignore index a4e3980f..f44f2c5e 100644 --- a/.gitignore +++ b/.gitignore @@ -41,3 +41,7 @@ run/ **/src/generated/**/.cache/ repo/ !**/src/**/repo/ + +### Local asset generation and root runtime logs ### +/output/ +/logs/ diff --git a/ASSET_CREDITS.md b/ASSET_CREDITS.md index 454cfdc0..621d28e2 100644 --- a/ASSET_CREDITS.md +++ b/ASSET_CREDITS.md @@ -9,58 +9,120 @@ This record complements [`LICENSE`](LICENSE) and [`LICENSE-ASSETS.md`](LICENSE-A | Jesse Schramm | Extinguished-torch textures | Included | | Xefensor | Gameplay screenshots dated 2026-07-18 | Repository documentation | | Xefensor | Runtime-generated horizon-figure skin encoded from a developer-supplied and approved visual source | Included; 2026-08-19 | -| Xefensor, with drawing instruction and review from Codex | Hand-drawn Aender Sand texture created in Krita | Original replacement included; 2026-08-14 | -| OpenAI image generation, directed and processed by Codex | Aender wood-family placeholder textures: planks, stripped log, sapling, door, trapdoor, signs, boats, and derived model atlases | AI-generated placeholder; 2026-07-22 | -| OpenAI image generation, directed and processed by Codex | Aender Chronolith block and Aender Eye/Gale Core spawn-egg placeholder textures | AI-generated placeholder; 2026-07-22 | -| OpenAI image generation, directed and processed by Codex | Experimental Aender Desert placeholder textures: Aender sand, sandstone, and cactus | AI-generated placeholders; Aender Sand superseded on 2026-08-14 | -| OpenAI image generation, directed and processed by Codex | Aenderite Ore, Raw Aenderite, and Aenderite Ingot placeholder textures | AI-generated placeholder; 2026-07-22 | -| Future original artists | Final replacements for provisional Aender and other development assets | To be credited when work is accepted | +| Xefensor, with drawing instruction and review from Codex | Hand-drawn Aender Sand texture created in Krita | Included 2026-08-14; superseded by generated Sand on 2026-10-12 at developer request | +| OpenAI image generation, directed and processed by Codex | July Aender wood-family, Chronolith, spawn-egg, desert, and Aenderite placeholders | Introduced 2026-07-22; historical sources for the current development set | +| OpenAI image generation, directed and processed by Codex under Xefensor direction | Aender textures, Flint/Steel equipment, Nether Reactor Core, Earth Guardian/Gale Core textures and eggs | Development artwork; final in-game approval pending | +| Codex (OpenAI), under Xefensor direction | Earth Guardian geometry/poses and Gale Core commander armor geometry/rendering | Development models; final in-game approval pending | +| Codex (OpenAI) | Original-art-only offline asset review image dated 2026-10-23 | Repository documentation; model/texture preview, not an in-game screenshot | + +## Current Development Artwork + +The generated textures and original boss models remain **development artwork**. Approval to create +these assets does not establish final visual approval. The developer owns review of the installed +appearance, including world tiling, cutouts, equipment scale, armor trims, animation, shaders, +resource packs, and multiplayer. Offline previews are not in-game screenshots. + +The Aender direction retains static material surfaces, vanilla-scale pixel detail, the original +inverted-world color families, and irregular grass fringes. Purple vegetation, blue soil/bark and +desert materials, and cool stone follow the [original palette](docs/media/aender-original-palette.png). +Original plank artwork is retained. Grass and ore use their exact Soil and Stone host pixels. +The portal effect is separate from these static block materials. The provisional portal frame +retains `retold:dev_aender_portal_frame`; final naming remains open. + +Equipment uses cool silver Steel and knapped Flint. Earth Guardian is a blind weathered stone +statue. Gale Core uses the installed Breeze head, glowing face, wind and animations with an original +shallow pale circlet and four thin floating plates around a visible installed Heavy Core. These +plates are presentation only. Nether Reactor Core uses original blue-and-brass artwork. Aender Eye +uses the installed vanilla Eye of Ender appearance, as directed by the developer; no dedicated +Retold eye sprite is packaged. + +The active 2026-10-23 revision improves nine existing textures using seven generated sources: +Steel's three atlases, Earth Guardian, Gale plate faces, Flint multi-tool, Nether Reactor Core, +Aender grass top and leaves. A further polish replaces Steel and Guardian material sources with +limited-palette panel sheets. Steel has distinct front/back plates and separate bracer, greave and +boot materials; its existing coverage masks are byte-identical. Guardian has quieter carved stone +planes, separate face/back/side materials and sparse olive moss. Existing UVs, geometry and gameplay +are unchanged. Gale's earlier rim material is retained during packing. The refreshed +[offline review image](docs/media/asset-review-2026-10-23.png) uses the actual Retold meshes and +original textures without a running game or extracted vanilla pixels. It does not verify +the installed Breeze wind, Heavy Core rendering, lighting or other connected-world appearance. + +The following paths are relative to `src/main/resources/assets/retold/textures/`. The inventory +contains 35 Aender and 23 equipment/boss generated PNGs; metadata and Java geometry are excluded. + +| Family | Active generated texture paths | +| --- | --- | +| Aender terrain | `block/aender_grass_block_top.png`, `block/aender_grass_block_side.png`, `block/aender_soil.png`, `block/aender_stone.png`, `block/aender_log.png`, `block/aender_log_top.png`, `block/aender_leaves.png` | +| Aender wood family | `block/aender_door_bottom.png`, `block/aender_door_top.png`, `block/aender_hanging_sign.png`, `block/aender_planks.png`, `block/aender_sapling.png`, `block/aender_sign.png`, `block/aender_trapdoor.png`, `block/stripped_aender_log.png`, `block/stripped_aender_log_top.png`, `entity/boat/aender.png`, `entity/chest_boat/aender.png`, `item/aender_boat.png`, `item/aender_chest_boat.png`, `item/aender_door.png`, `item/aender_sign.png`, `item/aender_hanging_sign.png` | +| Aender Chronolith and egg | `block/aender_chronolith.png`, `item/aender_eye_spawn_egg.png` | +| Aender Desert | `block/aender_cactus_side.png`, `block/aender_cactus_top.png`, `block/aender_sandstone.png`, `block/aender_sandstone_top.png`, `block/aender_sand.png` | +| Aenderite | `block/aenderite_ore.png`, `item/raw_aenderite.png`, `item/aenderite_ingot.png` | +| Aender infrastructure | `block/aender_stabilizer.png`, `block/dev_aender_portal_frame.png` | +| Steel inventory | `item/steel_ingot.png`, `item/steel_sword.png`, `item/steel_pickaxe.png`, `item/steel_axe.png`, `item/steel_shovel.png`, `item/steel_hoe.png`, `item/steel_spear.png`, `item/steel_helmet.png`, `item/steel_chestplate.png`, `item/steel_leggings.png`, `item/steel_boots.png` | +| Steel worn armor | `entity/equipment/humanoid/steel.png`, `entity/equipment/humanoid_leggings/steel.png`, `entity/equipment/humanoid_baby/steel.png` | +| Flint tools | `item/flint_multi_tool.png`, `item/flint_spear.png` | +| Held spears | `item/steel_spear_in_hand.png`, `item/flint_spear_in_hand.png` | +| Fire artifact | `item/nether_reactor_core.png` | +| Earth Guardian | `entity/earth_guardian.png`, `item/earth_guardian_spawn_egg.png` | +| Gale Core | `entity/gale_core.png`, `item/gale_core_spawn_egg.png` | + +## Sources And Processing + +OpenAI's built-in image-generation tool produced the original source artwork. Mechanical processing +reduces it with nearest-neighbor sampling, preserves binary cutout alpha, and packs material into +the block/entity UV layouts. Inventory sprites use 16x16 pixels and held spears use 32x32 pixels. +Steel has separate adult, leggings, and 26.2 baby armor atlases. The generated artwork uses the +[Retold Asset License](LICENSE-ASSETS.md); development status grants no additional reuse rights. + +| Record | Contents | +| --- | --- | +| [`retold_asset_revision_2026-10-23.json`](docs/internal/retold_asset_revision_2026-10-23.json) | Current revision's exact prompts, seven active local sources, nine active output paths, per-source packing helpers, output sizes/hashes, and superseded Steel/Guardian/Eye provenance | +| [`aender_asset_prompts_2026-10-12.json`](docs/internal/aender_asset_prompts_2026-10-12.json) | Aender prompts, selected sources, palette direction and processing | +| [`retold_asset_prompts_2026-10-12.json`](docs/internal/retold_asset_prompts_2026-10-12.json) | Equipment, artifact and initial boss prompts/source locations | +| [`gale_core_breeze_prompts_2026-10-12.json`](docs/internal/gale_core_breeze_prompts_2026-10-12.json) | Current Breeze-style Gale armor and matching egg sources | +| [`gale_core_commander_prompts_2026-10-12.json`](docs/internal/gale_core_commander_prompts_2026-10-12.json) | Superseded brass-crown/commander experiment, retained as provenance | + +Working sources, processing scripts and offline previews are optional local files under the ignored +`output/imagegen/` directory, including `aender-refresh-v2/`, `retold-equipment-and-bosses/`, +`gale-core-breeze/`, `revision-2026-10-23/`, and `polish-2026-10-23/`. They are absent from a clean +checkout and are not required by the build or tests. Earlier active manifests link the current revision through +`active_revision_reference`; its output mapping identifies replacement sources. Shipped artwork +lives under the texture paths listed above. + +The July 2026 Aender batches were generated for Retold without Minecraft texture pixels. Developer +screenshots and an End Portal Frame image supplied palette/layout references only. The original +generated Sand was replaced by Xefensor's accepted Krita drawing on 2026-08-14; the developer then +requested generated denim-blue Sand on 2026-10-12. Historical versions retain their authorship. +The rejected Gale brass crown, golem-like face and broken wind bands are superseded by the current +Breeze presentation; they do not describe the installed model. The generated Aender Eye entity +sprites from 2026-10-12 and 2026-10-23 are also historical, superseded at developer request by the +installed vanilla Eye of Ender. Their provenance records remain intact; the custom spawn egg is +a separate asset. -## Provisional And Generated Assets - -The current Aender visuals include AI-generated textures and other provisional development assets. They exist to test terrain, lighting, blocks, portals, and gameplay while original artwork is developed. Aender Sand is the first accepted hand-drawn replacement for one of these generated textures. - -These assets are explicitly **placeholders** and do not represent the intended final visual identity. Placeholder status does not grant permission to extract or reuse them; the asset license still applies. +## Third-Party Material -The provisional portal frame uses the development identifier `retold:dev_aender_portal_frame`. Its name and visuals are planned to change when the final design is chosen. +Minecraft, NeoForge, and other third-party names, APIs, templates, or materials remain subject to +their own terms. NeoForge MDK template files identified by `TEMPLATE_LICENSE.txt` retain that license. The Wildfire entity packages Mojang Studios' 64x64 Minecraft Dungeons Wildfire texture as `textures/entity/wildfire.png`, sourced from the Minecraft Wiki file -[`T HoveringInferno.png`](https://minecraft.wiki/w/File:T_HoveringInferno.png). It is third-party -material, remains copyright Mojang Studios/Microsoft, is not relicensed under Retold's asset -license, and is included for this Minecraft mod subject to the -[Minecraft Usage Guidelines](https://www.minecraft.net/usage-guidelines). The separate Dungeons -shadow texture is not packaged because Java renders entity shadows itself. Retold's dedicated Java -model and animation code map the texture without modifying its pixels. The Nether Reactor Core and -Wildfire Spawn Egg item definitions still reference Minecraft's Magma Cream and Blaze Spawn Egg -models at runtime and package no copied item texture pixels. - -The Aender wood-family placeholders were generated specifically for Retold from prompts describing original purple pixel-art wood components. Mechanical post-processing removed backgrounds, resized the sources to Minecraft texture dimensions, split the door sheet, and assembled sign and boat model textures from the generated material. No Minecraft texture pixels were used in those derived files. - -The Aender Chronolith and spawn-egg placeholders were generated specifically for Retold from prompts describing original purple time-rune stone, a green-eyed Aender egg, and a pale cyan/gold Gale Core egg. Mechanical post-processing removed chroma-key backgrounds and reduced the sources to 16x16 game textures. No Minecraft texture pixels were used in these files. - -The experimental Aender Desert placeholders were generated specifically for Retold from prompts describing original deep denim energy sand, medium periwinkle layered sandstone with a separate smoother top face, and lavender ribbed cactus material. Mechanical post-processing reduced the generated material sources to 16x16 game textures and derived the cactus top from the original generated cactus material. Developer-provided inverted-desert screenshots were used only as color, mood, and block-face-layout references; no pixels from them or from Minecraft textures were included. The generated Aender Sand texture is retained only in Git history: Xefensor replaced the active file with an original hand-drawn Krita texture on 2026-08-14. - -The Aenderite placeholders were generated specifically for Retold from prompts describing muted mint-green and deep teal mineral chips, a raw mineral lump, and a refined ingot. Mechanical post-processing removed chroma-key backgrounds and reduced the item sources to 16x16. The ore pattern was rebuilt as original pixel clusters over Retold's existing animated Aender Stone base and repeated across all animation frames. A developer-provided End Portal Frame image was used only as a green-palette reference; no pixels or frame geometry from that image or from Minecraft textures were included. - -## AI Texture Audit - -The active PNG textures explicitly credited as OpenAI-generated were audited against their introduction commits on 2026-08-14. Companion JSON and `.mcmeta` files are implementation metadata and are not counted as creative textures. Of the 24 credited generated PNGs, 23 remain active AI-generated placeholders and one has been replaced: - -| Batch | Active AI-generated placeholder files | Replacement status | -| --- | --- | --- | -| Aender wood family | `block/aender_door_bottom.png`, `block/aender_door_top.png`, `block/aender_hanging_sign.png`, `block/aender_planks.png`, `block/aender_sapling.png`, `block/aender_sign.png`, `block/aender_trapdoor.png`, `block/stripped_aender_log.png`, `block/stripped_aender_log_top.png`, `entity/boat/aender.png`, `entity/chest_boat/aender.png`, `item/aender_boat.png`, `item/aender_chest_boat.png` | 13 placeholders remain | -| Chronolith and spawn eggs | `block/aender_chronolith.png`, `item/aender_eye_spawn_egg.png`, `item/gale_core_spawn_egg.png` | 3 placeholders remain | -| Aender Desert | `block/aender_cactus_side.png`, `block/aender_cactus_top.png`, `block/aender_sandstone.png`, `block/aender_sandstone_top.png` | The generated `block/aender_sand.png` was replaced by Xefensor's hand-drawn texture; 4 placeholders remain | -| Aenderite | `block/aenderite_ore.png`, `item/raw_aenderite.png`, `item/aenderite_ingot.png` | 3 placeholders remain | - -## Third-Party Material - -Minecraft, NeoForge, and other third-party names, APIs, templates, or materials remain subject to their own terms. NeoForge MDK template files identified by `TEMPLATE_LICENSE.txt` retain that license. - -The packaged Minecraft Dungeons Wildfire texture is credited above and is excluded from the Retold -Asset License. Minecraft and the Wildfire texture are copyright Mojang Studios/Microsoft. - -The Aender portal references the installed `minecraft:block/nether_portal` texture and creates a green sprite at resource-load time. Retold does not package a copied or modified Minecraft portal texture. - -If an asset's authorship, source, license, or status is unclear, do not redistribute or reuse it separately. Contact the developer first. +[`T HoveringInferno.png`](https://minecraft.wiki/w/File:T_HoveringInferno.png). It remains copyright +Mojang Studios/Microsoft, is excluded from the Retold Asset License, and is included for this +Minecraft mod subject to the [Minecraft Usage Guidelines](https://www.minecraft.net/usage-guidelines). +Its dedicated Java model maps the texture without modifying the pixels. The Dungeons shadow +texture is not packaged. Wildfire's egg references the installed Blaze Spawn Egg model. + +Gale Core resolves Breeze geometry, textures, shaders and keyframes, plus the Heavy Core block +model, from installed Minecraft resources. Original circlet/plate geometry and its atlas are Retold +assets. No Breeze or Heavy Core texture/model files are packaged. Standard item parents, armor +geometry and trims remain runtime Minecraft resources, including resource-pack replacements. + +Aender Eye directly reuses the installed `minecraft:textures/item/ender_eye.png` texture as an +emissive billboard, including resource-pack texture replacements. No Eye of Ender texture or model +files are copied into Retold. + +The Aender portal derives its green sprite at resource load from the installed +`minecraft:block/nether_portal` texture. Retold packages no copied or modified portal texture. + +If an asset's authorship, source, license, or status is unclear, contact the developer before +redistributing or reusing it separately. diff --git a/CHANGELOG.md b/CHANGELOG.md index a11485e5..d8ddcdb1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,29 @@ Each release should be readable in two passes: ### Player-Facing +### Technical + +## 0.5.0 - 2026-11-13 + +**Getting started:** [Living-world field guide (PDF)](https://github.com/xefensor/Retold/releases/download/v0.5.0/Retold-Field-Guide.pdf) · [Full player handbook (PDF)](https://github.com/xefensor/Retold/releases/download/v0.5.0/Retold-Player-Guide.pdf) · [Handbook source](https://github.com/xefensor/Retold/blob/v0.5.0/docs/player-guide.md). + +This is an **alpha** release for Minecraft **26.2**, NeoForge **26.2.0.7-beta**, and Java **25**. The full handbook is the 11 November pre-release development edition; its mechanics form the basis of this release. Development artwork is provisional and includes generated assets. Natural-world, connected-client, multiplayer, and long-term balance verification remains incomplete. + +### Player-Facing + +- Added the full player handbook and an eight-page living-world field guide, with Survival essentials, animal care, and three Creative ecology experiments. Downloadable PDF and HTML editions are attached to the GitHub release. +- Added `/retold testworld` for an operator-created content gallery in an Overworld test world. It displays every registered Retold item, block, and entity, includes stocked supply chests, adult/small Steel armor stands, and workshop stations, and teleports the player to its entrance. The command checks empty space and world protection before building; exhibits remain passive, including on Peaceful. See [`docs/test-world.md`](docs/test-world.md). +- Added original development sprites for Flint/Steel equipment and Nether Reactor Core, plus Steel adult, leggings, and baby armor textures with distinct front/back plates and restrained cool-metal shading. Spears have dedicated inventory and held artwork. Earth Guardian uses a blind stone-statue model with quieter carved surfaces, sparse olive moss, and lifecycle and melee poses; awakening follows the synchronized remaining server time. Gale Core combines the installed Breeze head, glowing face, wind and animations with a pale circlet, four thin floating plates, a visible Heavy Core, and a matching egg. Aender Eye directly reuses the installed vanilla Eye of Ender texture as an emissive billboard, including resource-pack texture replacements. Equipment statistics and encounter rules are unchanged; final in-game visual approval remains pending. +- Refreshed Aender development textures with vanilla-scale detail and the original inverted-world palette: purple vegetation, blue soil/bark and desert materials, and cool stone. Grass fringes and ore retain exact Soil and Stone backgrounds. Eight animated material strips become static 16x16 faces. Generated denim-blue Sand replaces the developer drawing, original plank art is preserved, and doors and signs have dedicated inventory sprites. Final in-game visual approval remains pending. +- Fixed Earth Guardians getting stuck on their own lava pools instead of pursuing into the maze. Excavation now removes complete fluid-bearing states, allowing the boss to rebuild its route while retaining material conservation and protection checks. +- Earth Guardians now reshape terrain in bursts of up to 12 blocks every half-second, instead of one block per second. They also build supported 3×3 walls behind their advance from stored solid material, with a two-second wall cooldown. Digging, ramp supports, backfill, and walls share the same burst limit and retain per-block protection and occupancy checks. +- Earth Guardians pursue heard players roughly one-third faster, keep approaching during environmental warnings, and strike at melee range alongside their ceiling, lava, and floor attacks. Contact strikes respect walls, player modes, and a saved 1.5-second cooldown; the boss still tracks vibrations rather than seeing players through walls. +- Earth Guardians no longer restart tunnel construction on every moving footstep. They finish each short excavated walking segment before steering toward the newest vibration, allowing pursuit to enter low maze tunnels. +- Awake Earth Guardians no longer snap back to the central chamber during the dungeon's periodic guardian checks. Existing roaming positions and ongoing behavior are preserved, including after entity reload; dormant and awakening statues remain anchored. +- The Earth Guardian can excavate full-body clearance and build physical ramps toward remembered vibrations when ordinary navigation stops. It stays full-sized and walks the resulting terrain, reusing removed blocks for solid supports and trailing barriers. Its bounded material reserve now holds 128 states, and ramp heading survives reloads. Administrative protection and griefing rules still apply. +- Added dark Earth Labyrinth side rooms with finite-ammunition pressure-plate arrow traps and occasional treasure. Mobs use ordinary natural spawning, without new spawners or lights. Saved content versions keep existing starts unchanged. +- Earth Guardians now drop one Lodestone as the Earth artifact. The vanilla recipe and new Ruined Portal/Bastion Bridge chest Lodestones are removed; existing stacks remain valid. The Dragon Egg now requires all six distinct sacrifices, in any order, before Stage 3. Existing offering progress and already-progressed worlds are preserved. +- Newly generated Jungle Pyramids now contain an initial deterministic randomized Earth Labyrinth far beneath them. Solving the existing lever puzzle reveals a narrow ladder shaft through the unused center of its hidden chamber; only after dropping safely below the complete vanilla mechanism does it turn into a long switchback staircase to an upper maze floor 64 blocks below the pyramid base. Its lower floor is another 14 blocks down. The 77- or 101-block-wide labyrinth is formed from rough carved cave tunnels and irregular junction caverns lined mainly with Stone, Deepslate, Andesite, and Tuff. Junction positions drift away from a regular grid and connecting tunnels bend between them, while Cobblestone and Mossy Cobblestone survive only as traces of the ancient structure. It retains loops and four or five ladder connections outside the arena. Already-generated pyramids remain unchanged. The lower maze wraps around a huge rough central arena with a guaranteed 31-block-wide core and ten blocks of headroom. It contains the initial Earth Guardian foundation: an immovable, indestructible Stage 1 statue that begins a three-second awakening and reveals its boss bar when a Survival player enters the arena during Stage 2. Once awake, the blind guardian becomes damageable, patrols, and investigates remembered player vibrations rather than seeing through walls; direct damage, explosions, projectiles, block changes, containers, ground impacts, and movement provide differently weighted clues, with sneaking handled by Minecraft's vibration rules. It marks the remembered floor for 30 ticks, then cycles through dropping real ceiling blocks with unobstructed fall paths as damaging debris turning a 3×3 layer of ground beneath the marked position into persistent lava sources with normal flow and contact damage, and opening a 3×3 pit up to four blocks deep with ordinary fall damage; overhead dust identifies the blocks being loosened, while open or blocked ceilings fall back to lava. The location is locked when the warning begins, so moving away avoids it. While following a clue anywhere within hearing range, it can permanently excavate any block—including player builds, containers, mechanisms, and Bedrock—and relocate the exact removed block state into barriers behind it, even beyond the labyrinth. Its original stone-statue development appearance still awaits in-game approval; initial trap/treasure rooms and the Lodestone reward are now wired. - Crimson and Warped Forests now generate as open fungal deserts. Their colored nylium, resources, mobs, and atmosphere remain, but giant fungi, roots, sprouts, and vines are much more widely scattered. - Nether fossils no longer generate Dried Ghasts. Dried Ghasts remain craftable, and existing or player-placed blocks can still hydrate into Ghastlings and grow into Happy Ghasts. - Every Nether biome now uses the Nether Wastes' classic dark-red fog instead of changing fog color at biome borders. The Nether also restores a darker Minecraft 1.0-style ambient-light floor, making unlit terrain and distant silhouettes moodier while lava, fire, and other light sources remain effective. @@ -18,10 +41,10 @@ Each release should be readable in two passes: - Wildfire patrol groups now use obstacle-aware airborne routes. The leader checks for clear vertical space, climbs before crossing walls or escaping depressions, and its Blaze escorts route toward their moving line positions instead of continuing to push into terrain. - Wildfire escort Blazes now follow their leader into combat instead of being left where the patrol ended. They inherit the Wildfire's valid target, climb blocked terrain, and regroup into a compact staggered screen around the leader while retaining their vanilla fireball cycle; lava recovery still releases the group. - Wounded Wildfires now recognize only lava columns at least three blocks deep as recovery shelters. They ignore shallow pools, route to the surface of qualifying deep lava, and must remain fully submerged in that deep column to heal health or rebuild shields. -- Wildfires now rule the Stage 2 Nether as roaming minibosses: each has 120 health, 10 armor, four reinforced shields, stronger fireballs, a larger three-second shockwave, and three to five Blaze escorts. Outside combat, the Wildfire leads its numbered escorts on sustained airborne patrols, with the Blazes following in a single-file line instead of scattering randomly; in combat it circles and repositions while preserving the Blaze fireball cycle instead of becoming a stationary turret. Healthy Wildfires keep their heads above lava. At half health, a Wildfire abandons combat, seeks nearby lava, dives completely below the surface, restores all health and shields, and rises again only when fully recovered. Both health and shields regenerate only while its eyes remain below the lava surface; ordinary Fire, Soul Fire, merely touching lava, or hovering above it do not restore shields. Combat or recovery breaks the formation immediately. A dedicated Nether encounter controller now looks for valid ground near an active player every 30 seconds, so biome mob weights and a full ordinary monster population cannot prevent the Wildfire from guarding the Nether. Encounters still respect Peaceful mode, `doMobSpawning`, player safety distance, loaded terrain, normal hostile despawning, and a 128-horizontal/64-vertical Wildfire exclusion zone. Wildfires are also roughly 10% larger, including their combat hitbox. The dedicated model uses the Minecraft Dungeons Wildfire texture, while Retold's faction rules keep the group allied and hostile to Undead. Wildfires still guarantee one Nether Reactor Core; the Dragon Egg accepts and consumes it as Fire, but Fire remains outside the temporary hatch threshold until the Earth path exists. +- Wildfires now rule the Stage 2 Nether as roaming minibosses: each has 120 health, 10 armor, four reinforced shields, stronger fireballs, a larger three-second shockwave, and three to five Blaze escorts. Outside combat, the Wildfire leads its numbered escorts on sustained airborne patrols, with the Blazes following in a single-file line instead of scattering randomly; in combat it circles and repositions while preserving the Blaze fireball cycle instead of becoming a stationary turret. Healthy Wildfires keep their heads above lava. At half health, a Wildfire abandons combat, seeks nearby lava, dives completely below the surface, restores all health and shields, and rises again only when fully recovered. Both health and shields regenerate only while its eyes remain below the lava surface; ordinary Fire, Soul Fire, merely touching lava, or hovering above it do not restore shields. Combat or recovery breaks the formation immediately. A dedicated Nether encounter controller now looks for valid ground near an active player every 30 seconds, so biome mob weights and a full ordinary monster population cannot prevent the Wildfire from guarding the Nether. Encounters still respect Peaceful mode, `doMobSpawning`, player safety distance, loaded terrain, normal hostile despawning, and a 128-horizontal/64-vertical Wildfire exclusion zone. Wildfires are also roughly 10% larger, including their combat hitbox. The dedicated model uses the Minecraft Dungeons Wildfire texture, while Retold's faction rules keep the group allied and hostile to Undead. Wildfires still guarantee one Nether Reactor Core; the Dragon Egg accepts and consumes it as Fire, and Fire is now required alongside the other five sacrifices. - Wildfires now receive the same maximum block light as Blazes, and their model maps the fiery head separately beneath the fitted helmet instead of rendering the helmet pixels as the head itself. Its two white eyes are mapped into the dark helmet band beneath the unchanged red-and-white forehead jewel. - Blazes and Wildfires now recognize Ghasts as enemy Undead instead of inheriting vanilla's blanket Mob-versus-Ghast target rejection. Wildfires acquire and retain visible Ghasts throughout their full 64-block combat range, so distant Ghasts cannot attack a helpless leader from outside the shared faction radius. Their Small Fireballs damage both Ghasts and Wither Skeletons as intended while those targets retain ordinary fire and lava immunity. -- Gale Cores now drop a Heavy Core for the Air sacrifice, while Elder Guardians drop a Heart of the Sea for Water. Buried treasure no longer contains Hearts of the Sea, keeping that artifact tied to the Ocean Monument path. Existing Air and Water Element items remain valid offerings for upgraded worlds, but are no longer encounter rewards or ordinary Creative-tab entries. Totems of Undying and Nether Stars are now accepted as Life and Death sacrifices, raising the temporary hatch requirement to Air, Water, Life, and Death until Earth is obtainable. +- Gale Cores now drop a Heavy Core for the Air sacrifice, while Elder Guardians drop a Heart of the Sea for Water. Buried treasure no longer contains Hearts of the Sea, keeping that artifact tied to the Ocean Monument path. Existing Air and Water Element items remain valid offerings for upgraded worlds, but are no longer encounter rewards or ordinary Creative-tab entries. Totems of Undying and Nether Stars are now accepted as Life and Death sacrifices, joining Air, Water, Fire, and Earth in the six-sacrifice hatch requirement. - Villagers now share persistent knowledge of food, emeralds, and every other item they have observed in accessible village chests and barrels. Once a store is known, other villagers can go directly to the right container instead of repeating a nearby block search; player, hopper, and Villager inventory changes refresh active-village knowledge, while the physical container is still checked before use. - Villagers now keep their body and head aimed at an extinguished torch throughout both magical and Flint-and-Steel relighting. After a successful relight, they continue directly to other eligible nearby torches, handling up to eight per maintenance run before taking a break. Other stationary Retold interactions with a concrete subject now visibly face it as well, including golem construction, communal storage and livestock tending, feeding, desperate barrier breaking, Polar Bear warnings, and Spider web placement. - Healthy Wolves, Foxes, Cats, Ocelots, Dolphins, Spiders, and Cave Spiders now defend themselves after being attacked. This includes tamed Wolves, while tame-owner safety and the rule that badly wounded wild predators flee instead of fighting remain intact. @@ -48,7 +71,7 @@ Each release should be readable in two passes: - Parrots now use Retold hunger: they eat dropped seeds and supported crops, visibly perform their eating animation, and remove crop blocks only when `mobGriefing` allows it. Tamed Parrots give a distinct sound-and-particle warning when a real nearby threat attacks or actively targets their owner, including while riding on the owner's shoulder; the warning does not make the Parrot attack. - The survival opening now begins with Sticks and Flint instead of punching logs. Leaves have an additional 20% chance to drop 1–2 Sticks, increasing by five percentage points per Fortune level; Dead Bushes drop 2–4 Sticks, while living Bush, Firefly Bush, Rose Bush, and Sweet Berry Bush blocks have a 10% chance to drop one. Shears and Silk Touch preserve the relevant blocks without extra Sticks. Logs require a suitable tool, the 2x2 Flint Multi-tool harvests the first wood, exposed Copper, and soft early stone, and vanilla Wooden and Stone tool recipes no longer bypass the material ladder. Copper generation now makes six vein attempts per chunk instead of sixteen while preserving normal vein sizes, reducing cave-wall clutter without making each discovery unrewarding. Copper Pickaxes can harvest normal Stone for Cobblestone, but do so at 25% speed until Iron makes ordinary mining practical. - Campfires are now crafted from three Sticks and three Logs without Coal or Flint and begin unlit immediately when placed, without briefly flashing their lit appearance. Using a bare Flint lights one and consumes that Flint in Survival, while Flint and Steel retains its normal durability-based ignition. Clay Balls fire into Bricks on a Campfire; eight Bricks in a ring then craft the Brick Furnace, Retold's renamed Smoker. It keeps food cooking, makes Charcoal from burnable logs, and processes Raw Copper and both Copper ores so players can reach Copper before obtaining Cobblestone for a normal Furnace. -- Blast Furnaces now process Iron Ingots directly into Steel Ingots using any ordinary fuel. The Spear now follows Flint, Copper, Iron, Steel, and Diamond progression, with new Flint and Steel Spears using provisional Stone and Iron visuals. Steel provides a full Pickaxe, Axe, Shovel, Hoe, Sword, Spear, and armor tier between Iron and Diamond. Pre-Steel tools cannot harvest Deepslate-family blocks, Deepslate ores, or normal Diamond Ore; Copper and Iron also break Deepslate painfully slowly. Steel unlocks all Diamond Ore and full deep mining, while Obsidian and Ancient Debris remain locked to Diamond. +- Blast Furnaces now process Iron Ingots directly into Steel Ingots using any ordinary fuel. The Spear now follows Flint, Copper, Iron, Steel, and Diamond progression, with new Flint and Steel Spears now using original development sprites. Steel provides a full Pickaxe, Axe, Shovel, Hoe, Sword, Spear, and armor tier between Iron and Diamond. Pre-Steel tools cannot harvest Deepslate-family blocks, Deepslate ores, or normal Diamond Ore; Copper and Iron also break Deepslate painfully slowly. Steel unlocks all Diamond Ore and full deep mining, while Obsidian and Ancient Debris remain locked to Diamond. - Alternative equipment acquisition now follows fixed world rules in single-player and multiplayer. Bonus chests provide one Flint Multi-tool instead of Wooden/Stone tools; safe Village smith chests stop at Copper equipment and at most two Iron Ingots. Smith equipment trades unlock Copper at Apprentice for 8–12 Emeralds, Iron at Expert for 24–32, and Diamond at Master for 48–64, with enchanted Diamond offers rarer than unenchanted ones. The Wandering Trader retains its rare enchanted Iron Pickaxe at an enchantment-adjusted price around 48 Emeralds. - Mending can no longer be newly generated by Librarian trades or random loot. Existing Mending items continue to function, and commands and Creative mode retain the enchantment. - Unenchanted Diamond tools and Spears now have only 64 durability, while unenchanted Diamond armor has leather-like 6x durability. Diamond Horse and Nautilus Armor now use 96 durability before enchanting and 528 afterward, and lose durability from real hits like other armor. Any enchantment—including a curse by itself—immediately restores full Diamond durability; removing every enchantment makes the item fragile again. A heavily damaged item stripped beyond that fragile limit retains one final use instead of becoming invalid immediately. @@ -69,6 +92,11 @@ Each release should be readable in two passes: ### Technical +- Fixed the Earth Guardian remaining stationary after claiming movement control: vibration pursuit now uses Retold's budgeted movement helper, and idle patrol starts its selected path through the existing ownership bypass. Failed investigation paths no longer trigger a retry every tick. +- Replaced the data definition behind the existing `minecraft:jungle_pyramid` registry id with a Retold composite structure for new starts. It serializes a compatible Jungle Temple wrapper plus a separate Earth Labyrinth piece seeded from the world and structure chunk; old serialized vanilla pieces therefore do not gain a maze. The access route uses the vanilla hidden chamber's unused center tile, descends through a one-block ladder shaft, and delays all broad or horizontal carving until eight blocks below the temple foundation so the surrounding redstone, pistons, repeater, chest, and supports remain intact. Pure planner tests cover deterministic connected topology across 512 seeds, while focused GameTests cover registry replacement, new/old piece round trips, safe lever-room stair egress, and placed chamber, passage, ladder, and entrance geometry. +- Added `retold:earth_guardian`, its boss profile/faction membership, spawn egg, original development stone-statue renderer, and labyrinth-owned spawn controller. Loaded Retold labyrinth pieces resolve their fixed guardian chamber without affecting saved vanilla pyramids; repeated scans repair one matching persistent guardian and discard duplicates. Server SavedData records `DORMANT`, `AWAKENING`, `ROAMING`, and `DEFEATED` per labyrinth so reloads retain progress and cleared encounters do not respawn. The entity independently serializes chamber ownership, awakening, labyrinth bounds, vanilla vibration-listener state, its strongest remembered player clue, and pending environmental attack state. `ROAMING` makes the guardian damageable and uses a dynamic game-event listener, weighted multiplayer clue replacement, bounded path retries, maze patrol, and `EARTH_GUARDIAN` movement ownership without assigning a sight target. Heard-player contact melee now runs alongside environmental attacks with range, obstruction, player-mode, and saved-cooldown guards. Clues within 24 blocks can begin a 30-tick fixed-location warning. Rotating releases convert up to five real, protection-approved ceiling blocks with clear vertical fall paths into damaging falling debris replace a 3×3 supporting layer beneath the locked position with persistent lava sources, or remove up to 36 blocks to open a 3×3 pit four blocks deep, leaving flow, contact damage, and falling to Minecraft; missing ceiling material falls back to lava. Its twelve-edit-per-half-second terrain controller accepts any non-air block in a loaded chunk, including player blocks, block entities, mechanisms, fluids, and normally indestructible states, without a labyrinth boundary. It retains exact states in a persisted 128-block reserve and spends them on entity-clear air positions behind the guardian. Each edit, ceiling removal, lava conversion, and pit excavation still rechecks NeoForge griefing, `mobGriefing`, and Retold world protection so server administrators and claim integrations remain authoritative. Focused tests cover lifecycle, duplicate repair, save/load, spawn-egg mapping, vibration weighting, movement ownership, rejected unrelated/distant direct melee, environmental warning/persistence, real-tick fixed-location warning and falling-block impact, clear-path and fallback behavior, lava ground conversion, independent break/place protection, griefing changes during windup, real lava contact damage, bounded floor collapse and protected columns, real fall damage, and legacy next-attack save migration, unrestricted Chest/Bedrock relocation outside encounter bounds, conservation, protection denial, and the permanent defeat boundary. +- Fixed the dormant Earth Guardian disconnecting clients when its spawn packet was received near a Jungle Pyramid. Client construction no longer queries server AI ownership before Minecraft assigns the guardian's network entity ID. +- Added Earth Guardian to the isolated per-mob performance registry, expanding current registration to 84 tests and 420 phases. Its refreshed 50-active-guardian run sustains 20 TPS through all five phases with a 7.302 ms/tick peak after adding supported excavation routes. The benchmark disables block griefing, so accumulated lava-flow cost remains unmeasured. - Reworked generic faction assistance around defensive calls from successful post-mitigation damage or an enemy's active faction target. Only the threatened side is notified; selecting or hitting a target no longer rallies the attacker's own faction, the caller is excluded from its responder scan, and specialist identities such as broad Undead, Enders, Guardians, Creepers, bosses, and Wardens retain their narrower owners. A cached 32-block query recruits at most eight idle adult witnesses through `FACTION_ASSIST` ownership, with exact-species damage-response defaults supplied by the additive `retold:shared_defense_species` tag. Wolf responders enter controlled combat and yield to wounded flight or another live threat, while Polar Bears retain their native combat controller. The focused integrated GameTest covers both default species, same-owner tame packs, baby/sitting/different-owner exclusions, target-side and damage-side cross-species Nether Remnant defense, callers, busy allies, attacker-side non-rally, and specialist boundaries. Exact 50-Wolf and 50-Piglin benchmarks sustain 20 TPS with 6.282 and 7.583 ms/tick peaks. - Added event-driven recent-damage threat scoring for ordinary combat-capable profiles. Each mob retains at most eight attackers and sixteen hits per attacker for five seconds; the score weights the largest hit twice plus half of accumulated damage, requires a challenger to exceed the current target by 20% plus one point, and locks further switches for one second. Assignment uses `RETALIATION` ownership and the central target policy. `SPECIAL_VANILLA` and `APEX_OR_BOSS` profiles keep their dedicated selectors, and no scan or periodic tick work was added. Five focused policy tests and the exact real-damage GameTest pass. - Made Retold combat-target refreshes idempotent. `RetoldFactionTargetMemory` treats an already-current target with the same source as a successful no-op, and `RetoldCombatTargets` no longer reasserts `aggressive=true` for that stable refresh. Explicit non-aggressive assignments, target changes, and source transitions still update pose and ownership. The exact Skeleton regression failed on the old repeated weapon raise and now passes while retaining active bow use and a real `FACTION_COMBAT`-to-`RETALIATION` transition. @@ -85,7 +113,7 @@ Each release should be readable in two passes: - Added `retold:wildfire`, its `SPECIAL_VANILLA` mob profile, Nether Remnant tag membership, Stage 2+ dedicated Nether encounter owner, attributes, guaranteed reward, dedicated renderer/model, spawn egg, and focused spawn/combat/reward coverage. Every 600 ticks, the owner selects one active Nether player and makes up to 16 loaded-terrain probes 48–96 blocks away. This path bypasses biome spawn-list weights and the ordinary monster cap while retaining Stage 2, Peaceful, `doMobSpawning`, collision, ground, player-distance, normal-despawn, and 128-horizontal/64-vertical Wildfire-exclusion checks. A successful encounter finalizes with three to five Blaze escorts. Persisted escort UUID slots drive a low-priority `WILDFIRE_FORMATION` patrol: the leader selects sustained open airborne destinations and each Blaze follows 2.25 blocks behind its preceding slot. A persisted escort marker restricts the Wildfire and those encounter Blazes to targetable players and Retold-tagged Undead, including through retaliation and vanilla `canAttack`; non-escort Blazes retain their ordinary behavior. A separate lower-than-recovery `WILDFIRE_COMBAT` owner chooses up to six loaded, collision-free orbit positions every 40 ticks, keeping the leader mobile without replacing vanilla Blaze fireball timing. Its entity dimensions are 1.0 by 3.0 blocks and the renderer applies a 1.3 scale. The boss-tier tuning gives it 120 health, 10 armor, 60% knockback resistance, 50 XP, eight-damage fireballs, four synchronized and persisted 12-damage shields with a 12-tick break window, and a six-block, 10-damage knockback shockwave on a three-second cooldown. Healthy lava buoyancy is replaced at half health by a persisted `WILDFIRE_RECOVERY` cycle: an owned collision-aware flight path uses the cached `DEEP_LAVA_SOURCE` search for a column at least three blocks deep, clears combat, fully submerges, restores six body-health points every 20 ticks alongside the existing shield cadence, then resurfaces only at full health and four shields. Both regeneration paths use live deep-site and eye-level lava-submersion gates; Fire, Soul Fire, shallow lava, and surface lava contact are rejected. Exact encounter target-gating, spawn, healthy lava-surface, shallow-lava rejection, deep-source selection, full lava-recovery, and combat-movement tests cover these contracts. The latest 50-Wildfire run sustained 20 TPS in every phase with a 4.876 ms/tick peak. - Removed vanilla fire immunity from Zombified Piglins so Blaze- and Wildfire-owned fireballs can damage and continue burning them. Stage 2 sunlight protection now suppresses only vanilla sunlight ignition instead of clearing every Undead fire effect each tick. The Wildfire entity type is explicitly fire-immune, and a focused Stage 2 GameTest covers both attackers and the ongoing burn. - Added a faction-scoped exception to vanilla's universal Mob-versus-Ghast attack rejection, allowing only Retold faction enemies to acquire visible Ghasts. Wildfire-to-Ghast acquisition and retention use the Wildfire's full 64-block follow range, while other faction pairs use the attacker's central species/profile-aware boundary. The narrow Nether Remnant Small Fireball exception also permits direct damage to Ghasts without removing their general fire immunity. The exact 50-Wildfire rerun sustained 20 TPS in all phases with a 5.967 ms/tick peak. -- Replaced the four-value element enum with a save-compatible six-slot ritual-offering model covering Air, Water, Fire, Earth, Life, and Death. Existing bit assignments and the serialized `offered_elements` field remain unchanged. Fire, Life, and Death are wired to their final items, while the temporary required mask remains Water/Air/Life/Death until Earth completes all six. Focused GameTests cover six distinct saved offerings, five active item mappings, legacy aliases, consumption and duplicate rejection, guardian rewards, and the buried-treasure exclusion. +- Replaced the four-value element enum with a save-compatible six-slot ritual-offering model covering Air, Water, Fire, Earth, Life, and Death. Existing bit assignments and the serialized `offered_elements` field remain unchanged. All six are wired to their final items and required for hatching. Focused GameTests cover six distinct saved offerings and active item mappings, legacy aliases, consumption and duplicate rejection, actual Stage 3 hatching, guardian rewards, and the buried-treasure and Lodestone acquisition exclusions. - Added `RetoldVillageStorageKnowledge`, a server-authoritative SavedData index of observed chest/barrel positions, slot capacity, and exact item stacks. Chunk-indexed lookups feed the existing communal food, Farmer deposit, livestock-tending, and golem-emerald search paths before a budgeted world scan. A narrow block-entity change hook refreshes known or village-local storage without polling; every target is loaded, accessible, and physically revalidated, and stale entries are repaired or removed. Focused shared-knowledge, food-route, Farmer-route, livestock, golem-currency, and Villager TPS coverage passes. - Added `RetoldActionFacing` as the shared body/head/look-control contract for stationary Retold actions. Magical torch casts and Villager golem work receive continuous presentation updates only while the Villager is actively using its subject; movement, pursuit, combat, migration, and free-flight behavior retain ordinary look control so body rotation does not fight navigation. Successful torch work now reuses the indexed, budgeted search to start the next eligible nearby torch immediately, capped at eight relights per interruptible run. Focused facing regressions pass for torch relighting, golem construction, feeding, and weak-barrier breaking. - Added `RetoldUndeadStagePressure` to stage-gate Zombie- and Skeleton-family notice/share radii and bounded cross-family assistance. Stage 2 responders use cached scans and sight, stable one-in-three sampling, source-aware `FACTION_ASSIST` targets, and existing combat/movement ownership. `RetoldUndeadSpawnPressure` mirrors already-present entries from the additive `retold:stage_2_undead_spawn_pressure` entity-type tag with a rounded 25% bonus weight while vanilla retains selection, caps, placement, and pack rules. Both exact Stage 1/Stage 2 tests pass, and all forty affected Stage 2 50-mob phases remain below 50 ms/tick; Zombie hunt/targeting was the 6.046 ms/tick peak. diff --git a/README.md b/README.md index fd22889e..5b02c759 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ Retold is independently developed and is not an official Minecraft product or so ## What Retold Changes - **Connected progression:** defeating the Ender Dragon changes the world instead of ending the game. -- **Element paths:** Water and Air lead through the ocean monument and Air Temple, while boss-tier Stage 2 Wildfires provide the Nether Reactor Core for Fire. Earth remains planned. +- **Element paths:** Water and Air lead through the ocean monument and Air Temple, boss-tier Stage 2 Wildfires provide the Nether Reactor Core for Fire, and newly generated Jungle Pyramids contain the initial Earth Labyrinth and a blind Earth Guardian that permanently reshapes terrain and turns remembered vibration locations into ceiling collapses, real lava pools, or collapsing floors. The guardian drops Lodestone for the six-sacrifice egg ritual, while dark side branches contain traps and occasional treasure. - **The Aender:** a bright, unstable late-game dimension that replaces normal survival End progression after the dragon egg ritual. - **Living mobs:** hunger, homes, ranges, factions, territory, hunting, fleeing, warnings, and group behavior. - **Discovery-first crafting:** recipe knowledge and villager teaching replace a recipe-book-first experience. @@ -56,7 +56,7 @@ Only the locations linked above are official downloads. Version settings are def The current build includes the survival spine, Water and Air progression, staged world changes, Aender foundations, recipe discovery, and the Retold mob-behavior framework. Major unfinished areas include: - wider seed, upgraded-world, server, and multiplayer verification of the cartographer Air Temple map, plus further Gale Core tuning -- the Earth element path and natural-world Wildfire presentation/balance verification +- Earth Labyrinth trap/treasure room tuning, guardian final presentation, and natural-world maze/vibration/combat/terrain-shaping and six-sacrifice progression verification, plus Wildfire presentation/balance verification - original replacements for provisional Aender assets and naming - Aender travel networks and late-game rewards - broader progression, combat, village, and world-generation work diff --git a/ROADMAP.md b/ROADMAP.md index b1da037b..e559e026 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -13,8 +13,10 @@ This concise public roadmap may change as features are designed and tested. Deta ## Next -- Design and implement the Earth path around a custom terrain-building guardian and the current working Lodestone sacrifice. -- Complete the intended six-sacrifice Dragon Egg ritual in any order once the Earth path is survival-obtainable. +- Build on the generated Earth Labyrinth and its vibration-investigating, terrain-relocating + persisted Earth Guardian: verify and tune the initial trap/treasure side rooms, natural dark-area + spawns, environmental hazards, and Lodestone reward. +- Verify the six-sacrifice Dragon Egg ritual in any order, including upgraded worlds and multiplayer. - Verify and tune the implemented Life path around Evokers and Totems of Undying and the Death path around the Wither and Nether Star. - Add Aender in-dimension transportation and meaningful late-game building or travel rewards. - Audit survival removal or replacement of incompatible modern structures and progression. @@ -30,8 +32,8 @@ See [`docs/element-ritual.md`](docs/element-ritual.md) for the current ritual, a ## Open Decisions - Whether Stage 1 should require the Wither or a Nether Star before End access, given the Nether Star's intended Stage 2 Death-sacrifice role. -- Whether Lodestone remains the final Earth sacrifice. - The final roles of Nether and Aender dragons. -- Whether pyramid boss tombs, a world ending, or New Game+ belong in Retold. +- Whether Desert Pyramids or additional structures should receive boss tombs beyond the confirmed + Jungle Pyramid Earth Labyrinth, and whether a world ending or New Game+ belongs in Retold. Focused proposals are welcome through the [suggestion form](https://github.com/xefensor/Retold/issues/new?template=suggestion.yml). Explain the player-facing problem and how the proposal supports Retold's design pillars. diff --git a/build.gradle b/build.gradle index 7b6a3a89..c6260f1c 100644 --- a/build.gradle +++ b/build.gradle @@ -121,6 +121,7 @@ configurations { dependencies { testImplementation platform('org.junit:junit-bom:6.1.2') testImplementation 'org.junit.jupiter:junit-jupiter' + testImplementation 'com.google.code.gson:gson:2.14.0' testRuntimeOnly 'org.junit.platform:junit-platform-launcher' // Example optional mod dependency with JEI @@ -199,6 +200,27 @@ tasks.named('test', Test).configure { useJUnitPlatform() } +// Bake and pose client models without creating a game window or requiring a graphics device. +sourceSets { + clientModelTest { + java.srcDir 'src/testClient/java' + compileClasspath = sourceSets.main.output + sourceSets.main.compileClasspath + runtimeClasspath = output + compileClasspath + sourceSets.main.runtimeClasspath + } +} + +tasks.register('validateBossModels', JavaExec) { + group = 'verification' + description = 'Checks boss model geometry, synchronized poses, and independent layer transforms.' + dependsOn tasks.named('clientModelTestClasses') + classpath = sourceSets.clientModelTest.runtimeClasspath + mainClass = 'cz.xefensor.retold.client.render.RetoldBossModelChecks' +} + +tasks.named('check').configure { + dependsOn tasks.named('validateBossModels') +} + // IDEA no longer automatically downloads sources/javadoc jars for dependencies, so we need to explicitly enable the behavior. idea { module { diff --git a/docs/README.md b/docs/README.md index a1cd3b5c..39584e6e 100644 --- a/docs/README.md +++ b/docs/README.md @@ -4,8 +4,11 @@ This directory separates player-facing design information from detailed develope ## Public Project Documents +- [`player-guide.md`](player-guide.md) — beginner handbook with survival walkthroughs, full recipe and lesson references, animal care, territory, progression, dimensions, and commands +- [`klei-field-guide.md`](klei-field-guide.md) — eight-page ecology companion for Klei, with Survival essentials and a Creative playground; export and capture notes in [`internal/klei-outreach.md`](internal/klei-outreach.md) - [`design-overview.md`](design-overview.md) — world premise and design pillars - [`element-ritual.md`](element-ritual.md) — current Dragon Egg ritual, six sacrifices, and guardian direction +- [`test-world.md`](test-world.md) — create a Retold item, block, entity, and equipment inspection gallery - [`../ROADMAP.md`](../ROADMAP.md) — concise public priorities - [`../CHANGELOG.md`](../CHANGELOG.md) — released and unreleased changes - [`../SUPPORT.md`](../SUPPORT.md) — help and problem reporting diff --git a/docs/design-overview.md b/docs/design-overview.md index 176a937e..ef33de46 100644 --- a/docs/design-overview.md +++ b/docs/design-overview.md @@ -36,7 +36,11 @@ The Aender is the dimension of change: an unstable, bright, strange, and dangero 2. **Stage 2:** defeating the dragon makes the world more dangerous and begins the Dragon Egg ritual built around four classical elements plus Life and Death. 3. **Stage 3:** completing the ritual hatches the egg, redirects normal End access to the Aender, and begins returning the Nether toward balance. -The intended ritual uses six consumed artifacts: Heavy Core (Air), Heart of the Sea (Water), Nether Reactor Core (Fire), Lodestone (Earth), Nether Star (Death), and Totem of Undying (Life). Air, Water, Life, and Death currently control hatching; the implemented Fire offering is recorded but remains outside that threshold until the unfinished Earth path makes all six obtainable. See [`element-ritual.md`](element-ritual.md) for the current guardian and encounter direction. +The intended ritual uses six consumed artifacts: Heavy Core (Air), Heart of the Sea (Water), Nether +Reactor Core (Fire), Lodestone (Earth), Nether Star (Death), and Totem of Undying (Life). +All six now control hatching. The Earth Guardian supplies Lodestone, while side branches contain +initial arrow traps and treasure with no added lights or spawners. See [`element-ritual.md`](element-ritual.md) for the generated Jungle Pyramid labyrinth, +persisted guardian lifecycle, blind terrain relocation, and implemented environmental combat direction. ## The Aender diff --git a/docs/element-ritual.md b/docs/element-ritual.md index 35d8d4f9..1ae1f61f 100644 --- a/docs/element-ritual.md +++ b/docs/element-ritual.md @@ -1,6 +1,6 @@ # Dragon Egg Ritual And Sacrifices -> Current design direction as of 2026-08-19. This document records the intended player-facing design; several parts are not implemented yet. +> Current design direction as of 2026-09-07. This document records the intended player-facing design; several parts are not implemented yet. ## Role In Progression @@ -13,11 +13,14 @@ The ritual uses **six artifact sacrifices**. Four represent the classical elemen | Air | **Heavy Core** | **Gale Core** | Air Temple / Gale Core path exists and now rewards the Heavy Core. | | Water | **Heart of the Sea** | **Elder Guardian** | Ocean Monument / Elder Guardian path exists and now rewards the Heart of the Sea. | | Fire | **Nether Reactor Core** | **Wildfire** | Initial path implemented: a rare Stage 2+ Nether guardian roams, attacks undead, and guarantees the core. | -| Earth | **Lodestone** | **Custom Earth Guardian** | Working item choice. The guardian's defining mechanic is terrain construction: it places/builds blocks between itself and the player, forcing the player to mine through its defenses. | +| Earth | **Lodestone** | **Custom Earth Guardian** | Confirmed Jungle Pyramid labyrinth path. The blind guardian permanently excavates and relocates any loaded block while following players inside or outside the structure. | | Death | **Nether Star** | **Wither** | The Wither is the Death-associated challenge and the Nether Star is its sacrifice. | | Life | **Totem of Undying** | **Evoker** | The Evoker/Totem connection matches Retold's existing illager lore around avoiding death. | -The **Nether Reactor Core** is the confirmed Fire artifact. The **Lodestone** remains a working Earth choice and may still change. +The **Nether Reactor Core** is the Fire artifact, and **Lodestone** is the confirmed Earth artifact. +The Earth Guardian drops one Lodestone through its entity loot table (subject to normal mob-loot +rules). The ordinary Lodestone recipe and new Ruined Portal/Bastion Bridge chest Lodestones are +removed. Existing stacks remain valid; datapacks can deliberately override these acquisition rules. ## Ritual Rules @@ -38,6 +41,10 @@ and Wither acquisition paths. Existing items from older worlds remain valid. ### Air — Gale Core +Its development presentation uses the installed Breeze head, glowing face, wind and animations, +with a pale circlet and four thin floating plates around a visible Heavy Core. The core uses the +installed block model, including resource-pack overrides. Final in-game visual approval remains open. + The existing Air Temple and Gale Core encounter remain the Air path. The Gale Core now drops the **Heavy Core**. The temporary custom Air Element remains registered and accepted only so existing worlds do not lose held progression items. @@ -65,9 +72,97 @@ need in-game verification. Earth uses a new Retold mob rather than repurposing an existing Minecraft boss. -Its defining combat behavior is **building with the terrain**. The guardian creates block barriers and defenses between itself and the player. Reaching it requires the player to mine through those defenses, making mining itself a central part of the encounter rather than using an ordinary combat boss with an Earth visual theme. - -The current Earth sacrifice is the **Lodestone**. The guardian's final name, appearance, location, exact block-placement rules, and acquisition flow are still to be designed. +Every newly generated Jungle Pyramid contains a deterministic, seed-randomized **Earth +Labyrinth** beneath it. Solving the pyramid's existing lever puzzle reveals the staircase into the +maze. Already-generated Jungle Pyramids remain untouched; upgraded worlds must explore newly +generated terrain to find the enhanced structure. The implemented footprint is 77 or 101 blocks +wide across two connected levels. The upper maze floor lies 64 blocks below the pyramid +base, and the lower floor lies another fourteen blocks down. A long walkable switchback staircase +connects the secret room to the fixed entrance; the maze has a fixed central guardian chamber, +multiple stairs, loops, alternate routes, and randomized trap/treasure side branches. Additional +puzzle or combat-room systems are not part of the confirmed room direction. + +The labyrinth should read as an ancient cave network that was cut, reinforced, and occupied rather +than as a regular block-built grid. Its implemented base geometry offsets junctions from their +logical cells, bends connecting tunnels through deterministic intermediate points, and uses +separated rough tunnels, irregular junction caverns, and a depth-aware Stone, Deepslate, Andesite, +and Tuff palette. Cobblestone and Mossy Cobblestone are limited to ruined structural accents and +the access stairs. + +Before Stage 2, the guardian is an immovable, indestructible ancient jungle stone statue in the +central chamber. It has no AI, boss bar, damage, knockback, pushing, or portal movement. Reaching +Stage 2 makes it eligible to awaken, but it remains dormant until a player returns to the chamber. +Its persisted encounter lifecycle is `DORMANT → AWAKENING → ROAMING/COMBAT → DEFEATED`. A defeated +labyrinth remains permanently cleared and its guardian does not respawn. + +The guardian is blind. It patrols and navigates through its knowledge of the labyrinth while mining, +movement, block placement, containers, projectiles, explosions, direct damage, and very close +ground contact provide differently weighted vibration clues. Sneaking reduces movement noise, and +the guardian investigates a remembered vibration position instead of receiving perfect awareness +through walls. In multiplayer it chooses among actual vibration sources rather than automatically +knowing every player's position. + +Its defining combat behavior is **permanently reshaping the world around it**. The guardian can +excavate any non-air block in a loaded chunk to create paths for itself, retains the removed block +state as a bounded reserve, and relocates that material into persistent barriers elsewhere. There +is no labyrinth boundary or block whitelist: player builds, containers, puzzle mechanisms, block +entities, fluids, and normally indestructible blocks such as Bedrock are all valid. Every edit still +obeys `mobGriefing`, NeoForge's entity-griefing hook, and `RetoldWorldProtection`, allowing server +administrators and claim integrations to disable it. Relocation rather than unlimited creation +avoids an infinite block farm while leaving a permanent physical record of the encounter. + +The guardian's final model and palette still need design approval. Side branches now receive up to +six content rooms per floor: pressure-plate arrow traps and occasional treasure chests. Rooms add +no lighting or spawners; normal darkness, biome, difficulty, distance, and mob-cap rules govern +natural mobs. Loot and finite dispenser ammunition use Retold-owned loot tables. Content version 1 +is saved on new starts; older starts retain empty rooms, including their not-yet-generated chunks. +The initial implementation replaces new Jungle Pyramid starts +with a compatible composite structure under the same registry id, attaches a serialized labyrinth +piece, and places the deterministic two-level maze, safe secret-room staircase, carved cave +tunnels, irregular junction caverns, and ladder connections using a provisional natural-stone +palette. It now registers `retold:earth_guardian`, spawns exactly one structure-owned guardian at +the fixed chamber, and persists `DORMANT`, `AWAKENING`, `ROAMING`, and `DEFEATED` encounter state. +The guardian is an immovable, indestructible Stage 1 statue; a Survival player entering its chamber +in Stage 2 starts a three-second awakening and reveals its boss bar. Its original development +model is a blind weathered stone statue with dormant, awakening, walking, and melee poses; final +model/palette and in-game visual approval remain pending. After awakening, it uses Minecraft's +vibration system to patrol and investigate weighted remembered player clues without acquiring a sight target; the clue +and listener state survive reloads. Vibration clues may originate outside the maze. While pursuing +one, its terrain controller batches permanent changes: it excavates any loaded +non-air block into a persisted 128-state reserve and later spends that exact material on an +entity-clear barrier behind it. When ordinary navigation stops, a short route builder clears +three-wide body passages and constructs one-block ramp steps with longer landings, using only +solid full-block states from its reserve for support. It retains its 3.2-block height and physically +walks the carved route. Uphill/downhill heading persists across reloads; short work segments are +recomputed from the actual position, and player edits can invalidate and rebuild them. Excavation +and backfill share a budget of up to 12 changes every ten ticks (half a second). Once a segment +is walkable, spare budget can build a supported 3×3 wall three to six blocks behind the guardian, +at most once every forty ticks. Walls require at least 18 stored states and consume only solid +full-block states, leaving material for subsequent traversal; occupied and protected cells stay empty. +There is no block-type, ownership, or labyrinth-bound restriction on excavation; +only `mobGriefing`, NeoForge's entity-griefing hook, and Retold world protection can deny an edit. +Once roaming, it becomes damageable and aggressively closes on heard positions. At contact range +it can strike the heard Survival player with its Iron Golem attack, at most once every 30 ticks. +A fresh obstruction check prevents wall hits, and Creative/Spectator players remain excluded. +Pursuit is one-third faster than the initial investigation pass and continues during environmental +warnings; reaching a clue no longer discards it before contact combat. No live sight target is acquired. +A remembered vibration within 24 blocks marks the floor for a +30-tick environmental warning. The guardian cycles through pulling up to five real blocks out +of a valid ceiling as damaging falling debris, turning a 3×3 layer of ground beneath the marked +position into real lava sources, and opening a 3×3 pit up to four blocks deep. The pit remains in the +world and causes ordinary falling and landing damage; protected blocks stop excavation in their +column. Creatures left above the lava patch fall into lava and take normal +Minecraft contact damage; the attack adds no scripted damage or launch. Ceiling dust identifies the actual blocks +being loosened, and every selected block must have an empty vertical fall path to the marked area. +If no protected-safe, unobstructed ceiling block exists, the collapse falls back to the eruption. +The location does not follow the player after the warning +begins, so dodging remains possible without giving the blind guardian sight-like tracking. The +cooldown, selected hazard, target, and pending warning persist across save/load. Ceiling removal +uses the normal entity-griefing and Retold world-protection policy; lava conversion checks both break +and place permission. Lava sources persist and can flow, burn surroundings, and affect any creature +according to ordinary Minecraft rules. The initial trap/treasure rooms, Lodestone reward, and +six-offering ritual are implemented; natural-world generation, balance, reward retrieval around +lava, multiplayer progression, and final presentation still require verification. ### Death — Wither @@ -85,19 +180,19 @@ connection. The Dragon Egg now accepts and consumes the Totem as the Life offeri The broader Life-path encounter presentation remains open design work; the accepted artifact and its Evoker source are now implemented. -## Implementation Gap +## Implementation Status -The current implementation is intentionally behind this design: +The initial acquisition paths and six-sacrifice gate are wired: - `RetoldRitualOffering` reserves stable saved-state bits for all six sacrifices. -- The Dragon Egg accepts Heavy Core, Heart of the Sea, Nether Reactor Core, Totem of Undying, and - Nether Star, consumes successful offerings, and rejects duplicates without consuming them. +- The Dragon Egg accepts Heavy Core, Heart of the Sea, Nether Reactor Core, Lodestone, Totem of + Undying, and Nether Star, consumes successful offerings, and rejects duplicates without consumption. - The legacy `WATER_ELEMENT` and `AIR_ELEMENT` items remain accepted but are no longer encounter rewards or Creative-tab progression entries. -- The temporary hatch threshold is Water, Air, Life, and Death so Stage 3 remains - survival-obtainable while the other acquisition paths are unfinished. -- Fire is accepted and persisted but is not yet required for hatching. Earth is represented in - saved ritual state but is not yet accepted or required. - -Implementation should turn on the complete six-sacrifice hatch requirement only when Earth is -survival-obtainable. +- All six are now required, in any order. Old offering bits retain their meanings; unfinished + Stage 2 worlds must supply their missing Fire/Earth artifacts. Worlds already in Stage 3 stay there. +- Existing generated vanilla pyramids gain no labyrinth; existing Retold labyrinth guardians can + drop the newly wired reward, while new room content requires a newly generated structure start. + Previously defeated guardians stay defeated; those worlds need another encounter for Lodestone. +- Natural encounter balance, multi-seed/chunk-border generation, and dedicated multiplayer and + upgraded-world end-to-end progression still need verification. diff --git a/docs/internal/aender_asset_prompts_2026-10-12.json b/docs/internal/aender_asset_prompts_2026-10-12.json new file mode 100644 index 00000000..eda5b731 --- /dev/null +++ b/docs/internal/aender_asset_prompts_2026-10-12.json @@ -0,0 +1,221 @@ +{ + "date": "2026-10-12", + "generator": "Built-in image_gen tool", + "status": "AI-generated development art; static material surfaces and original inversion palette; in-game visual approval pending", + "direction_reference": "docs/media/aender-original-palette.png", + "processing": "Nearest-neighbor reduction to native dimensions; binary cutout alpha; static 16x16 material faces with eight animation metadata files removed. Grass fringe pixels are keyed from the generated side source and composited over the exact soil tile; Aenderite mineral chips are keyed and composited over the exact stone tile. Generated wood/mineral material is packed into existing model UV layouts. Original plank art retained; developer-drawn sand replaced with original generated denim-blue sand at developer request. No Minecraft texture pixels used.", + "sources": [ + { + "name": "aender_grass_block_top", + "kind": "tile", + "alpha": false, + "prompt": "Create one original STATIC Minecraft-compatible 16x16 block texture, enlarged as crisp pixel art. Match the named color swatch in the supplied ORIGINAL Aender palette card. The design is the Overworld reflected through an inverted-color world; retain each material's established Aender color identity rather than making all blocks purple. Style should sit naturally beside vanilla: ordinary recognizable material, fine one-pixel and two-pixel detail, restrained contrast, limited 6-10 color ramps, hard pixel edges, unobtrusive seamless repetition. Exactly SIXTEEN BY SIXTEEN logical pixels, not a finer 32/64 pixel drawing reduced later. Every logical pixel is one uniform flat square. No blurred/photo texture, gradients, baked light, bloom, glossy/PBR shading, giant geometric mosaic chunks, fantasy ornament, noise at subpixel scale, text, borders, margins, perspective or block render. Opaque flat texture fills entire square canvas edge to edge. No animation frames or strips.\nNamed original palette swatch: grass_block_top. Dominant/average material color: #7d5489, with small lighter/darker shades of THAT SAME hue.\nMaterial: TOP of a grass block: muted medium purple-lilac grass, the original inversion of green grass. Fine irregular short grassy flecks and small overlapping tufts; reads as the close-up vanilla grass surface. A natural fine carpet, NOT a checkerboard, cobbled stone, large leaf blobs or smooth tiles. Purple throughout, no dirt, flowers or mint speckles.", + "origin": "Built-in image_gen; corrected original palette and vanilla pixel style" + }, + { + "name": "aender_soil", + "kind": "tile", + "alpha": false, + "prompt": "Create one original STATIC Minecraft-compatible 16x16 block texture, enlarged as crisp pixel art. Match the named color swatch in the supplied ORIGINAL Aender palette card. The design is the Overworld reflected through an inverted-color world; retain each material's established Aender color identity rather than making all blocks purple. Style should sit naturally beside vanilla: ordinary recognizable material, fine one-pixel and two-pixel detail, restrained contrast, limited 6-10 color ramps, hard pixel edges, unobtrusive seamless repetition. Exactly SIXTEEN BY SIXTEEN logical pixels, not a finer 32/64 pixel drawing reduced later. Every logical pixel is one uniform flat square. No blurred/photo texture, gradients, baked light, bloom, glossy/PBR shading, giant geometric mosaic chunks, fantasy ornament, noise at subpixel scale, text, borders, margins, perspective or block render. Opaque flat texture fills entire square canvas edge to edge. No animation frames or strips.\nNamed original palette swatch: soil. Dominant/average material color: #455784, with small lighter/darker shades of THAT SAME hue.\nMaterial: Aender DIRT/SOIL: original cool denim-blue inversion of brown dirt. Dominant dark blue, flecks of medium slate-blue, a few tiny darker and lighter blue crumbs and occasional tiny grey pebbles. Recognizable finely speckled vanilla dirt texture with 1-2 pixel earthy grains. It MUST be blue, never plum/purple/brown. No grass fringe.", + "origin": "Built-in image_gen; corrected original palette and vanilla pixel style" + }, + { + "name": "aender_stone", + "kind": "tile", + "alpha": false, + "prompt": "Create one original STATIC Minecraft-compatible 16x16 block texture, enlarged as crisp pixel art. Match the named color swatch in the supplied ORIGINAL Aender palette card. The design is the Overworld reflected through an inverted-color world; retain each material's established Aender color identity rather than making all blocks purple. Style should sit naturally beside vanilla: ordinary recognizable material, fine one-pixel and two-pixel detail, restrained contrast, limited 6-10 color ramps, hard pixel edges, unobtrusive seamless repetition. Exactly SIXTEEN BY SIXTEEN logical pixels, not a finer 32/64 pixel drawing reduced later. Every logical pixel is one uniform flat square. No blurred/photo texture, gradients, baked light, bloom, glossy/PBR shading, giant geometric mosaic chunks, fantasy ornament, noise at subpixel scale, text, borders, margins, perspective or block render. Opaque flat texture fills entire square canvas edge to edge. No animation frames or strips.\nNamed original palette swatch: stone. Dominant/average material color: #8996ac, with small lighter/darker shades of THAT SAME hue.\nMaterial: Aender STONE: original cool blue-grey inversion of Overworld stone. Flat fine low-contrast irregular mineral flecks, restrained horizontal broken seams, ordinary vanilla stone readability. Medium-light blue-grey, NOT pearl-white, giant mosaic chunks, shiny polished stone, brickwork or ores.", + "origin": "Built-in image_gen; corrected original palette and vanilla pixel style" + }, + { + "name": "aender_grass_block_side", + "kind": "tile", + "alpha": false, + "prompt": "Create one original STATIC Minecraft-compatible 16x16 block texture, enlarged as crisp pixel art. Match the named color swatch in the supplied ORIGINAL Aender palette card. The design is the Overworld reflected through an inverted-color world; retain each material's established Aender color identity rather than making all blocks purple. Style should sit naturally beside vanilla: ordinary recognizable material, fine one-pixel and two-pixel detail, restrained contrast, limited 6-10 color ramps, hard pixel edges, unobtrusive seamless repetition. Exactly SIXTEEN BY SIXTEEN logical pixels, not a finer 32/64 pixel drawing reduced later. Every logical pixel is one uniform flat square. No blurred/photo texture, gradients, baked light, bloom, glossy/PBR shading, giant geometric mosaic chunks, fantasy ornament, noise at subpixel scale, text, borders, margins, perspective or block render. Opaque flat texture fills entire square canvas edge to edge. No animation frames or strips.\nNamed original palette swatch: grass_block_side. Dominant/average material color: #455784, with small lighter/darker shades of THAT SAME hue.\nMaterial: SIDE of a grass block. Lower portion is original denim-blue speckled Aender dirt (#455784), NOT purple dirt. Purple-lilac grass (#7d5489) grows over the TOP edge. A ragged organic fringe extends downward by varying depths of 2, 3, 4, 5 or 6 logical pixels at different columns, with occasional one-pixel hanging tufts and small gaps BETWEEN tips. The complete top row is purple grass so it connects naturally to the top face. Lower boundary is clearly uneven and grassy, NEVER a straight horizontal stripe or plank band. Fine vanilla-style dirt speckles below the fringe. Opaque full square.", + "origin": "Built-in image_gen; corrected original palette and vanilla pixel style" + }, + { + "name": "aender_log", + "kind": "tile", + "alpha": false, + "prompt": "Create one original STATIC Minecraft-compatible 16x16 block texture, enlarged as crisp pixel art. Match the named color swatch in the supplied ORIGINAL Aender palette card. The design is the Overworld reflected through an inverted-color world; retain each material's established Aender color identity rather than making all blocks purple. Style should sit naturally beside vanilla: ordinary recognizable material, fine one-pixel and two-pixel detail, restrained contrast, limited 6-10 color ramps, hard pixel edges, unobtrusive seamless repetition. Exactly SIXTEEN BY SIXTEEN logical pixels, not a finer 32/64 pixel drawing reduced later. Every logical pixel is one uniform flat square. No blurred/photo texture, gradients, baked light, bloom, glossy/PBR shading, giant geometric mosaic chunks, fantasy ornament, noise at subpixel scale, text, borders, margins, perspective or block render. Opaque flat texture fills entire square canvas edge to edge. No animation frames or strips.\nNamed original palette swatch: log. Dominant/average material color: #424b71, with small lighter/darker shades of THAT SAME hue.\nMaterial: Tree LOG BARK SIDE: original dark navy/slate-blue bark, inversion of brown Overworld trunks, not pale lilac. Irregular vertical 1-2 pixel furrows, small broken branches in bark grain and blue-grey ridge highlights. Familiar vanilla log appearance with original pixel arrangement, no leaves, green/mint flecks or broad featureless stripes.", + "origin": "Built-in image_gen; corrected original palette and vanilla pixel style" + }, + { + "name": "aender_log_top", + "kind": "tile", + "alpha": false, + "prompt": "Create one original STATIC Minecraft-compatible 16x16 block texture, enlarged as crisp pixel art. Match the named color swatch in the supplied ORIGINAL Aender palette card. The design is the Overworld reflected through an inverted-color world; retain each material's established Aender color identity rather than making all blocks purple. Style should sit naturally beside vanilla: ordinary recognizable material, fine one-pixel and two-pixel detail, restrained contrast, limited 6-10 color ramps, hard pixel edges, unobtrusive seamless repetition. Exactly SIXTEEN BY SIXTEEN logical pixels, not a finer 32/64 pixel drawing reduced later. Every logical pixel is one uniform flat square. No blurred/photo texture, gradients, baked light, bloom, glossy/PBR shading, giant geometric mosaic chunks, fantasy ornament, noise at subpixel scale, text, borders, margins, perspective or block render. Opaque flat texture fills entire square canvas edge to edge. No animation frames or strips.\nNamed original palette swatch: log_top. Dominant/average material color: #464d73, with small lighter/darker shades of THAT SAME hue.\nMaterial: Tree LOG TOP cut-end: square of dark blue/navy wood with a one-pixel rough dark navy bark perimeter, fine irregular squared growth rings inside in medium slate-blue. Original inverted blue wood cross-section, not purple, pearl or large concentric decorative gemstone. Vanilla-scale grain.", + "origin": "Built-in image_gen; corrected original palette and vanilla pixel style" + }, + { + "name": "stripped_aender_log", + "kind": "tile", + "alpha": false, + "prompt": "Create one original STATIC Minecraft-compatible 16x16 block texture, enlarged as crisp pixel art. Match the named color swatch in the supplied ORIGINAL Aender palette card. The design is the Overworld reflected through an inverted-color world; retain each material's established Aender color identity rather than making all blocks purple. Style should sit naturally beside vanilla: ordinary recognizable material, fine one-pixel and two-pixel detail, restrained contrast, limited 6-10 color ramps, hard pixel edges, unobtrusive seamless repetition. Exactly SIXTEEN BY SIXTEEN logical pixels, not a finer 32/64 pixel drawing reduced later. Every logical pixel is one uniform flat square. No blurred/photo texture, gradients, baked light, bloom, glossy/PBR shading, giant geometric mosaic chunks, fantasy ornament, noise at subpixel scale, text, borders, margins, perspective or block render. Opaque flat texture fills entire square canvas edge to edge. No animation frames or strips.\nNamed original palette swatch: stripped_log. Dominant/average material color: #7f608f, with small lighter/darker shades of THAT SAME hue.\nMaterial: STRIPPED LOG SIDE: original muted dusty-lilac cut wood with simple fine vertical fibers and small broken subtle grain. Reads as a vanilla stripped log, moderate variation, no pink glow, bark, planks or ornamental pattern.", + "origin": "Built-in image_gen; corrected original palette and vanilla pixel style" + }, + { + "name": "stripped_aender_log_top", + "kind": "tile", + "alpha": false, + "prompt": "Create one original STATIC Minecraft-compatible 16x16 block texture, enlarged as crisp pixel art. Match the named color swatch in the supplied ORIGINAL Aender palette card. The design is the Overworld reflected through an inverted-color world; retain each material's established Aender color identity rather than making all blocks purple. Style should sit naturally beside vanilla: ordinary recognizable material, fine one-pixel and two-pixel detail, restrained contrast, limited 6-10 color ramps, hard pixel edges, unobtrusive seamless repetition. Exactly SIXTEEN BY SIXTEEN logical pixels, not a finer 32/64 pixel drawing reduced later. Every logical pixel is one uniform flat square. No blurred/photo texture, gradients, baked light, bloom, glossy/PBR shading, giant geometric mosaic chunks, fantasy ornament, noise at subpixel scale, text, borders, margins, perspective or block render. Opaque flat texture fills entire square canvas edge to edge. No animation frames or strips.\nNamed original palette swatch: stripped_log_top. Dominant/average material color: #715b8c, with small lighter/darker shades of THAT SAME hue.\nMaterial: STRIPPED LOG TOP: original muted lilac cut wood with fine irregular squared growth rings, full square has no bark border. Clear vanilla end-grain cut wood, not a lavender crystal or large tessellated mosaic.", + "origin": "Built-in image_gen; corrected original palette and vanilla pixel style" + }, + { + "name": "aender_leaves", + "kind": "tile", + "alpha": false, + "prompt": "Create one original STATIC Minecraft-compatible 16x16 block texture, enlarged as crisp pixel art. Match the named color swatch in the supplied ORIGINAL Aender palette card. The design is the Overworld reflected through an inverted-color world; retain each material's established Aender color identity rather than making all blocks purple. Style should sit naturally beside vanilla: ordinary recognizable material, fine one-pixel and two-pixel detail, restrained contrast, limited 6-10 color ramps, hard pixel edges, unobtrusive seamless repetition. Exactly SIXTEEN BY SIXTEEN logical pixels, not a finer 32/64 pixel drawing reduced later. Every logical pixel is one uniform flat square. No blurred/photo texture, gradients, baked light, bloom, glossy/PBR shading, giant geometric mosaic chunks, fantasy ornament, noise at subpixel scale, text, borders, margins, perspective or block render. Opaque flat texture fills entire square canvas edge to edge. No animation frames or strips.\nNamed original palette swatch: leaves. Dominant/average material color: #6c4f82, with small lighter/darker shades of THAT SAME hue.\nMaterial: LEAVES: original muted mid-purple inversion of green foliage. Dense opaque small irregular 1-3 pixel leaf clusters and dark purple recesses; familiar vanilla leaf texture rhythm, no checkerboard or huge pink blobs, no flower petals, green/mint speckles or crystals. Reads as actual leaves. Opaque as established in this block's model.", + "origin": "Built-in image_gen; corrected original palette and vanilla pixel style" + }, + { + "name": "aender_sandstone", + "kind": "tile", + "alpha": false, + "prompt": "Create one original STATIC Minecraft-compatible 16x16 block texture, enlarged as crisp pixel art. Match the named color swatch in the supplied ORIGINAL Aender palette card. The design is the Overworld reflected through an inverted-color world; retain each material's established Aender color identity rather than making all blocks purple. Style should sit naturally beside vanilla: ordinary recognizable material, fine one-pixel and two-pixel detail, restrained contrast, limited 6-10 color ramps, hard pixel edges, unobtrusive seamless repetition. Exactly SIXTEEN BY SIXTEEN logical pixels, not a finer 32/64 pixel drawing reduced later. Every logical pixel is one uniform flat square. No blurred/photo texture, gradients, baked light, bloom, glossy/PBR shading, giant geometric mosaic chunks, fantasy ornament, noise at subpixel scale, text, borders, margins, perspective or block render. Opaque flat texture fills entire square canvas edge to edge. No animation frames or strips.\nNamed original palette swatch: sandstone. Dominant/average material color: #5b6898, with small lighter/darker shades of THAT SAME hue.\nMaterial: SANDSTONE SIDE: original medium denim/periwinkle blue inversion of yellow sandstone. Fine gritty mineral texture and short irregular horizontal sediment layers, vanilla sandstone readability. Dominant #5b6898, distinctly BLUE rather than grey/lilac or white. No regular bricks.", + "origin": "Built-in image_gen; corrected original palette and vanilla pixel style" + }, + { + "name": "aender_sandstone_top", + "kind": "tile", + "alpha": false, + "prompt": "Create one original STATIC Minecraft-compatible 16x16 block texture, enlarged as crisp pixel art. Match the named color swatch in the supplied ORIGINAL Aender palette card. The design is the Overworld reflected through an inverted-color world; retain each material's established Aender color identity rather than making all blocks purple. Style should sit naturally beside vanilla: ordinary recognizable material, fine one-pixel and two-pixel detail, restrained contrast, limited 6-10 color ramps, hard pixel edges, unobtrusive seamless repetition. Exactly SIXTEEN BY SIXTEEN logical pixels, not a finer 32/64 pixel drawing reduced later. Every logical pixel is one uniform flat square. No blurred/photo texture, gradients, baked light, bloom, glossy/PBR shading, giant geometric mosaic chunks, fantasy ornament, noise at subpixel scale, text, borders, margins, perspective or block render. Opaque flat texture fills entire square canvas edge to edge. No animation frames or strips.\nNamed original palette swatch: sandstone_top. Dominant/average material color: #5d6ea0, with small lighter/darker shades of THAT SAME hue.\nMaterial: SANDSTONE TOP: medium cool periwinkle/denim blue, matching blue sandstone sides, muted #5d6ea0. Fine grained smoother mineral face with restrained broken fissures, no sediment stripes, grey-white stone, purple/pink tint or ornamental border.", + "origin": "Built-in image_gen; corrected original palette and vanilla pixel style" + }, + { + "name": "aender_cactus_side", + "kind": "tile", + "alpha": false, + "prompt": "Create one original STATIC Minecraft-compatible 16x16 block texture, enlarged as crisp pixel art. Match the named color swatch in the supplied ORIGINAL Aender palette card. The design is the Overworld reflected through an inverted-color world; retain each material's established Aender color identity rather than making all blocks purple. Style should sit naturally beside vanilla: ordinary recognizable material, fine one-pixel and two-pixel detail, restrained contrast, limited 6-10 color ramps, hard pixel edges, unobtrusive seamless repetition. Exactly SIXTEEN BY SIXTEEN logical pixels, not a finer 32/64 pixel drawing reduced later. Every logical pixel is one uniform flat square. No blurred/photo texture, gradients, baked light, bloom, glossy/PBR shading, giant geometric mosaic chunks, fantasy ornament, noise at subpixel scale, text, borders, margins, perspective or block render. Opaque flat texture fills entire square canvas edge to edge. No animation frames or strips.\nNamed original palette swatch: cactus_side. Dominant/average material color: #b6a5dc, with small lighter/darker shades of THAT SAME hue.\nMaterial: CACTUS SIDE: original pale lavender inversion of green cactus, ribbed succulent surface. Subtle irregular vertical lavender ribs, short one-pixel dark-violet spine marks and occasional pale highlights. Familiar vanilla cactus-face detail, NOT purple wood bark, a flat decorative striped wall, crystal or flower.", + "origin": "Built-in image_gen; corrected original palette and vanilla pixel style" + }, + { + "name": "aender_cactus_top", + "kind": "tile", + "alpha": false, + "prompt": "Create one original STATIC Minecraft-compatible 16x16 block texture, enlarged as crisp pixel art. Match the named color swatch in the supplied ORIGINAL Aender palette card. The design is the Overworld reflected through an inverted-color world; retain each material's established Aender color identity rather than making all blocks purple. Style should sit naturally beside vanilla: ordinary recognizable material, fine one-pixel and two-pixel detail, restrained contrast, limited 6-10 color ramps, hard pixel edges, unobtrusive seamless repetition. Exactly SIXTEEN BY SIXTEEN logical pixels, not a finer 32/64 pixel drawing reduced later. Every logical pixel is one uniform flat square. No blurred/photo texture, gradients, baked light, bloom, glossy/PBR shading, giant geometric mosaic chunks, fantasy ornament, noise at subpixel scale, text, borders, margins, perspective or block render. Opaque flat texture fills entire square canvas edge to edge. No animation frames or strips.\nNamed original palette swatch: cactus_top. Dominant/average material color: #b7a6dc, with small lighter/darker shades of THAT SAME hue.\nMaterial: CACTUS TOP: original pale lavender cactus flesh, tiny lavender radial/faceted succulent structure and dark-violet perimeter spine pixels, same identity as lavender cactus side. Ordinary vanilla plant readability, no green, rune, fancy white square gemstone or arbitrary glow.", + "origin": "Built-in image_gen; corrected original palette and vanilla pixel style" + }, + { + "name": "aender_sapling", + "kind": "sprite", + "alpha": true, + "prompt": "Create one original STATIC low-resolution Minecraft-compatible pixel-art asset. Match vanilla's pixel density, simple recognizable material shapes and restrained contrast, with the named ORIGINAL inverted-color Aender palette from the reference. Exactly16x16 logical uniform flat square pixels unless a16x32 door is explicitly requested. No finer32/64 drawing, blur, gradients, antialiasing, bloom, PBR rendering, giant abstract mosaic patches, text, margins beyond those requested or copied Minecraft pixels. Genuine transparent background and window cutouts.\nAsset: A recognizable vanilla-style tree sapling sprite. Dark navy-blue trunk (#424b71) and a few thin branches support three small purple leaf clusters (#6c4f82), with muted lilac highlights. Original inverted-color tree palette, NOT a pale grey trunk, pink flowers or glittering crystals. About 12-14 pixels tall, clear leafy silhouette, 1-pixel transparent margins, no background or shadow.", + "origin": "Built-in image_gen; corrected original palette and vanilla pixel style" + }, + { + "name": "aender_door", + "kind": "door", + "alpha": true, + "prompt": "Create one original STATIC low-resolution Minecraft-compatible pixel-art asset. Match vanilla's pixel density, simple recognizable material shapes and restrained contrast, with the named ORIGINAL inverted-color Aender palette from the reference. Exactly16x16 logical uniform flat square pixels unless a16x32 door is explicitly requested. No finer32/64 drawing, blur, gradients, antialiasing, bloom, PBR rendering, giant abstract mosaic patches, text, margins beyond those requested or copied Minecraft pixels. Genuine transparent background and window cutouts.\nAsset: A full wooden door texture in a 16x32 logical pixel portrait canvas, upper and lower halves align as one tall door. Original muted-purple plank colors (#6d4f82), fine straight horizontal board grain, simple dark-purple edge posts and one mid crossbar. Upper third has four small real transparent window openings, classic vanilla wooden-door readability, a tiny neutral grey latch near the right middle. Lower half is solid simple boards. No ornate bevels, pink/pearly frame or mint runes. Solid wood fills all outside edges with no external background or margins.", + "origin": "Built-in image_gen; corrected original palette and vanilla pixel style" + }, + { + "name": "aender_trapdoor", + "kind": "trapdoor", + "alpha": true, + "prompt": "Create one original STATIC low-resolution Minecraft-compatible pixel-art asset. Match vanilla's pixel density, simple recognizable material shapes and restrained contrast, with the named ORIGINAL inverted-color Aender palette from the reference. Exactly16x16 logical uniform flat square pixels unless a16x32 door is explicitly requested. No finer32/64 drawing, blur, gradients, antialiasing, bloom, PBR rendering, giant abstract mosaic patches, text, margins beyond those requested or copied Minecraft pixels. Genuine transparent background and window cutouts.\nAsset: A square 16x16 wooden trapdoor face with original muted-purple timber (#6d4f82). A simple 2-pixel wood perimeter and one-pixel central crossbars around four small genuine transparent rectangular openings. Fine horizontal vanilla plank grain, two tiny grey hinge pixels on one edge. Solid perimeter fills the full canvas to its corners, no outer transparent margin, decorative bevel or render.", + "origin": "Built-in image_gen; corrected original palette and vanilla pixel style" + }, + { + "name": "aender_boat", + "kind": "sprite", + "alpha": true, + "prompt": "Create one original STATIC low-resolution Minecraft-compatible pixel-art asset. Match vanilla's pixel density, simple recognizable material shapes and restrained contrast, with the named ORIGINAL inverted-color Aender palette from the reference. Exactly16x16 logical uniform flat square pixels unless a16x32 door is explicitly requested. No finer32/64 drawing, blur, gradients, antialiasing, bloom, PBR rendering, giant abstract mosaic patches, text, margins beyond those requested or copied Minecraft pixels. Genuine transparent background and window cutouts.\nAsset: One wooden boat inventory sprite in muted original-purple timber (#6d4f82), dark plum outline, simple visible plank seams, an open rectangular hull and one short paddle. Classic vanilla boat silhouette and modest oblique item angle; clearly a little wooden rowboat rather than a blob. Exact16x16 logical pixel sprite with 1-pixel transparent outer margins, no water, shadow or background.", + "origin": "Built-in image_gen; corrected original palette and vanilla pixel style" + }, + { + "name": "aender_chest_boat", + "kind": "sprite", + "alpha": true, + "prompt": "Create one original STATIC low-resolution Minecraft-compatible pixel-art asset. Match vanilla's pixel density, simple recognizable material shapes and restrained contrast, with the named ORIGINAL inverted-color Aender palette from the reference. Exactly16x16 logical uniform flat square pixels. No finer32/64 drawing, blur, gradients, antialiasing, bloom, PBR rendering, giant abstract mosaic patches, text, margins beyond those requested or copied Minecraft pixels. Genuine transparent background.\nAsset: One chest boat inventory sprite in muted original-purple timber (#6d4f82), dark plum outline, open angular rowboat hull and one short paddle, a clearly rectangular little chest inside with dark purple bands and a tiny neutral grey latch. Classic vanilla chest-boat silhouette and modest oblique item angle. Exact16x16 logical pixel sprite with 1-pixel transparent outer margins, no water, shadow or background.", + "origin": "Built-in image_gen; corrected original palette and vanilla pixel style" + }, + { + "name": "aender_sign_item", + "kind": "sprite", + "alpha": true, + "prompt": "Create one original STATIC low-resolution Minecraft-compatible pixel-art asset. Match vanilla's pixel density, simple recognizable material shapes and restrained contrast, with the named ORIGINAL inverted-color Aender palette from the reference. Exactly16x16 logical uniform flat square pixels. No finer32/64 drawing, blur, gradients, antialiasing, bloom, PBR rendering, giant abstract mosaic patches, text, margins beyond those requested or copied Minecraft pixels. Genuine transparent background.\nAsset: One classic vanilla standing wooden-sign inventory sprite: a rectangular muted-purple plank board (#6d4f82) with two quiet horizontal board seams, and a short dark blue/navy wood post (#424b71) descending at center. Empty board, no writing. Exact16x16 logical pixel sprite with 1-pixel transparent margins, no scenery, shadow or fancy ornament.", + "origin": "Built-in image_gen; corrected original palette and vanilla pixel style" + }, + { + "name": "aender_hanging_sign_item", + "kind": "sprite", + "alpha": true, + "prompt": "Create one original STATIC low-resolution Minecraft-compatible pixel-art asset. Match vanilla's pixel density, simple recognizable material shapes and restrained contrast, with the named ORIGINAL inverted-color Aender palette from the reference. Exactly16x16 logical uniform flat square pixels. No finer32/64 drawing, blur, gradients, antialiasing, bloom, PBR rendering, giant abstract mosaic patches, text, margins beyond those requested or copied Minecraft pixels. Genuine transparent background.\nAsset: One classic vanilla hanging wooden-sign inventory sprite: a rectangular muted-purple plank board (#6d4f82) with quiet horizontal grain in the lower half, two small grey-purple chain links reaching up from the board corners. Empty board with no lettering. Exact16x16 logical pixel sprite with 1-pixel transparent margins, no shadow, fancy ornament or background.", + "origin": "Built-in image_gen; corrected original palette and vanilla pixel style" + }, + { + "name": "aenderite_ore", + "kind": "tile", + "alpha": false, + "prompt": "Create one original STATIC Minecraft-compatible 16x16 block texture, enlarged as crisp pixel art. Match the named color swatch in the supplied ORIGINAL Aender palette card. The design is the Overworld reflected through an inverted-color world; retain each material's established Aender color identity rather than making all blocks purple. Style should sit naturally beside vanilla: ordinary recognizable material, fine one-pixel and two-pixel detail, restrained contrast, limited 6-10 color ramps, hard pixel edges, unobtrusive seamless repetition. Exactly SIXTEEN BY SIXTEEN logical pixels, not a finer 32/64 pixel drawing reduced later. Every logical pixel is one uniform flat square. No blurred/photo texture, gradients, baked light, bloom, glossy/PBR shading, giant geometric mosaic chunks, fantasy ornament, noise at subpixel scale, text, borders, margins, perspective or block render. Opaque flat texture fills entire square canvas edge to edge. No animation frames or strips.\nMaterial: Aenderite ORE. Host rock MUST match the original cool blue-grey Aender stone swatch, dominant #8996ac with fine 1-2 pixel vanilla stone detail, NOT pearl-white/lilac stone. Three small scattered angular mint-green mineral clusters, each 2-4 connected logical pixels, darker muted teal edges and single pale mint highlights. Clear ordinary vanilla ore-block pattern with original deposits, no huge shiny gemstone, neon veins, runes or regular dot grid. Original pixel art only.", + "origin": "Built-in image_gen; corrected original palette and vanilla pixel style" + }, + { + "name": "aender_chronolith", + "kind": "tile", + "alpha": false, + "prompt": "Edit this original Aender Chronolith texture for clear 16x16 readability. Keep dark plum-violet mineral, reduce scattered isolated mint flecks, keep quiet background. Make the central mint hourglass-shaped carved rune visibly larger: SEVEN logical pixels wide and TEN logical pixels tall on a16x16 logical pixel square. Pale lilac top/bottom crossbars, muted mint interior, dark teal narrow waist, symmetrical readable hourglass. Strong material contrast at16pixels but no glow or bloom. Texture fills canvas edge-to-edge, opaque background, no text, labels, render perspective or margin. Exactly16x16 logical crisp square pixels.", + "origin": "Retained generated custom-device/mineral artwork; statically packed at native size" + }, + { + "name": "aender_stabilizer", + "kind": "tile", + "alpha": false, + "prompt": "Create one original production-source pixel-art asset for Retold's Aender, consistent with the approved material-study reference. Restrained dusty lilac/plum timber, pale mineral, and mint accents. Actual low-resolution pixel sprite style, crisp uniform squares, limited purposeful palette, no antialiasing, blur, bloom, realistic/PBR lighting, text, labels or watermark. Intended logical size 16x16; fill the canvas as specified.\nSpecific asset: Opaque Aender Stabilizer full block-face tile. Solid dark plum mineral base, clearly deliberate crafted technology represented by a squared concentric stepped socket containing a small steady mint diamond at center. Thin pale-lilac corner braces. Quiet strong geometric symmetry indicates anchoring/stability, distinct from Chronolith's hourglass. Restrained readable 16x16 pixels, not sci-fi chrome, no bloom or huge glowing edges.", + "origin": "Retained generated custom-device/mineral artwork; statically packed at native size" + }, + { + "name": "dev_aender_portal_frame", + "kind": "tile", + "alpha": false, + "prompt": "Create one original production-source pixel-art asset for Retold's Aender, consistent with the approved material-study reference. Restrained dusty lilac/plum timber, pale mineral, and mint accents. Actual low-resolution pixel sprite style, crisp uniform squares, limited purposeful palette, no antialiasing, blur, bloom, realistic/PBR lighting, text, labels or watermark. Intended logical size 16x16; fill the canvas as specified.\nSpecific asset: Opaque Aender portal frame full block-face mineral tile. Pearly cool lavender stone with a thin inset dark plum square channel and small muted mint inlays at four corners; the center is quiet pale stone. Ancient functional portal masonry, tiny inlays, not a glowing full border or ornate decorative glyph. This block needs to read as a pale mineral unlike the dark crafted stabilizer. Flat 16x16 original pixels.", + "origin": "Retained generated custom-device/mineral artwork; statically packed at native size" + }, + { + "name": "raw_aenderite", + "kind": "sprite", + "alpha": true, + "prompt": "Create one original production-source pixel-art asset for Retold's Aender, consistent with the approved material-study reference. Restrained dusty lilac/plum timber, pale mineral, and mint accents. Actual low-resolution pixel sprite style, crisp uniform squares, limited purposeful palette, no antialiasing, blur, bloom, realistic/PBR lighting, text, labels or watermark. Intended logical size 16x16; fill the canvas as specified.\nSpecific asset: One raw Aenderite item sprite on a genuine transparent 16x16 logical-pixel square. Centered irregular chunky unrefined mineral lump with dark teal facets and a few mint/sea-glass inclusions, muted pearly-grey stone still attached. Limited crisp pixels, one pixel of breathing room, no ground shadow, glossy gemstone, ore block, text or rendered 3D scene.", + "origin": "Retained generated custom-device/mineral artwork; statically packed at native size" + }, + { + "name": "aenderite_ingot", + "kind": "sprite", + "alpha": true, + "prompt": "Create one original production-source pixel-art asset for Retold's Aender, consistent with the approved material-study reference. Restrained dusty lilac/plum timber, pale mineral, and mint accents. Actual low-resolution pixel sprite style, crisp uniform squares, limited purposeful palette, no antialiasing, blur, bloom, realistic/PBR lighting, text, labels or watermark. Intended logical size 16x16; fill the canvas as specified.\nSpecific asset: One refined Aenderite ingot item sprite on a genuine transparent 16x16 logical-pixel square. Centered low oblique classic ingot silhouette, flat mint-green top plane, desaturated teal side plane and deep teal underside outline, tiny pearly highlight. Industrial refined metal rather than glowing gemstone. Limited crisp pixels, one pixel breathing room, no shadow, labels, gradients or background.", + "origin": "Retained generated custom-device/mineral artwork; statically packed at native size" + }, + { + "name": "aender_eye_spawn_egg", + "kind": "sprite", + "alpha": true, + "prompt": "Create one original production-source pixel-art asset for Retold's Aender, consistent with the approved material-study reference. Restrained dusty lilac/plum timber, pale mineral, and mint accents. Actual low-resolution pixel sprite style, crisp uniform squares, limited purposeful palette, no antialiasing, blur, bloom, realistic/PBR lighting, text, labels or watermark. Intended logical size 16x16; fill the canvas as specified.\nSpecific asset: One Aender Eye spawn-egg inventory sprite, centered on genuine transparent 16x16 logical-pixel square. Simple upright rounded egg silhouette with dark teal shell, sparse muted mint oval flecks and one small lilac fleck, original arrangement. Recognizable spawn egg, not an eyeball or jewel. Crisp flat pixel art, one pixel breathing room, no ground, shadow, writing or photorealism.", + "origin": "Retained generated custom-device/mineral artwork; statically packed at native size" + }, + { + "name": "aender_planks", + "kind": "tile", + "alpha": false, + "prompt": "No new generation: retain the original July Aender plank art and its clear vanilla board layout.", + "origin": "Original July 2026 AI-generated Aender wood-family texture" + }, + { + "name": "aender_sand", + "kind": "tile", + "alpha": false, + "prompt": "Create one completely ORIGINAL static 16x16 logical-pixel Aender SAND texture for Retold, enlarged as crisp pixel art. Use the original Aender Sand color family shown in the supplied palette card: dominant deep muted denim blue #45517a, quiet darker #344263 and lighter slate-blue #596895 grains. This replaces the developer's hand-drawn texture; do not reproduce any hand-drawn pixel arrangement. The world uses an inverted Overworld palette, so familiar yellow/beige sand becomes dark denim blue. Match vanilla Minecraft's fine sand texture rhythm: tiny one-pixel grains, occasional paired pixels, low contrast, gently irregular natural distribution, no dirt pebbles, horizontal layers, large blocky mosaic clusters, bubbles, waves, footprints or ornament. Keep the sand visibly finer and calmer than speckled blue dirt. EXACTLY SIXTEEN BY SIXTEEN logical uniform square pixels, not a finer32/64 texture reduced later. Full opaque square, flat even lighting, seamless repeat on opposite edges, no edge border, margin, perspective, text, antialiasing, gradients, bloom, PBR rendering, or animation frames. No Minecraft texture pixels or extracted assets.", + "origin": "Built-in image_gen; replaces developer-drawn sand at developer request" + } + ], + "consistency_checks": { + "grass_exposed_soil_pixels": 200, + "ore_exposed_stone_pixels": 243, + "shared_plank_block_models": 18, + "shared_plank_atlas_pixels": 26410, + "all_static_material_faces": true, + "in_game_visual_review": "not performed" + }, + "active_revision_reference": "retold_asset_revision_2026-10-23.json" +} diff --git a/docs/internal/design_implementation_status.md b/docs/internal/design_implementation_status.md index a9e97733..b2f7fc19 100644 --- a/docs/internal/design_implementation_status.md +++ b/docs/internal/design_implementation_status.md @@ -46,7 +46,7 @@ Implemented or strongly represented: - three world stages - stage saved data and network sync - dragon kill -> Stage 2 -- six-slot Dragon Egg ritual state with the temporary Water/Air/Life/Death hatch threshold +- six-slot Dragon Egg ritual state requiring all six artifacts, including the Earth Guardian's Lodestone - final Heart of the Sea and Heavy Core Water/Air rewards, with legacy item compatibility - Air Temple / Gale Core Heavy Core path - Stage 3 End portal redirect to Aender @@ -71,8 +71,9 @@ Implemented or strongly represented: Largest missing or partial design areas: -- full four-element progression -- Earth element guardian/path plus Wildfire and Air encounter tuning +- natural end-to-end verification and tuning of the four-element acquisition paths +- Earth Labyrinth room/hazard tuning, natural-world verification, and final guardian presentation + plus Wildfire/Air encounter tuning - deciding Stage 1 Nether star / Wither End portal activation - remaining Aender late-game rewards and in-dimension teleportation system - complete tools/armor/ores progression rework @@ -116,8 +117,8 @@ Largest missing or partial design areas: | Stage 1 requires diamond pickaxe/Nether portal | Not implemented | No explicit Retold gating found. Vanilla rules apply unless affected elsewhere. | | Stage 1 wither/Nether star required before End | Deferred/TBD | Developer is undecided. Current code has End progression, not End portal activation gating. | | Stage 1 Ender Dragon kill advances to Stage 2 | Implemented | `RetoldEndProgressionEvents.onServerTickPost` checks dragon kill and calls `RetoldStageManager.setStage(...STAGE_2)`. | -| Stage 2 requires six ritual sacrifices | Partial | `RetoldRitualOffering` reserves save-compatible bits for Air, Water, Fire, Earth, Life, and Death. Fire is now survival-obtainable and accepted, but the temporary hatch threshold remains Water, Air, Life, and Death until Earth exists. Elder Guardians provide Heart of the Sea, Gale Cores provide Heavy Core, Wildfires provide Nether Reactor Cores, buried treasure no longer bypasses Water, and newly generated Trial Chambers are already disabled. | -| Stage 2 dragon egg hatches with sacrifices | Partial | The egg identifies implemented artifacts by item identity, consumes a successful offering, rejects duplicates without consumption, and currently hatches when Heart of the Sea, Heavy Core, Totem of Undying, and Nether Star are offered in any order. Nether Reactor Core is accepted and persisted as Fire but does not yet control hatching. Legacy Water/Air Element stacks remain accepted for existing worlds. Earth is not yet accepted or required. | +| Stage 2 requires six ritual sacrifices | Implemented / needs natural progression verification | `RetoldRitualOffering` reserves save-compatible bits for Air, Water, Fire, Earth, Life, and Death. All six are accepted and required; Earth Guardians now provide Lodestone, and its vanilla recipe and Ruined Portal/Bastion Bridge chest sources are removed. Stable bits preserve old progress; Stage 2 saves need any missing offerings and Stage 3 saves remain progressed. Elder Guardians provide Heart of the Sea, Gale Cores provide Heavy Core, Wildfires provide Nether Reactor Cores, buried treasure no longer bypasses Water, and newly generated Trial Chambers are already disabled. | +| Stage 2 dragon egg hatches with sacrifices | Implemented / needs natural progression verification | The egg identifies implemented artifacts by item identity, consumes a successful offering, rejects duplicates without consumption, and hatches when Heart of the Sea, Heavy Core, Nether Reactor Core, Lodestone, Totem of Undying, and Nether Star are offered in any order. Legacy Water/Air Element stacks remain accepted for existing worlds. Earth is accepted and required; natural dedicated-server, multiplayer, and upgraded-world end-to-end progression remain unverified. | | Stage 3 starts after hatching egg | Implemented | `RetoldStageManager.setStage(...STAGE_3)` in egg hatch flow. | | Stage 3 Aender replaces End | Partial | Overworld End portal redirects to Aender and players are ejected from vanilla End. Vanilla End intentionally still exists for command access to old builds. | | Stage 3 Overworld easier / undead gone | Partial | Current design only requires undead/zombified piglin removal for now. Undead natural/spawner spawn is blocked and existing undead are cleansed. | @@ -139,7 +140,7 @@ Largest missing or partial design areas: | Only day/light | Implemented / needs visual verification | `data/retold/dimension_type/aender.json` sets `fixed_time: 6000`, skylight, and high ambient light; Aender weather is disabled. Client visuals still need in-game review. | | Aender in-dimension teleportation setup | Not implemented | Cross-dimension Aender portals now exist, but a separate transport network within the Aender is still planned. | | Late-game OP building/travel rewards | Not implemented | Still planned. Raw Aenderite and Aenderite Ingots now establish a late-game material, but the ingot intentionally has no crafting use until the reward/tool design is approved. | -| Inverted Overworld colors / liminal feel | Partial | Aender textures/palette and lighting exist. Needs visual/design pass. | +| Inverted Overworld colors / liminal feel | Partial / needs developer visual approval | Aender materials use static 16x16 faces, vanilla-scale detail, and the confirmed inverted-world palette: purple vegetation, blue soil/bark and desert materials, and cool stone. Grass has irregular fringes over the exact Soil tile, and ore retains the exact Stone background. Original plank art is preserved; generated denim-blue Sand supersedes the developer drawing. The 2026-10-23 revision refines grass-top and leaf clusters. Prompt/output mappings and historical credits are in [`ASSET_CREDITS.md`](../../ASSET_CREDITS.md). Natural-world tiling, foliage/cutouts, sign/boat UV mapping, inventory readability, resource reload and final visual acceptance remain unverified. | ## Stage Differences @@ -164,7 +165,8 @@ Largest missing or partial design areas: | --- | --- | --- | | Leaves and bushes provide opening Sticks | Implemented / needs in-game verification | Every block in `minecraft:leaves` receives an additional 20% chance for 1–2 Sticks, with +5 percentage points per Fortune level. Dead Bushes drop 2–4, while Bush, Firefly Bush, Rose Bush, and Sweet Berry Bush receive a 10% one-Stick roll. Shears and Silk Touch are excluded. A focused real-loot-table GameTest samples the distributions and harvest exclusions; natural decay, explosions, modded leaves, bush farming, and first-spawn pacing remain to be verified in-game. | | Wood cannot be obtained by hand | Implemented / needs in-game verification | A harvest check prevents logs from dropping unless the held item is a correct harvesting tool. Focused GameTest coverage verifies hand denial and Flint Multi-tool success; naturally verify block breaking, drops, Adventure mode, and common modded logs. | -| Flint multi-tool | Implemented / needs in-game verification | The 2x2 two-Flint/one-Stick recipe, 48-durability combined axe/shovel/primitive Copper tool, repair tag, creative placement, language entry, and provisional vanilla-Flint model are implemented. Its retained harvest baseline combines axe/shovel blocks with normal Copper Ore, Sandstone variants, Tuff, and Calcite while denying Stone and Deepslate Copper Ore. Focused GameTests verify the recipe, durability, representative allowed blocks, and Stone denial. Natural survival pacing, full-list feel, and visuals remain unverified. | +| Equipment and boss presentation | Implemented / needs developer visual approval | Flint/Steel equipment and Nether Reactor Core have original sprites; Steel uses the `retold:steel` equipment key with adult, leggings and baby atlases. Spears retain separate inventory/held contexts. Earth Guardian has an original blind-statue model with lifecycle/melee poses and synchronized remaining awakening time. Gale Core uses installed Breeze resources with original circlet/plates and an installed Heavy Core center. Boss eggs have original sprites; Aender Eye directly reuses the installed vanilla Eye of Ender texture as an emissive billboard, including resource-pack texture replacements. The 2026-10-23 art revision adds distinct Steel front/back surfaces and quieter carved Guardian materials without changing meshes or armor coverage; its refreshed original-art-only offline preview and provenance are recorded in [`ASSET_CREDITS.md`](../../ASSET_CREDITS.md). Build-wired model checks, resource JUnit coverage and exact lifecycle validation are documented in [`testing_strategy.md`](testing_strategy.md#asset-and-boss-presentation-checks). Final appearance, armor trims, baby equipment, resource packs/shaders, late joins and connected-world/multiplayer rendering remain unverified. | +| Flint multi-tool | Implemented / needs in-game verification | The 2x2 two-Flint/one-Stick recipe, 48-durability combined axe/shovel/primitive Copper tool, repair tag, creative placement, language entry, and original knapped-Flint development sprite are implemented. Its retained harvest baseline combines axe/shovel blocks with normal Copper Ore, Sandstone variants, Tuff, and Calcite while denying Stone and Deepslate Copper Ore. Focused GameTests verify the recipe, durability, representative allowed blocks, and Stone denial. Natural survival pacing, full-list feel, and visuals remain unverified. | | Reduced Copper generation | Implemented / needs fresh-world verification | Both `minecraft:ore_copper` and `minecraft:ore_copper_large` now make six placement attempts per chunk instead of sixteen, a 62.5% frequency reduction. Vanilla size-10 ordinary and size-20 Dripstone veins plus their height distribution are preserved. A focused registry-backed GameTest verifies both loaded overrides across three seeded origins spanning a chunk border; several fresh seeds, cave-wall exposure, and existing-versus-new chunk behavior still need natural verification. | | Flint/copper/iron/steel/diamond tool progression | Partial / needs verification | Progression is implemented through Diamond: Wooden/Stone recipes are removed, Copper unlocks slow Stone harvesting, Deepslate-family blocks and every Diamond Ore require Steel or better, Spears follow Flint/Copper/Iron/Steel/Diamond, and unenchanted tagged Diamond tools/Spear use 64 durability while any enchantment restores their vanilla maximum. Removing every enchantment makes them fragile again. The current provisional Steel values remain the working baseline until natural playtesting provides evidence for tuning. Focused tests cover the boundaries, Spear recipes/tags, and transitions. Netherite/Aenderite equipment remains incomplete. | | Campfire, Brick Furnace, Furnace, Blast Furnace, and parallel enchanting progression | Partial / needs verification | Campfires use a fuel-free three-Stick/three-Log recipe. Their initial placement state is unlit on both logical sides, avoiding the former client-visible lit-state flash. Bare Flint ignites one and is consumed in Survival; Flint and Steel retains normal durability use. Campfire cooking fires Clay Balls into Bricks, and eight Bricks craft the Smoker-backed Brick Furnace. The Brick and normal Furnace roles are implemented. Per the 2026-08-11 choice, a standard 100-tick blasting recipe converts one Iron Ingot to one Steel Ingot while accepting ordinary Blast Furnace fuels; Charcoal is valid but not mandatory or fixed 1:1. Blast Furnace construction remains vanilla. Enchanting follows the separate deterministic SGA system. | @@ -202,6 +204,40 @@ Largest missing or partial design areas: ## Structures And Worldgen +Earth Guardian generated-maze pursuit follow-up (2026-09-08): an actual generated lower maze, +real dispatched mock-player footsteps, periodic encounter repair, and enabled environmental +attacks reproduced a permanent stall on the guardian's own lava source. Excavation now clears +complete fluid-bearing states instead of leaving vanilla residual fluid. The generated-maze +regression passes after the fix; fluid conservation and administrative-denial coverage also passes. +This is server gameplay simulation with a mock player, not a connected-client or visual playtest. +Long-session, other seeds, upper-floor pursuit, and existing-world confirmation remain open. + +Earth Guardian rapid-shaping follow-up (2026-09-08): twelve-edit half-second pulses and supported +3×3 trailing walls are implemented with a shared budget, finite material, a forty-tick wall cooldown, +and per-cell protection/occupancy checks. Active stair workspaces exclude backfill/walls; occupied +future supports trigger actual-feet replanning. Focused batch, wall, ascent, descent, and moving-step +fixtures passed, but an earlier unestablished descent-fixture removal and natural wall/ramp pacing +remain verification notes in the testing strategy. Large-group active block mutation is not profiled +by the griefing-disabled TPS fixture. + +Earth Guardian aggressive-combat follow-up (2026-09-08): the approved melee-plus-environmental +direction is implemented with faster clue pursuit, continued movement during hazard warnings, +and guarded contact strikes. A focused real-tick fixture verifies approach during a warning, +actual ceiling release, and automatic melee in one encounter. Final natural balance, connected +multiplayer, and strike presentation still require playtesting. + +Earth Guardian moving-clue follow-up (2026-09-07): real dispatched footsteps from a moving mock +Survival player reproduced a tunnel-entry stall despite successful hearing. Short excavation routes +now retain their landing across clue updates. `earth_guardian_follows_real_steps_into_tunnel` passes +with a three-block-high stone tunnel and actual ceiling removal. Its protected destination isolates +locomotion while attack windups remain active; it does not establish natural maze/combat balance. + +Earth Guardian periodic-repair follow-up (2026-09-07): the reproduced 40-tick center teleport is +fixed for an existing same-encounter guardian. Rebinding preserves roaming position and ongoing +state; dormant/awakening anchoring remains intentional. The exact foundation and real-tick +investigation tests pass, including reload rebinding and pursuit across a periodic repair. +Natural-world and connected multiplayer confirmation remain pending. + | Design item | Status | Current implementation | | --- | --- | --- | | Generic Retold world-protection layer | Implemented core / adapters pending | `api.world.RetoldWorldProtection` combines removable, uniquely identified deny rules with immutable mutation contexts and preserves default-allow standalone behavior. Position-aware destructive forage, weak barriers, Panda bamboo, Spider webs, Villager torch maintenance, Gale Core terrain damage, Aender regeneration and portal creation, and delayed retrogen are routed through it. A focused test proves denial leaves forage and hunger unchanged, category separation, duplicate-id rejection, registration removal, and restoration of the original allowed path. No third-party claim adapter, multiplayer, or dedicated-server integration has been verified. | @@ -218,8 +254,8 @@ Largest missing or partial design areas: | Ocean ruins only near shore | Not implemented | | Strongholds kept to 3 | Not implemented / unclear | Still planned. | | Villages spawn farther/scarcer | Not implemented / unclear | `NoVillageNearWorldSpawnMixin` exists, but full village scarcity design not confirmed here. | -| Jungle/desert pyramids as boss tombs | Deferred/TBD | Maybe still planned, but design is not final. | -| Four element temples/challenges | Partial | Water/ocean and Air Temple paths exist. Air has floating islands, wind, Breezes, a WIP Gale Core that now drops Heavy Core, and a Stage 2 cartographer map. Fire deliberately uses a rare roaming Stage 2+ Wildfire rather than a temple and now provides Nether Reactor Core. Focused tests cover these initial paths, but Wildfire and Air pacing/presentation need natural verification. The Earth guardian/path is missing. Element order should be free. | +| Jungle/desert pyramids as boss tombs | Partial | Newly generated Jungle Pyramids now use a compatible composite structure containing the initial Earth Labyrinth, while saved vanilla pyramid pieces remain unchanged. Initial Jungle Pyramid labyrinth side rooms contain traps, treasure, and unmodified dark-area natural spawning; further room variants and Desert Pyramid boss tombs remain open. | +| Four element temples/challenges | Partial | Water/ocean and Air Temple paths exist. Air has floating islands, wind, Breezes, a WIP Gale Core that now drops Heavy Core, and a Stage 2 cartographer map. Fire deliberately uses a rare roaming Stage 2+ Wildfire rather than a temple and now provides Nether Reactor Core. Focused tests cover these initial paths, but Wildfire and Air pacing/presentation need natural verification. Earth is confirmed as a deterministic randomized two-level labyrinth beneath every newly generated Jungle Pyramid, entered through its lever-puzzle room; existing pyramids remain untouched. `EarthJungleTempleStructure` preserves the vanilla structure id for locate/maps and creates a serialized temple wrapper plus labyrinth piece. `EarthLabyrinthPlanner` and `EarthLabyrinthGenerator` provide a deterministic connected 77- or 101-block cave maze whose floors are 64 and 78 blocks below the pyramid base. Access uses the unused center tile of the revealed vanilla chamber, then a narrow eight-block ladder shaft before any horizontal or broad carving begins, preserving the surrounding redstone puzzle. The maze uses fixed entrance/guardian anchors, loops, a long walkable switchback staircase, deterministically offset junctions, bent connecting routes, separated rough tunnel shells, irregular junction caverns, depth-aware natural stone, and four or five ladder links kept outside a huge lower central arena. That arena has a guaranteed 31-block-wide core, irregular edges out to roughly 33 blocks, and ten blocks of headroom below the complete upper maze. `retold:earth_guardian` supplies one persistent chamber-owned Stage 1 statue per loaded labyrinth, begins a three-second awakening on a Stage 2 Survival-player arena visit, and persists lifecycle state in both the entity and authoritative encounter SavedData so duplicates are repaired and defeated labyrinths stay cleared. Once roaming, it becomes damageable and its vanilla dynamic vibration listener accepts real Survival-player sources within hearing range even outside its bounds, preserves vanilla vibration travel/occlusion/sneaking rules, weights direct damage through movement clues, remembers the strongest source without gaining wall-penetrating target knowledge, and uses bounded `EARTH_GUARDIAN`-owned pathfinding to investigate or patrol. Listener and clue state survive reloads. Clues within 24 blocks can lock a floor position, pause terrain work for a 30-tick warning while continuing pursuit and contact melee, then cycle through converting up to five protection-approved ceiling blocks with clear vertical fall paths into damaging falling debris converting a 3×3 supporting layer beneath the locked position into persistent lava sources with vanilla flow and contact damage, and excavating a 3×3 pit up to four blocks deep with vanilla falling and landing damage; missing ceiling material falls back to lava, the location never follows later player movement, and pending hazard state survives reloads. While following a clue, a controller with at most 12 edits per ten-tick pulse excavates any loaded non-air block into a persisted 128-state reserve and consumes the exact stored state on an unoccupied air barrier behind the guardian. It deliberately has no block palette, ownership, hardness, block-entity, or labyrinth-bound exclusion, so player blocks, containers, mechanisms, fluids, Bedrock, and outside terrain are valid. Shared griefing and world-protection hooks remain the administrative override. Relocated block entities retain only their block state, not inventory/NBT. Its original development presentation is a blind stone statue with dormant, client-timed awakening, walking, and existing melee-signal poses; final model/palette and in-game approval remain pending. Focused tests cover topology, registry replacement, serialization compatibility, access routing, tunnel shells, placed geometry, lifecycle, duplicate repair, save/load, spawn-egg mapping, vibration weighting/ownership, real-tick pursuit and idle patrol through the navigation ownership handoff, environmental warning persistence, real ceiling debris, obstruction/open-sky fallback, lava ground conversion, break/place and griefing protection, real-tick lava contact damage, bounded floor collapse and protected columns, real fall damage, and legacy next-attack save migration, outside-bound Chest and Bedrock relocation, exact-state conservation, protection denial, and the defeated boundary. Natural multi-seed and chunk-border generation, vibration dispatch with real connected players, patrol/navigation, environmental warning/readability/balance, ceiling depletion, cumulative pit damage/escape, accumulated lava-pool spread and presentation, and destructive reshaping quality, block-entity data loss readability, collision behavior, existing-world behavior, multiplayer, dedicated servers, and actual visual presentation still need direct verification. Initial side-room content is implemented by a separate deterministic dead-end planner and chunk-bounded placer: up to six rooms per floor, with finite arrow dispensers/pressure plates and occasional loot-table chests, no lights or spawners. Content versioning preserves older starts. The boss drops one Lodestone via entity loot, and all six artifacts now gate the egg. `EarthGuardianRoute` supplies incremental three-wide full-body clearance and supported physical ramps when normal navigation stops. It conserves material in the bounded 128-state reserve, retains ramp heading on reload, and revalidates stopped segments. Synthetic low-ceiling and fourteen-block traversal fixtures isolate attack pads; combined natural traversal/combat, protected detours, idle patrol across floors, pacing, and reload midway through a natural climb remain unverified. Natural room balance, spawn composition, reward retrieval, and progression still need verification. `EarthGuardianMelee` now adds heard-player-only contact strikes with vanilla reach, a fresh budgeted wall check, player-mode/ownership guards, and a saved 30-tick cooldown. Pursuit speed is 1.4 and clue arrival no longer erases contact memory. This follows the 2026-09-08 aggressive melee-plus-environmental direction; natural balance still needs playtesting. The terrain pulse now prioritizes batched route excavation/support, then can spend spare budget on supported 3×3 trailing walls from conserved solid states. Wall attempts have a forty-tick cooldown and per-cell protection/occupancy checks. Natural wall placement and accelerated mutation load still need playtesting. Element order should be free. | | Sunflowers point to significant structure | Not implemented | ## Ocean Monument And Water Element @@ -260,7 +296,7 @@ Largest missing or partial design areas: | Loaded starvation for hunger-aware mobs | Implemented / needs in-game verification | `RetoldStarvationBehavior` applies one point of starvation damage on every species-specific hunger interval that reaches or remains at 100. The ordinary `PathfinderMob`, distinct Bat-colony adapter, and Villager communal-food hunger owners all use it; profiles with a zero hunger interval remain excluded. Bat dispatch occurs before the vanilla hierarchy split because `Bat` enters the `PathfinderMob` branch in 26.2. There is no health floor or loaded-world exception for named, tamed, hostile, or Villager mobs, so continued starvation can kill them. Feeding below 100 stops future pulses. Slimes and Magma Cubes retain their existing critical split/size-one death rule instead of also taking generic damage. Two focused GameTests assert that every loaded positive-hunger profile has an owner and cover all three runtime paths, terminal death, and a no-hunger exclusion; the existing Cube Mob starvation test passes. Cow, Bat, and Villager TPS checks pass all 15 phases below 50 ms/tick, peaking at 6.852, 11.856, and 10.129 ms/tick. Natural timing, death drops, feeding recovery, named/tamed behavior, Villagers, hostile hunger profiles, multiplayer, dedicated servers, long sessions, and existing worlds remain unverified. | | Natural loaded feeding viability for every hunger profile | Implemented / automated habitat matrix, needs natural verification | The patched 26.2 spawn-biome definitions and all 47 positive-hunger profiles are covered. `RetoldHungerSurvivalGameTests` gives each species a representative production habitat source or living prey instead of using dropped items as an ecology substitute; its 48th registry guard prevents uncovered positive-hunger profiles. Added routes cover renewable dead-bush scrub for Camels/desert Rabbits while retaining cactus as a hazard, renewable alpine scraping for Goats, renewable mycelium grazing for Mooshrooms, red-sand/terracotta grubs for Armadillos, Nether mushrooms for Piglins, Frog prey for Cats, jungle Chicken prey for Ocelots, Bat prey for cave Spiders, abstract nighttime cave insects for Bats, caravan sustenance for linked Trader Llamas, independent nearby-prey acquisition for hungry Slimes/Magma Cubes, crop foraging for Parrots, destructive tagged aquatic-plant grazing for school fish, and tagged dropped-raw-fish feeding for Squid. Existing flower, soil, bamboo, prey-kill, lava, and Villager-storage routes remain. Ordinary environmental forage is non-destructive, works with `mobGriefing=false`, and has a 30-second repeat-use cooldown; Parrot crops and aquatic plants instead obey the destructive shared griefing policy. Ordinary forage and dropped-food classifications are exposed through behavior-preserving Retold tags, composed with exact-match vanilla/Common food tags where available; former registry-path checks remain fallbacks. A bounded weak fair-claim queue prevents deterministic starvation under the unchanged eight-per-tick shared block-search cap; deferred foragers hold position rather than wandering away before admission. The prior matrix passed 41/41. The six new exact aquatic cases and expanded registry guard pass; the full expanded 48-test group was not rerun. This proves one loaded meal in representative spawn contexts, not indefinite population balance, every generated terrain arrangement, multiplayer, dedicated-server, existing-world, or unloaded survival. | | Confirmed mob/faction behavior contract | Partial | The detailed contract is recorded in `retold_mob_ai_system.md`. Static faction identity is now supplied by additive entity-type tags with exact default coverage, standard Illager/Undead composition, fail-closed conflicts, a separate loose-Illager-alliance tag, reload-aware classification/goals, and focused targeting/retaliation tests. Faction and datapack profile selection remain independent. The bounded unloaded ecosystem is implemented with focused automated coverage, but other portions of the larger species, society, hiring, and stage contract remain partial or missing. | -| Independent TPS coverage for every profiled mob | Implemented / automated verification | `RetoldPerMobTpsGameTests` registers 83 isolated tests with 50 subjects each and measures five 80-tick behavior phases: idle/rest, dropped food/forage, hunt/target, danger/social, and habitat/day-night. Appropriate habitat, prey, threat, and species stimuli are supplied per fixture. The original 68-profile clean baseline passed all 340 phases and exposed the fixed Sniffer nested block scan. Six aquatic ecology profiles grew the matrix to 74 tests/370 phases, and Villager to 75/375; that complete 2026-08-04 baseline passed every phase below 50 ms/tick. Strider, Nautilus, and Parrot brought registration to 78/390. The three Undead-mount profiles brought it to 81/405, Zombie Nautilus to 82/410, and Wildfire now brings it to 83/415; all focused later-profile phases pass below 50 ms/tick. Focused Dolphin and Bee defense reruns also pass all five phases, peaking at 5.675 and 7.103 ms/tick respectively. The eight exact Zombie/Skeleton-family fixtures now force Stage 2 so their maximum coordination path is measured; all 40 affected phases pass with a 6.046 ms/tick peak. The complete expanded matrix was not rerun because the maintained focused-selection policy did not justify repeating unaffected species. See `mob_tps_benchmark.md` for commands, earlier baselines, and limitations. | +| Independent TPS coverage for every profiled mob | Implemented / automated verification | `RetoldPerMobTpsGameTests` registers 84 isolated tests with 50 subjects each and measures five 80-tick behavior phases: idle/rest, dropped food/forage, hunt/target, danger/social, and habitat/day-night. Appropriate habitat, prey, threat, forage, and species stimuli are supplied per fixture. The original 68-profile clean baseline passed all 340 phases and exposed the fixed Sniffer nested block scan. Six aquatic ecology profiles grew the matrix to 74 tests/370 phases, and Villager to 75/375; that complete 2026-08-04 baseline passed every phase below 50 ms/tick. Strider, Nautilus, and Parrot brought registration to 78/390. The three Undead-mount profiles brought it to 81/405, Zombie Nautilus to 82/410, Wildfire to 83/415, and Earth Guardian now brings it to 84/420; all focused later-profile phases pass below 50 ms/tick. The refreshed active-roaming 50-Earth-Guardian run peaks at 7.302 ms/tick after adding supported excavation routes; command guardians use the production terrain/attack controller, but the benchmark disables block griefing and does not establish mutation or accumulated lava-flow cost. Focused Dolphin and Bee defense reruns also pass all five phases, peaking at 5.675 and 7.103 ms/tick respectively. The eight exact Zombie/Skeleton-family fixtures force Stage 2 so their maximum coordination path is measured; all 40 affected phases pass with a 6.046 ms/tick peak. The complete expanded matrix was not rerun because the maintained focused-selection policy did not justify repeating unaffected species. See `mob_tps_benchmark.md` for commands, earlier baselines, and limitations. | | Active food search and path-backed deliberate movement | Partial / implemented broadly, developer in-game verified | Hungry managed ground mobs now use a shared `FOOD`/`SEARCH` owner to travel between bounded reachable search points when immediate dropped food or forage is absent; existing predator and specialized search owners remain responsible for their profiles. Shared ground movement reports and caches only navigation requests that actually started. Bats use bounded vanilla 3D paths for colony return, food, search, hunting, evasion, and panic. Exact-species fish cohesion now uses ordinary aquatic navigation, and its contention-aware GameTest retries budget backpressure while still requiring owned `REGROUP` plus a reachable path. Focused GameTests cover a ground forager path, Bat food search and wall detours, and Cod school routing. On 2026-08-03, the developer reported that the ordered natural movement audit works across aquatic mobs, non-Bat flying mobs, large Cube Mobs, crowded groups, vertical terrain, barriers, and movement-ownership release. This remains an in-game report rather than multiplayer, dedicated-server, profiler, long-session, existing-world, or exhaustive automated path coverage. | | Dropped food preferred over ordinary prey hunting | Implemented / needs in-game verification | `RetoldFoodBehaviorEvents` now lets hunger-driven profiles consider valid dropped food while under ordinary `HUNT` control. Its higher-priority `FOOD`/`FEED` claim clears the prey target, chase sprint, navigation, and pending predator strike before pursuing the item. Retaliation and territory-attack ownership are explicitly protected, while higher-priority flee, defense, special combat, and territory control cannot be replaced. Slimes and Magma Cubes are the explicit appetite exception: `RetoldMobRules.wantsDroppedFood` remains true even at zero hunger, so both the shared food owner and longer-range swarm scavenger continue seeking items without enabling living-prey combat. Because Cube Mobs ignore ordinary path coordinates, `RetoldCubeMobMovement` now converts those shared movement requests into controller-facing and hop-speed commands while owned movement suppresses vanilla random heading changes. Deterministic GameTests cover an ordinary Wolf hunt, fed Slime item appetite and consumption, fed Slime target rejection, the hungry Slime swarm-hunt profile, shared food ownership, sprint cleanup, retained retaliation, and actual horizontal Slime movement toward a distant dropped item through the shared movement owner. Natural pack contention for one item, aquatic navigation, and transitions across all profile families still need focused in-game verification. | | Animal feeder / trough | Implemented / developer in-game verified | `animal_feeder` is a one-slot wooden block entity crafted from five planks. Right-click with compatible food inserts one item; sneak-right-click with compatible food inserts as much of the held stack as fits; sneak-right-click with an empty hand or incompatible item retrieves the stored stack. Exact stack data persists. Storage receives a copy; a Survival player's actual held stack loses exactly the accepted count, while Creative leaves the held stack unchanged. Hungry managed non-monster land `Animal`s use existing diets, cached/budgeted discovery, and ordinary `FOOD`/`FEED` ownership. Aquatic mobs, Villagers, hostile monsters, Slimes, and Magma Cubes are excluded. On 2026-08-04, the developer confirmed the model/collision, controls and exact counts, capacity and rejection, break drops, save/reload, representative diet/exclusion behavior, `mobGriefing=false`, exact Sheep routing, feeding pose, damage interruption, and several Sheep sharing one trough. Multiplayer, dedicated-server, long-session, and existing-world verification remain separate. | @@ -298,7 +334,7 @@ Largest missing or partial design areas: | Vex damage nerfed | Implemented / needs in-game verification | `RetoldVexEvents` halves the complete incoming amount of direct Vex strikes after weapon and enchantment contributions are calculated, without changing other Illager or indirect damage. An integrated GameTest verifies the resulting health loss. | | Sniffer removed from survival spawning | Implemented / needs in-game verification | Retold overrides the warm-ocean-ruin archaeology table to preserve its ordinary rewards while removing the sole vanilla Sniffer Egg entry. Sniffers, eggs, breeding, existing entities, commands/Creative creation, and the Retold Sniffer AI remain functional. A deterministic GameTest samples the live loot table and creates a command-sourced Sniffer. | | Endermites removed from survival spawning | Implemented / developer-verified | `RetoldMobAvailability` rejects non-Creative spawn-position paths, and `ThrownEnderpearlMixin` removes the vanilla Ender Pearl chance that bypasses those events. Commands, Creative spawn eggs/dispensers, loaded entities, dimension travel, and existing Retold AI remain functional. A deterministic GameTest covers the shared policy, natural-spawn rejection, and command creation; the developer confirmed the behavior in-game on 2026-08-02. | -| Breeze repurposed | Partial | Air Temple uses vanilla Breezes as island enemies and a custom Breeze-like Gale Core boss. The Gale Core fight is WIP and still needs tuning. | +| Breeze repurposed | Partial | Air Temple uses vanilla Breezes as island enemies and a custom Gale Core boss. Its installed Breeze head, glowing face, wind and animations are combined with original thin floating plates, a pale circlet, matching egg and a visible Heavy Core. Presentation remains development artwork; the fight still needs natural tuning and visual approval. | | Green axolotl | Not implemented / unclear | Still planned. | | Desperate-animal and wild-predator weak-barrier breaches | Implemented / developer-verified | Managed ground/amphibious animals use the central dispatcher, AI ownership, cached block-search budget, and `retold:weak_mob_barriers`. Desperate non-predators take 120 ticks; actively hunting wild predators take 60. Both show crack progress, make normal drops, and receive a 200-tick success cooldown. The initial tag covers wooden fences and closed fence gates, including Aender variants. GameTests cover tag boundaries, timings, normal drops, cooldown, tamed-predator exclusion, and `mobGriefing=false`; the developer confirmed the behavior works in-game on 2026-08-02. Crowded-enclosure performance still needs stress testing. | | Unloaded ecosystem simulation | Implemented / focused automated coverage, needs natural verification | Returning hunger-aware mobs reuse their persisted `lastHungerTickAt` timestamp. A multi-pulse gap enters a deduplicated server queue capped at 4,096 pending entities and 16 reconciliation attempts per tick; elapsed debt is limited to seven Minecraft days. At most one real meal is consumed per simulated day through compatible feeders, accessible forage, Villager inventory/storage, or reachable wild prey under the documented protections. Eligible adult breeders advance the same continuous five-minute `FULL` clock across this simulated hunger timeline; hunger resets progress, capped history starts fresh, and ready pairs resume through the existing bounded loaded mate scan and vanilla birth behavior. There is deliberately no population-cap calculation. After at least one full foodless unloaded day, a second bounded queue can physically relocate at most one eligible land herd, Pig foraging group, or fish school per tick to a better loaded range within 32 blocks. Remaining critical pulses apply one accumulated damage transaction; named/tamed and horse-family mobs stop at one health, while Cube Mobs perform one real split-or-die transaction. Eligible Farmers queue one real reachable Farmer-owned crop harvest/replant/surplus-deposit cycle per unloaded day, capped at seven, and returning mobs deduplicate by chunk into one vanilla natural-spawn pass per unloaded day, also capped at seven and processed one chunk per tick. Spawning runs only when the target chunk and its 3-by-3 neighborhood are already loaded, preventing catch-up from force-loading or generating terrain. Source state, hunger, meal/hunt time, breeding progress, stress, confidence, metabolism time, real entity position, group range, crop blocks, inventories, and ownership provenance persist; no loaded animations or combat are synthesized. Focused calculator tests plus exact batching, food, predation, protection, breeding, migration, starvation/Cube, Farmer, and spawning queue/rule GameTests pass. Natural spawn composition, crowded return pacing, multiplayer, dedicated servers, long sessions, and existing worlds remain unverified. | @@ -327,7 +363,7 @@ Largest missing or partial design areas: | Scratch modern End update | Partial / needs visual verification | Aender redirects late End access; End gateways are blocked, End City structure biome tags are emptied, outer End density is masked, and the vanilla End's periodic visual/lightmap/sound flashes are disabled client-side. Existing-world and client behavior still needs testing. Vanilla End remains command-accessible by design. | | No End Cities / no End islands / no survival elytra | Partial / needs worldgen verification | End City biome tag is empty, gateway spawning is cancelled, and `end/sloped_cheese` uses `retold:central_end_island_mask` outside radius 512. Elytra item should remain, but should not be obtainable in survival because End Cities do not generate. | | End sky randomly generated | Implemented / needs visual verification | `RetoldEndSkyData`, `/retold sky randomize`, and the client-generated sky texture are implemented. `ClientLevelEndFlashMixin` removes the vanilla End flash image, brightness pulse, and sound without disabling the End skybox. | -| Aender Eye / Eye of Ender symbiosis | Partial | `AenderEye` entity exists. Full lore/gameplay relation to ender pearls/eyes not implemented. | +| Aender Eye / Eye of Ender symbiosis | Partial | `AenderEye` entity exists and directly reuses the installed vanilla Eye of Ender texture as an emissive billboard, as directed by the developer. Full lore/gameplay relation to ender pearls/eyes is not implemented. | | Ender pearl shell destroyed with blaze powder to retrieve eye | Not implemented | ## Farming, Blocks, Environment, QoL Notes diff --git a/docs/internal/gale_core_breeze_prompts_2026-10-12.json b/docs/internal/gale_core_breeze_prompts_2026-10-12.json new file mode 100644 index 00000000..1bf0c9fe --- /dev/null +++ b/docs/internal/gale_core_breeze_prompts_2026-10-12.json @@ -0,0 +1,24 @@ +{ + "date": "2026-10-12", + "mode": "built-in image generation", + "direction": "Xefensor rejected the previous golem-like commander; use the installed vanilla Breeze model, head/wind/eyes materials, shader and keyframes; original cool circlet and four thin plates; actual Heavy Core visible", + "runtime_minecraft_resources": "Breeze body/wind/eyes and Heavy Core resolved from the installed game; no copied or modified Minecraft pixels/models in Retold", + "author": "OpenAI image generation, directed and mechanically processed by Codex under Xefensor direction", + "license": "Retold Asset License for original textures only; runtime Minecraft material remains Mojang/Microsoft", + "approval": "development art; in-game approval pending", + "sources": [ + { + "name": "gale_plate", + "prompt": "Production texture for an original Minecraft Java mod mob: one small flat armor plate front, shown head-on, completely fills the rectangular canvas. EXACTLY 5 pixels wide and 8 pixels tall in logical pixel art, enlarged with crisp nearest neighbor square pixels. Vanilla Minecraft Breeze family palette: muted purplish blue (#7776a3), dusty violet shadow (#525171), pale grey lilac edge (#b0acc4). A narrow one-pixel pale border around a solid muted purple field, only two or three small shade patches; four or five colors total, chunky plain texels. No gold, no gem, no engraving, no bevel gradient, no 3D perspective, no realistic metal, no fine noise, no text, no margins. This is an original shield material used on four rectangular floating plates, not a picture of a creature. Opaque surface edge to edge.", + "source": "/home/xela/.codex/generated_images/01a13080-a478-7ad3-92b1-d96722e9441e/exec-83440f76-d5f8-4270-af3f-dea724aa2d1b.png", + "workspace_source": "output/imagegen/gale-core-breeze/sources/gale_plate.png" + }, + { + "name": "gale_core_spawn_egg", + "prompt": "Original Minecraft-style inventory sprite for a Breeze commander spawn egg. One compact upright egg centered with transparent padding, logical 16 by 16 pixel icon enlarged with sharp nearest neighbor squares, about 10 pixels wide and 14 high. Simple familiar stepped egg outline, muted dark purplish blue egg with a few broad pale grey lavender spots and cool ivory spots. Match Minecraft Breeze purple and pale wind palette. Five or six flat colors, sparse blocky shading. No gold, no crown on the egg, no face, no decorative markings, no glow, no shadow outside the egg, no fine details, no antialiasing, no words. Transparent background.", + "source": "/home/xela/.codex/generated_images/01a13080-a478-7ad3-92b1-d96722e9441e/exec-ed2563c7-9f1d-48f6-ba93-5fe1bb3bf2be.png", + "workspace_source": "output/imagegen/gale-core-breeze/sources/gale_core_spawn_egg.png" + } + ], + "active_revision_reference": "retold_asset_revision_2026-10-23.json" +} diff --git a/docs/internal/gale_core_commander_prompts_2026-10-12.json b/docs/internal/gale_core_commander_prompts_2026-10-12.json new file mode 100644 index 00000000..fb3d1215 --- /dev/null +++ b/docs/internal/gale_core_commander_prompts_2026-10-12.json @@ -0,0 +1,37 @@ +{ + "mode": "Built-in image generation", + "date": "2026-10-12", + "direction": "Crowned Breeze commander, visible installed Heavy Core, Wildfire-inspired floating armor, original vanilla-scale art", + "runtime_resource": "minecraft:heavy_core model and textures resolved from installed Minecraft/resource packs; no vanilla pixels copied into mod resources", + "assets": [ + { + "name": "gale_shell", + "prompt": "One ORIGINAL seamless16x16 logical pixel Minecraft wind elemental commander armor material, opaque square edges. Classic vanilla scale, quiet restrained flat pixel art enlarged crisp nearest-neighbor. Mostly muted dark lavender-grey #655f7c with grouped subtle patches #5b566e and #75708a, a few tiny pale wear marks #8c889e. Calm hard material for original Breeze-like head and floating armor, no randomnoise, camouflage, tilegrid, glow, eyes, symbols, text, blur, gradients, blue stone takeover or copiedMinecraftpixels. 5-6 colors max.", + "source": "output/imagegen/gale-core-commander/sources/gale_shell.png", + "author": "OpenAI image generation, directed and processed by Codex under Xefensor direction", + "status": "Original generated development art following confirmed Breeze-commander direction; final visual approval pending" + }, + { + "name": "gale_face", + "prompt": "One ORIGINAL8x8 logical pixel Minecraft Breeze commander FACE PANEL, crisp enlarged flat pixel squares, opaque square. Muted lavender-grey face background #655f7c/#5b566e/#75708a, TWO small bright warm ivory eyes #eee6c8 withtiny dark pupil pixels beneath a stern brow, small dark restrained mouth notch. Serious cunning wind elemental expression, readable original arrangement at8pixels, not humanoid nose, skull, smile, giant blackmouth or creeper. NOcrown embedded intoimage: crown and raised ivory windswept eyebrows are separate3Dgeometry. Classic vanilla restrained pixel art, 6-8flat colors, no antialias, glow, gradient or copiedBreeze texture.", + "source": "output/imagegen/gale-core-commander/sources/gale_face.png", + "author": "OpenAI image generation, directed and processed by Codex under Xefensor direction", + "status": "Original generated development art following confirmed Breeze-commander direction; final visual approval pending" + }, + { + "name": "gale_plate", + "prompt": "One ORIGINALMinecraft pixel armor shield FRONT PANEL for a Breeze commander. EXACT5logicalpixels wide and8logicalpixels tall, enlarged crisp hard pixel art. Opaque vertical rectangle with1logicalpixel muted warm brass #b8a36b/#897c58 edging, central darklavender-grey field #655f7c, subdued paleivory topedge #e0d3a4. Plain heavy floatingplate withone short restrained worn rivet mark, no emblem, letters, skull, jewel, neon, realism, gradients or copiedWildfire/Minecraftpixels. Vanilla readability. Functional wind-king armor, notgoldenluxury fantasyillustration. Fillentire rectangle.", + "source": "output/imagegen/gale-core-commander/sources/gale_plate.png", + "author": "OpenAI image generation, directed and processed by Codex under Xefensor direction", + "status": "Original generated development art following confirmed Breeze-commander direction; final visual approval pending" + }, + { + "name": "gale_core_spawn_egg", + "prompt": "One ORIGINALMinecraft spawn egg inventorysprite, EXACT16x16 logical pixels enlarged crisp pixel art onTRUEtransparentbackground. Compact rounded stepped egg10pixelswide14pixelshigh with1pixelmargin. Muted lavender-grey shell #655f7c/#75708a, small irregular paleivory windflecks #eee6c8, two restrained mutedbrass flecks #b8a36b echoing a crowned Breeze commander. Originaleggpattern, no face/crown/icon pastedon, no blur, glow, outlines, gradient or copiedvanillaeggpattern. 6flatcolorsmax.", + "source": "output/imagegen/gale-core-commander/sources/gale_core_spawn_egg.png", + "author": "OpenAI image generation, directed and processed by Codex under Xefensor direction", + "status": "Original generated development art following confirmed Breeze-commander direction; final visual approval pending" + } + ], + "status": "superseded by gale_core_breeze_prompts_2026-10-12.json after developer rejection of style" +} diff --git a/docs/internal/klei-field-guide.template.html b/docs/internal/klei-field-guide.template.html new file mode 100644 index 00000000..015bd91e --- /dev/null +++ b/docs/internal/klei-field-guide.template.html @@ -0,0 +1,116 @@ + + + + + + +Retold — A living-world field guide + + + + +
@@PAGES@@
+ + diff --git a/docs/internal/klei-outreach.md b/docs/internal/klei-outreach.md new file mode 100644 index 00000000..ec507201 --- /dev/null +++ b/docs/internal/klei-outreach.md @@ -0,0 +1,145 @@ +# Sharing Retold with Klei + +This is the local preparation record for a personal invitation to explore Retold. Nothing here has +been sent or published. The video context is the transcript Xef supplied in the conversation for +[How can we make Minecraft feel alive? (It isn’t structures)](https://www.youtube.com/watch?v=cBmt2FNP1Ug). +No external transcript retrieval succeeded; the guide does not invent timestamps or quotations. + +## The package + +Run from the repository root: + +```bash +python3 tools/export_klei_field_guide.py +``` + +The exporter uses Python Markdown, PySide6, and pypdf, all already present in the working environment. +It renders the eight-page guide, embeds its existing screenshot, copies the full handbook and the +current configured JAR, includes license/credit files, and writes checksums and build identity. +It produces `output/klei-field-guide/` and `output/Retold-for-Klei.zip`. It does not rebuild or +modify the JAR, change gameplay, run Minecraft, send a message, or publish anything. + +The HTML and PDF share the same Markdown content and field-guide styling. The PDF uses Qt’s +offscreen rich-text renderer with a print stylesheet and explicit page frames; it requires no browser +process or network access. Qt’s supported rich-text layout is documented in +[Supported HTML Subset](https://doc.qt.io/qt-6/richtext-html-subset.html). Chromium printing was +attempted here, but the environment denied process socket operations; the Qt renderer works within +those restrictions. PDF navigation is added from the laid-out text so links remain clickable. + +The JAR version follows gradle.properties; the guide was updated for the 0.5.0 alpha release on +13 November 2026. The complete handbook remains the preceding 11 November development edition. +`BUILD.json` records the packaged JAR’s checksum, +file timestamp, source revision, dirty-worktree status, and static package checks. Preserve that +identity when sharing it. If the JAR or relevant sources change, check the claims and regenerate. + +The eight-page source is [../klei-field-guide.md](../klei-field-guide.md). Keep the complete +[player handbook](../player-guide.md) as the optional reference. Recipient-facing files live inside +the ZIP; this preparation record and the capture checklist do not. + +## Introduction draft + +The exporter copies only the following message into `output/klei-message.txt`, outside the ZIP. +It deliberately makes no claim that footage is attached or that the mod is fully tested. + + +Subject: Retold — something to play with after your living-world video + +Hey Klei, + +Your video about making Minecraft feel alive made me want to send you Retold, a mod I've been working on. + +The ecology is the part I thought you might enjoy. Animals need food, herds can move when their feeding grounds run out, and breeding depends on keeping animals fed and safe. Predators have hunger too. I’m interested in how those rules interact with the places players build. + +It’s still experimental, especially the long-term balance. I use AI assistance for development, and some of the development artwork is generated. The design direction is mine; the project’s credits are included. + +I've attached the build with a short field guide and the full handbook if you want to look anything up. Page 7 has a few things you can try straight away in Creative, or you can start a fresh Survival world. + +Just wanted to share it so you could check it out and play around with it. + +Xefensor + + +## Gameplay capture for Xef + +**Status: not recorded.** The repository’s AGENTS.md assigns gameplay screenshots, video capture, +and subjective game inspection to the developer. No ecology footage or interface screenshots have +been fabricated. The field guide includes one existing, attributed earlier-build weather screenshot. + +Use the exact packaged JAR, a fresh disposable cheats-enabled world, and ordinary active animals. +The gallery disables exhibit AI. Leave mob griefing enabled when demonstrating destructive grazing +or fence behavior. Keep the relevant chunks active. Debug hunger changes are allowed for setup, +but state that they were used. Use the guide’s page 7 procedures; keep the initial setup out of the +finished clip only if the caption still makes it clear. + +Aim for 75–90 seconds of footage: + +| Approximate edit time | Capture | What the caption must establish | +| --- | --- | --- | +| 0–20 seconds | A Cow consuming a real grass/crop block, then feeding at an accessible Wheat trough | Food can change the surroundings; show the block/stack change rather than only an idle animal. | +| 20–45 seconds | Two continuously well-fed adult Cows progressing to mating and a birth | At least five minutes of sustained care precedes readiness; label time compression and any hunger commands. | +| 45–75 seconds | A wild hungry Wolf pursuing suitable prey; show the successful kill if one occurs and the subsequent state | A meal reduces hunger and clears the current hunt. Do not imply a guaranteed forty-minute cooldown. | +| 75–90 seconds | A wide view of the same place or a brief range comparison | Leave room for an unscripted interaction. Do not claim this proves long-term ecosystem stability. | + +Record the waits before editing. If a condition does not occur, retain the honest observation and +change the scene rather than staging an outcome with teleportation or kills. Keep before/after +debug-state screenshots in the local record when commands were used. There is no need to simulate +weeks of balance to make this introductory clip. + +Useful additional screenshots, if time allows: + +- Animal Feeder with its clear approach and actual food supply; caption the interaction used. +- Villager teaching panel with a supported finished sample and its displayed price. +- Enchanting interface showing controls without spelling out a solved word. + +Put finished media under `output/klei-field-guide/` and regenerate the ZIP with the exporter’s +`--include-media` option. It includes only top-level PNG, JPEG, WebP, MP4, or WebM files other than +its generated page previews; optional media is not required to render or package the guide. + +## Claim audit + +These are implementation observations, not a report of new in-game testing. Paths below are +relative to `src/main/java/cz/xefensor/retold/` unless marked otherwise. + +| Guide claim | Owning source / relevant existing coverage | +| --- | --- | +| Primitive tool opening and changed mining ladder | `progression/RetoldToolProgressionEvents.java`; `progression/RetoldToolProgressionGameTests.java`; source recipe and block tags. | +| Food depletion and range migration; feeder can anchor range | `behavior/home/RetoldHerdRangeEvents.java`, `behavior/food/RetoldRangeForage.java`, `behavior/food/RetoldAnimalFeederBehavior.java`. | +| Sustained five-minute satisfaction, nearby compatible adults | `behavior/breeding/RetoldAnimalBreeding.java`; existing `animal_breeding_requires_sustained_satisfaction` GameTest. | +| No breeding population cap | Same breeding implementation; existing `unloaded_breeding_uses_food_satisfaction_without_population_cap` GameTest. | +| Successful hunt relieves hunger and clears current target | `behavior/hunting/RetoldControlledHuntingEvents.java:onLivingDeath`; `behavior/profiles/RetoldMobRules.java`. Remaining hunger/state still matter. | +| Predator perception and fatigue | `behavior/hunting/RetoldPredatorSearchEvents.java`, `behavior/hunting/RetoldPredatorStaminaEvents.java`. | +| Seven-day bounded world-time catch-up | `behavior/ecology/RetoldUnloadedCatchUpPlan.java`, `RetoldUnloadedEcosystemCatchUp.java`; corresponding JUnit and GameTests. | +| Polar Bears have no Retold hunger cycle | `src/main/resources/data/retold/mob_profiles/polar_bear.json`: hunger interval zero, predator false. | +| Gallery is an asset inspection tool with frozen exhibits | `command/showcase/RetoldShowcaseEntities.java`; commands in `command/RetoldCommands.java`. | +| Commands and hunger direction | `behavior/debug/RetoldBehaviorDebugEvents.java`; `/retoldbehavior` requires level 2 and looks at an eligible creature within approximately 24 blocks. | + +Do not turn the video’s specific suggestions into claims about Retold: there is no implemented +lichen/substrate succession loop, Muskox, universal predator-loot suppression, universal fixed +post-kill cooldown, or habitat-quality production bonus established by this review. Local collapse +is allowed by the confirmed Retold design; no stable-equilibrium guarantee is made. + +## Validation and remaining checks + +For this documentation/package task, follow `testing_strategy.md`: validate the exports, links, +formatting, claims, copied bytes, metadata, and `git diff --check`. Do not run unrelated gameplay +suites. The exporter checks that the bundled JAR matches the available compiled classes and current +packaged resources, and rejects source/build inputs newer than that JAR. Those checks do not prove +runtime behavior or replace an in-game check. + +Xef still needs to exercise the three natural/command-assisted scenarios and record the clip. +Multiplayer, dedicated-server, old-world, complete-progression, and long-session balance results +remain outside this document preparation. No sending or publishing is authorized by this file. + +Documentation preparation checks completed on 11 November 2026: + +- PDF export: eight A4 pages, eight navigation bookmarks, and 15 hyperlink hit areas. Every page + fits its content frame; rendered pages were inspected, including the dense food/playground pages. +- Guide/handbook HTML: local files and internal anchors resolve; the guide screenshot is embedded. + External URLs were preserved but not network-verified. +- Package identity: all 943 available compiled classes and 2,435 current source resource files + match the existing JAR byte for byte. The JAR’s SHA-256 is + `424434d4a5b5dad38e68ca42432a65013b43a194e99cab586133262c79cc392d`. +- ZIP: integrity, every included file’s checksum, unchanged handbook copies, and the original JAR + bytes were verified. The message draft and local capture instructions are outside the ZIP. +- Python syntax and new-file whitespace checks pass; `git diff --check` passes. No Gradle build, + new GameTest run, game-client run, server playtest, or new gameplay capture was performed. diff --git a/docs/internal/mob_tps_benchmark.md b/docs/internal/mob_tps_benchmark.md index f6568670..402ff529 100644 --- a/docs/internal/mob_tps_benchmark.md +++ b/docs/internal/mob_tps_benchmark.md @@ -4,6 +4,22 @@ ## Coverage +The 2026-09-08 batched-terrain/wall pass ran only `retold:mob_tps_earth_guardian`: +4.670 ms/tick idle, 6.714 food, 7.281 hunt, 5.510 danger, and 3.690 habitat, with all 50 subjects +active and 20 TPS in every phase. Griefing is disabled in this fixture, so the result does not +profile simultaneous twelve-block mutation bursts, wall placement, or later fluid/physics updates. + +The 2026-09-08 aggressive Earth combat pass ran the exact `retold:mob_tps_earth_guardian` +selector: all 50 subjects remained active at 20 TPS, with 11.376 ms/tick idle, 11.660 food, +13.915 hunt, 12.533 danger, and 9.420 habitat. The benchmark keeps griefing disabled and does +not exercise fifty simultaneous close-player melee strikes; the dedicated contact and combined +combat tests cover correctness, not a large multiplayer combat profile. + +The 2026-09-07 moving-clue tunnel fix was checked with only the exact +`retold:mob_tps_earth_guardian` selector. All 50 subjects remained active at 20 TPS in each phase: +5.634 ms/tick idle, 7.282 food, 9.649 hunt, 7.881 danger, and 3.979 habitat. The fixture disables +griefing, so this is not a measurement of sustained tunnel excavation or accumulated fluid flow. + `RetoldPerMobTpsGameTests` registers one isolated GameTest for every loaded Retold mob profile. The current matrix registers 83 mob types; the latest complete baseline covers 75, while focused runs cover the eight later profiles and the original clean table below records the earlier 68-profile baseline. Each test creates 50 subjects in a habitat fixture suited to that species and measures five consecutive 80-server-tick phases after a 20-tick warmup: 1. `idle_rest`: ordinary loaded behavior with no injected food or opponent. @@ -528,6 +544,50 @@ order. Cow danger/social was the combined 6.472 ms/tick peak. The two exact stab focused damage, water, visible-intent, Creeper, Cat, wounded-predator, and stuck-recovery regressions remain the correctness evidence. +### Earth Guardian Vibration, Environmental Combat, And Terrain-Guard Focused Run + +The exact `retold:mob_tps_earth_guardian` selector was refreshed on 2026-09-02 after the unmanaged +Earth Guardian's terrain controller became unrestricted by block type, provenance, or labyrinth +bounds and was rerun after replacing direct attacks with bounded ceiling-collapse and lava-eruption +checks. Its vanilla +vibration listener, persisted weighted clue memory, bounded patrol attempts, and owned investigation +remain active. This keeps current registration at 84 tests and 420 phases. Fifty active roaming +guardians sustained 20 TPS in every phase: 4.556 idle/rest, 6.229 +dropped-food/forage, 7.702 hunt/targeting, 7.194 danger/social, and 4.584 habitat/day-night ms/tick. +Hunt/targeting was the 7.702 ms/tick peak. Command-spawned fixtures use the same terrain controller, +but this benchmark disables `mobGriefing`, so it does not establish mutation or fluid-spread cost. +The exact environmental-combat and relocation GameTests are the correctness evidence for warning, +debris, eruption, and Chest/Bedrock outside-bound edits; natural accumulated destruction and combat readability still +need profiling. The complete matrix was not selected because the changed path is Earth-Guardian-local. + +On 2026-09-07 the same exact selector passed after the lava attack changed to real floor replacement: +5.160 idle/rest, 6.656 dropped-food/forage, 8.224 hunt/targeting, 7.340 danger/social, and +4.367 habitat/day-night ms/tick, sustaining 20 TPS throughout. This remains an AI baseline with +griefing disabled. `retold:earth_guardian_uses_environmental_attacks` verifies conversion/protection, +and `retold:earth_guardian_lava_ground_burns_on_server_ticks` verifies actual lava contact damage; +long encounters with accumulated flowing lava still need profiling in natural worlds. + +The subsequent floor-collapse rotation run on 2026-09-07 also passed all five phases at 20 TPS: +8.214 idle/rest, 8.847 dropped-food/forage, 10.104 hunt/targeting, 9.507 danger/social, and +5.911 habitat/day-night ms/tick. The same disabled-griefing limitation applies. The exact +`retold:earth_guardian_floor_collapse_causes_real_fall` test supplies the pit/protection/save-load +and physical fall-damage evidence; cumulative terrain destruction is not a measured workload here. + +After fixing the investigation/patrol navigation-ownership handoff on 2026-09-07, the exact +selector passed again at 20 TPS in all five phases: 4.281 idle/rest, 6.321 dropped-food/forage, +8.619 hunt/targeting, 8.614 danger/social, and 4.760 habitat/day-night ms/tick. Investigation now +uses the shared path budget and retry helper. These host-dependent timings are not a controlled +before/after speed comparison, and the disabled-griefing limitation remains. Separate real-tick +approach and patrol regressions verify that navigation actually moves the guardian. + +After adding full-body excavation, supported ramps, and the 128-state reserve on 2026-09-07, +the exact selector again passed all five phases at 20 TPS: 4.787 idle/rest, 7.098 food/forage, +7.302 hunt/targeting, 6.532 danger/social, and 4.071 habitat/day-night ms/tick. The disabled-griefing +fixture remains an AI baseline: it does not measure repeated full-reserve backfill scans, active +excavation, fluid spread, or natural combined combat. Low-ceiling, full fourteen-block ascent and +descent, and protection/conservation/save-state GameTests supply isolated correctness evidence. +Host-dependent timings are not a controlled before/after speed comparison. + ## Results The table below records the original clean baseline described above; later rerun summaries are diff --git a/docs/internal/retold_asset_prompts_2026-10-12.json b/docs/internal/retold_asset_prompts_2026-10-12.json new file mode 100644 index 00000000..00ae6d5a --- /dev/null +++ b/docs/internal/retold_asset_prompts_2026-10-12.json @@ -0,0 +1,183 @@ +{ + "mode": "Built-in image generation", + "date": "2026-10-12", + "processing": "ImageMagick alpha threshold before tight cropping, nearest-neighbor reduction, binary cutouts and original-material UV packing; no Minecraft texture pixels copied", + "assets": [ + { + "name": "steel_ingot", + "prompt": "Create one completely original Minecraft-compatible inventory item sprite for Retold. EXACT16x16 logical pixels enlarged as crisp pixel art, each logical pixel one flat uniform square. Classic vanilla proportions and readability, restrained 6-10 color palette, hard pixel edges, no blur, antialiasing, gradients, PBR/render sheen, huge mosaic shapes, bloom, neon, writing or copied Minecraft texture pixels. Genuine transparent background, 1 logical pixel breathing room. Steel palette: moderately dark cool silver/blue-grey (#687681 shadows, #8d9ca5 midtone, #bcc9cf restrained highlights, #394953 outline), distinctly darker than ordinary iron but unmistakably steel. Timber handles: muted brown (#684b32 and #98724a), no purple/Aender wood. Minimal neutral dark bindings.\nSpecific item: One refined steel ingot in a familiar small oblique bar silhouette, three flat planes, muted cool steel with a single pale highlight along the top edge. Functional mundane metal, not a gemstone or magic crystal.", + "source": "output/imagegen/retold-equipment-and-bosses/sources/steel_ingot.png", + "author": "OpenAI image generation, directed and processed by Codex under Xefensor direction", + "status": "Original generated development art; final in-game visual approval pending" + }, + { + "name": "steel_sword", + "prompt": "Create one completely original Minecraft-compatible inventory item sprite for Retold. EXACT16x16 logical pixels enlarged as crisp pixel art, each logical pixel one flat uniform square. Classic vanilla proportions and readability, restrained 6-10 color palette, hard pixel edges, no blur, antialiasing, gradients, PBR/render sheen, huge mosaic shapes, bloom, neon, writing or copied Minecraft texture pixels. Genuine transparent background, 1 logical pixel breathing room. Steel palette: moderately dark cool silver/blue-grey (#687681 shadows, #8d9ca5 midtone, #bcc9cf restrained highlights, #394953 outline), distinctly darker than ordinary iron but unmistakably steel. Timber handles: muted brown (#684b32 and #98724a), no purple/Aender wood. Minimal neutral dark bindings.\nSpecific item: A standard straight double-edged steel sword diagonally from lower-left grip to upper-right point. Thin straight blade, small crossguard, brown grip and compact pommel. Familiar simple vanilla sword silhouette, no oversized fantasy guard or curves.", + "source": "output/imagegen/retold-equipment-and-bosses/sources/steel_sword.png", + "author": "OpenAI image generation, directed and processed by Codex under Xefensor direction", + "status": "Original generated development art; final in-game visual approval pending" + }, + { + "name": "steel_pickaxe", + "prompt": "Create one completely original Minecraft-compatible inventory item sprite for Retold. EXACT16x16 logical pixels enlarged as crisp pixel art, each logical pixel one flat uniform square. Classic vanilla proportions and readability, restrained 6-10 color palette, hard pixel edges, no blur, antialiasing, gradients, PBR/render sheen, huge mosaic shapes, bloom, neon, writing or copied Minecraft texture pixels. Genuine transparent background, 1 logical pixel breathing room. Steel palette: moderately dark cool silver/blue-grey (#687681 shadows, #8d9ca5 midtone, #bcc9cf restrained highlights, #394953 outline), distinctly darker than ordinary iron but unmistakably steel. Timber handles: muted brown (#684b32 and #98724a), no purple/Aender wood. Minimal neutral dark bindings.\nSpecific item: A conventional steel pickaxe inventory silhouette, angled brown handle rising from lower-left to upper-right and a two-ended arched blue-grey steel pick head across upper part. Distinct narrow mining pick tips, not an axe blade.", + "source": "output/imagegen/retold-equipment-and-bosses/sources/steel_pickaxe.png", + "author": "OpenAI image generation, directed and processed by Codex under Xefensor direction", + "status": "Original generated development art; final in-game visual approval pending" + }, + { + "name": "steel_axe", + "prompt": "Create one completely original Minecraft-compatible inventory item sprite for Retold. EXACT16x16 logical pixels enlarged as crisp pixel art, each logical pixel one flat uniform square. Classic vanilla proportions and readability, restrained 6-10 color palette, hard pixel edges, no blur, antialiasing, gradients, PBR/render sheen, huge mosaic shapes, bloom, neon, writing or copied Minecraft texture pixels. Genuine transparent background, 1 logical pixel breathing room. Steel palette: moderately dark cool silver/blue-grey (#687681 shadows, #8d9ca5 midtone, #bcc9cf restrained highlights, #394953 outline), distinctly darker than ordinary iron but unmistakably steel. Timber handles: muted brown (#684b32 and #98724a), no purple/Aender wood. Minimal neutral dark bindings.\nSpecific item: A conventional steel axe inventory silhouette, diagonal brown handle and one broad cutting head near upper end, cool dark silver steel blade with a restrained pale cutting edge. Simple compact vanilla axe.", + "source": "output/imagegen/retold-equipment-and-bosses/sources/steel_axe.png", + "author": "OpenAI image generation, directed and processed by Codex under Xefensor direction", + "status": "Original generated development art; final in-game visual approval pending" + }, + { + "name": "steel_shovel", + "prompt": "Create one completely original Minecraft-compatible inventory item sprite for Retold. EXACT16x16 logical pixels enlarged as crisp pixel art, each logical pixel one flat uniform square. Classic vanilla proportions and readability, restrained 6-10 color palette, hard pixel edges, no blur, antialiasing, gradients, PBR/render sheen, huge mosaic shapes, bloom, neon, writing or copied Minecraft texture pixels. Genuine transparent background, 1 logical pixel breathing room. Steel palette: moderately dark cool silver/blue-grey (#687681 shadows, #8d9ca5 midtone, #bcc9cf restrained highlights, #394953 outline), distinctly darker than ordinary iron but unmistakably steel. Timber handles: muted brown (#684b32 and #98724a), no purple/Aender wood. Minimal neutral dark bindings.\nSpecific item: A conventional steel shovel inventory silhouette: diagonal brown shaft with a rounded squared steel spade head at upper-right. Clear thin handle and compact shovel blade, ordinary vanilla tool proportions.", + "source": "output/imagegen/retold-equipment-and-bosses/sources/steel_shovel.png", + "author": "OpenAI image generation, directed and processed by Codex under Xefensor direction", + "status": "Original generated development art; final in-game visual approval pending" + }, + { + "name": "steel_hoe", + "prompt": "Create one completely original Minecraft-compatible inventory item sprite for Retold. EXACT16x16 logical pixels enlarged as crisp pixel art, each logical pixel one flat uniform square. Classic vanilla proportions and readability, restrained 6-10 color palette, hard pixel edges, no blur, antialiasing, gradients, PBR/render sheen, huge mosaic shapes, bloom, neon, writing or copied Minecraft texture pixels. Genuine transparent background, 1 logical pixel breathing room. Steel palette: moderately dark cool silver/blue-grey (#687681 shadows, #8d9ca5 midtone, #bcc9cf restrained highlights, #394953 outline), distinctly darker than ordinary iron but unmistakably steel. Timber handles: muted brown (#684b32 and #98724a), no purple/Aender wood. Minimal neutral dark bindings.\nSpecific item: A conventional steel hoe inventory silhouette, diagonal brown handle and small right-angled cool steel farming head extending across upper part. Narrow hoe blade, no big axe shape.", + "source": "output/imagegen/retold-equipment-and-bosses/sources/steel_hoe.png", + "author": "OpenAI image generation, directed and processed by Codex under Xefensor direction", + "status": "Original generated development art; final in-game visual approval pending" + }, + { + "name": "steel_helmet", + "prompt": "Create one completely original Minecraft-compatible inventory item sprite for Retold. EXACT16x16 logical pixels enlarged as crisp pixel art, each logical pixel one flat uniform square. Classic vanilla proportions and readability, restrained 6-10 color palette, hard pixel edges, no blur, antialiasing, gradients, PBR/render sheen, huge mosaic shapes, bloom, neon, writing or copied Minecraft texture pixels. Genuine transparent background, 1 logical pixel breathing room. Steel palette: moderately dark cool silver/blue-grey (#687681 shadows, #8d9ca5 midtone, #bcc9cf restrained highlights, #394953 outline), distinctly darker than ordinary iron but unmistakably steel. Timber handles: muted brown (#684b32 and #98724a), no purple/Aender wood. Minimal neutral dark bindings.\nSpecific item: A plain steel armor helmet inventory sprite: centered squared domed helmet with open face recess, cool dark silver metal and small pale brow highlight. Mundane functional vanilla plate helmet, no horns, gems, plume or full visor.", + "source": "output/imagegen/retold-equipment-and-bosses/sources/steel_helmet.png", + "author": "OpenAI image generation, directed and processed by Codex under Xefensor direction", + "status": "Original generated development art; final in-game visual approval pending" + }, + { + "name": "steel_chestplate", + "prompt": "Create one completely original Minecraft-compatible inventory item sprite for Retold. EXACT16x16 logical pixels enlarged as crisp pixel art, each logical pixel one flat uniform square. Classic vanilla proportions and readability, restrained 6-10 color palette, hard pixel edges, no blur, antialiasing, gradients, PBR/render sheen, huge mosaic shapes, bloom, neon, writing or copied Minecraft texture pixels. Genuine transparent background, 1 logical pixel breathing room. Steel palette: moderately dark cool silver/blue-grey (#687681 shadows, #8d9ca5 midtone, #bcc9cf restrained highlights, #394953 outline), distinctly darker than ordinary iron but unmistakably steel. Timber handles: muted brown (#684b32 and #98724a), no purple/Aender wood. Minimal neutral dark bindings.\nSpecific item: A plain steel armor chestplate inventory sprite: broad squared shoulders, a small neck opening, angular breastplate and narrowed waist. Cool dark silver metal with subtle pale edge highlights. Functional vanilla plate armor, no glowing emblem, cape or decorative spikes.", + "source": "output/imagegen/retold-equipment-and-bosses/sources/steel_chestplate.png", + "author": "OpenAI image generation, directed and processed by Codex under Xefensor direction", + "status": "Original generated development art; final in-game visual approval pending" + }, + { + "name": "steel_leggings", + "prompt": "Create one completely original Minecraft-compatible inventory item sprite for Retold. EXACT16x16 logical pixels enlarged as crisp pixel art, each logical pixel one flat uniform square. Classic vanilla proportions and readability, restrained 6-10 color palette, hard pixel edges, no blur, antialiasing, gradients, PBR/render sheen, huge mosaic shapes, bloom, neon, writing or copied Minecraft texture pixels. Genuine transparent background, 1 logical pixel breathing room. Steel palette: moderately dark cool silver/blue-grey (#687681 shadows, #8d9ca5 midtone, #bcc9cf restrained highlights, #394953 outline), distinctly darker than ordinary iron but unmistakably steel. Timber handles: muted brown (#684b32 and #98724a), no purple/Aender wood. Minimal neutral dark bindings.\nPlain steel armor leggings inventory sprite: short squared waist/belt connecting two clearly separated plate-covered legs. Cool dark silver metal with subtle light edges, unmistakable pants/greaves silhouette, no boots or cloth cape.", + "source": "output/imagegen/retold-equipment-and-bosses/sources/steel_leggings.png", + "author": "OpenAI image generation, directed and processed by Codex under Xefensor direction", + "status": "Original generated development art; final in-game visual approval pending" + }, + { + "name": "steel_boots", + "prompt": "Create one completely original Minecraft-compatible inventory item sprite for Retold. EXACT16x16 logical pixels enlarged as crisp pixel art, each logical pixel one flat uniform square. Classic vanilla proportions and readability, restrained 6-10 color palette, hard pixel edges, no blur, antialiasing, gradients, PBR/render sheen, huge mosaic shapes, bloom, neon, writing or copied Minecraft texture pixels. Genuine transparent background, 1 logical pixel breathing room. Steel palette: moderately dark cool silver/blue-grey (#687681 shadows, #8d9ca5 midtone, #bcc9cf restrained highlights, #394953 outline), distinctly darker than ordinary iron but unmistakably steel. Timber handles: muted brown (#684b32 and #98724a), no purple/Aender wood. Minimal neutral dark bindings.\nA pair of plain steel armor boots inventory sprite: two separated squared short boots with simple toe and shin plates. Cool dark silver with subtle pale edges; functional vanilla boots, no glowing trim or spikes.", + "source": "output/imagegen/retold-equipment-and-bosses/sources/steel_boots.png", + "author": "OpenAI image generation, directed and processed by Codex under Xefensor direction", + "status": "Original generated development art; final in-game visual approval pending" + }, + { + "name": "steel_spear", + "prompt": "Create one completely original Minecraft-compatible inventory item sprite for Retold. EXACT16x16 logical pixels enlarged as crisp pixel art, each logical pixel one flat uniform square. Classic vanilla proportions and readability, restrained 6-10 color palette, hard pixel edges, no blur, antialiasing, gradients, PBR/render sheen, huge mosaic shapes, bloom, neon, writing or copied Minecraft texture pixels. Genuine transparent background, 1 logical pixel breathing room. Steel palette: moderately dark cool silver/blue-grey (#687681 shadows, #8d9ca5 midtone, #bcc9cf restrained highlights, #394953 outline), distinctly darker than ordinary iron but unmistakably steel. Timber handles: muted brown (#684b32 and #98724a), no purple/Aender wood. Minimal neutral dark bindings.\nA straight slender spear inventory sprite diagonally from lower-left butt to upper-right tip, long muted brown wooden shaft, dark binding, compact narrow leaf-shaped steel spearhead. No trident or lance guard. Classic vanilla item readability.", + "source": "output/imagegen/retold-equipment-and-bosses/sources/steel_spear.png", + "author": "OpenAI image generation, directed and processed by Codex under Xefensor direction", + "status": "Original generated development art; final in-game visual approval pending" + }, + { + "name": "flint_multi_tool", + "prompt": "Create one completely original Minecraft-compatible inventory item sprite for Retold. EXACT16x16 logical pixels enlarged as crisp pixel art, each logical pixel one flat uniform square. Classic vanilla proportions and readability, restrained 6-10 color palette, hard pixel edges, no blur, antialiasing, gradients, PBR/render sheen, huge mosaic shapes, bloom, neon, writing or copied Minecraft texture pixels. Genuine transparent background, 1 logical pixel breathing room. Steel palette: moderately dark cool silver/blue-grey (#687681 shadows, #8d9ca5 midtone, #bcc9cf restrained highlights, #394953 outline), distinctly darker than ordinary iron but unmistakably steel. Timber handles: muted brown (#684b32 and #98724a), no purple/Aender wood. Minimal neutral dark bindings.\nPrimitive original flint multi-tool. A single compact CHUNKY almond-like knapped handstone with an asymmetrical point, thicker grip end, notched shoulder and light flake edges. Shape occupies about10 logicalpixels wide and12logicalpixels tall. Dark grey natural flint #555b61/#80868b/#b3b8bb, 5colors max. A useful sturdy palm-sized cutting/scraping stone, not a long thin knife blade or ordinary narrow flint drop. NO HANDLE, wood, bindings, metal or magic.", + "source": "output/imagegen/retold-equipment-and-bosses/sources/flint_multi_tool.png", + "superseded_prompt": "Create one completely original Minecraft-compatible inventory item sprite for Retold. EXACT16x16 logical pixels enlarged as crisp pixel art, each logical pixel one flat uniform square. Classic vanilla proportions and readability, restrained 6-10 color palette, hard pixel edges, no blur, antialiasing, gradients, PBR/render sheen, huge mosaic shapes, bloom, neon, writing or copied Minecraft texture pixels. Genuine transparent background, 1 logical pixel breathing room. Steel palette: moderately dark cool silver/blue-grey (#687681 shadows, #8d9ca5 midtone, #bcc9cf restrained highlights, #394953 outline), distinctly darker than ordinary iron but unmistakably steel. Timber handles: muted brown (#684b32 and #98724a), no purple/Aender wood. Minimal neutral dark bindings.\nPrimitive shaped flint multi-tool: a hand-sized asymmetrical knapped flint blade with a sturdy thicker grip end, flaked sharp cutting edges and a blunt notched shoulder. Dark natural stone-grey (#555b61, #80868b, #b3b8bb), no handle, wood, metal, leather wrapping or magic. It is a shaped piece of flint, visibly more deliberate than an ordinary raw flint drop.", + "author": "OpenAI image generation, directed and processed by Codex under Xefensor direction", + "status": "Original generated development art; final in-game visual approval pending" + }, + { + "name": "flint_spear", + "prompt": "Create one completely original Minecraft-compatible inventory item sprite for Retold. EXACT16x16 logical pixels enlarged as crisp pixel art, each logical pixel one flat uniform square. Classic vanilla proportions and readability, restrained 6-10 color palette, hard pixel edges, no blur, antialiasing, gradients, PBR/render sheen, huge mosaic shapes, bloom, neon, writing or copied Minecraft texture pixels. Genuine transparent background, 1 logical pixel breathing room. Steel palette: moderately dark cool silver/blue-grey (#687681 shadows, #8d9ca5 midtone, #bcc9cf restrained highlights, #394953 outline), distinctly darker than ordinary iron but unmistakably steel. Timber handles: muted brown (#684b32 and #98724a), no purple/Aender wood. Minimal neutral dark bindings.\nA primitive slender spear inventory sprite diagonally from lower-left butt to upper-right tip. Long muted brown wooden shaft, dark simple binding and small dark-grey knapped flint spearhead with a few pale flake edges. No metal, trident or oversized blade.", + "source": "output/imagegen/retold-equipment-and-bosses/sources/flint_spear.png", + "author": "OpenAI image generation, directed and processed by Codex under Xefensor direction", + "status": "Original generated development art; final in-game visual approval pending" + }, + { + "name": "steel_plate", + "prompt": "ONE original Minecraft armor metal UV material swatch. EXACT16x16 logical flat pixels enlarged to1024 square as large uniform crisp pixel squares, opaque toall edges. The entire swatch is mostly ONE near-uniform muted cool steel color #8d9ca5. 90 percent pixels same flat midtone. At most five tiny isolated2pixel wear marks #7e8c95 and three quiet1pixel highlights #a3b1b9. Extremely quiet smooth metal like vanilla mundane armor, NOT stone, NOT camouflage, NOT granular texture, NO borders, seams, grid, plate tiles, diamonds, noise, random mottling, shiny glossy realism, gradients, illustration or pixel artwork copied from Minecraft. The overall swatch should read almost flat calm steel with barelyvisible wear.", + "source": "output/imagegen/retold-equipment-and-bosses/sources/steel_plate.png", + "superseded_prompt": "Create one completely original seamless 16x16 logical-pixel Minecraft steel armor plate material tile, enlarged as crisp nearest-neighbor pixel art. Opaque square edge to edge. Restrained cool darker silver palette #687681 shadows #8d9ca5 mid #bcc9cf highlight #394953 darkest, six colors maximum. Mostly quiet flat blue-grey metal, subtly mottled metal pixels grouped in small clusters, tiny restrained wear marks; no decorative grid, studs, seams, icons, text, cracks, noise, glowing effects or glossy gradients. This tile supplies original metal pixels for plain vanilla-style armor UV regions. Do not copy Minecraft assets.", + "author": "OpenAI image generation, directed and processed by Codex under Xefensor direction", + "status": "Original generated development art; final in-game visual approval pending" + }, + { + "name": "earth_stone", + "prompt": "Original vanilla Minecraft ancient stone statue material, EXACT16x16 logical pixels enlarged crisp opaque square tile, seamless edge to edge. Very restrained contrast: MOST pixels muted warm neutral stonegrey #7c8071, calm clustered patches #777b6d and #858979, about10tiny darker worn speckles #687164, at most5 olive moss pixels #53664a. Overall95 percent calm carved grey stone, not moss camouflage. No repetitive checkerboard, highcontrast randomnoise, blockgrout, eyes, outlines, symbols, gradients, blur, neon, copied Minecraft pixels. This covers large statue surfaces: quiet vanilla stone lets its original carved face and geometric joints remain readable.", + "source": "output/imagegen/retold-equipment-and-bosses/sources/earth_stone.png", + "superseded_prompt": "Create one completely original seamless 16x16 logical-pixel Minecraft ancient jungle stone construct material tile, enlarged as crisp pixel art. Opaque edge-to-edge square, classic vanilla scale and restrained contrast. Warm grey weathered carved stone #7c8071 mid #545e55 shadows #a4a78d highlights, a few muted moss olive pixels #53664a tucked along sparse worn crevices. Mostly stone, at most 10 percent moss. Uneven small pixel clusters, stone carving material not cobblestone blocks, no visible square block grout grid, no face, symbols, eyes, vines hanging off, magical light, blur, gradients or Minecraft copied pixels.", + "author": "OpenAI image generation, directed and processed by Codex under Xefensor direction", + "status": "Original generated development art; final in-game visual approval pending" + }, + { + "name": "earth_face", + "prompt": "Create one original 8x8 logical pixel face panel for an ancient blind Minecraft jungle stone statue, enlarged crisp square pixel art. Opaque square, weathered muted warm grey stone #7c8071 with #545e55 shadow carvings and #a4a78d tiny edge highlights. Strong quiet symmetrical carved brow, closed blind horizontal stone eye slits (no pupils), small broad squared nose ridge, solemn small mouth notch. Eyes remain dark dead stone, NO glowing eyes, green emeralds, skull teeth, smile, iron golem nose, outlines or decorative border. Six flat palette colors, no gradients or antialias. Readable at 8x8, original rather than copied.", + "source": "output/imagegen/retold-equipment-and-bosses/sources/earth_face.png", + "author": "OpenAI image generation, directed and processed by Codex under Xefensor direction", + "status": "Original generated development art; final in-game visual approval pending" + }, + { + "name": "gale_stone", + "prompt": "Original vanilla Minecraft floating mineral core stone material, EXACT16x16 logical pixels enlarged crisp opaque square tile, seamless edge to edge. Quiet calm blue-grey slate: MOST pixels #627785, subtle grouped patches #5b707d and #6c818e, two sparse very short pale desaturated cyan mineral veins #9bb4b7 (less than12 pixels total), at most6 dark wear pixels #506774. Restrainedcontrast vanilla rock texture, no dense mosaic, checkerboard, random noise, camouflage, decorative pattern, glow, face, symbols, gradients, blur or copied Minecraft artwork. Calm stone surfaces with a few readable mineral marks, not metal.", + "source": "output/imagegen/retold-equipment-and-bosses/sources/gale_stone.png", + "superseded_prompt": "Create one completely original seamless 16x16 logical-pixel Minecraft floating wind mineral core stone material tile, enlarged crisp pixel art. Opaque square to edges. Quiet grey-blue slate #627785 shadows #425865, #94aab4 highlights, subtle restrained carved stone facets and a few pale desaturated cyan mineral veins #a7c4c5. Vanilla restrained contrast, flat 6 color pixel clusters, no glow, neon, purple Aender stone, ornate pattern, circular eye, text or copied Minecraft assets. Not metal.", + "author": "OpenAI image generation, directed and processed by Codex under Xefensor direction", + "status": "superseded by gale_core_breeze_prompts_2026-10-12.json; vanilla Breeze materials now referenced at runtime" + }, + { + "name": "gale_wind", + "prompt": "Create one original seamless16x16 logical-pixel Minecraft wind material tile, enlarged crisp pixel art. TRUE transparent background, no solid backing color. Sparse horizontal long broken pixel wisps in pale desaturated grey-blue #aac1c9 and pale cyan-white #d4e1e3, aroundhalf of thetile istransparent emptyair. Flat pixel streaks1pixel thick with occasional2pixel breaks and offset shorter1pixel highlights. Wisps shouldrunhorizontally to wraparound thin cubic windbands, andmeet left/rightedges naturally. No face, icons, greyboard, whitebackground, gradient, clouds puffillustration, glow, noise or copiedMinecraft pixels. Restrained vanilla breeze-like airy readability using completely original pixels. Exact16x16logicalgrid with largecrispuniformpixel squares.", + "source": "output/imagegen/retold-equipment-and-bosses/sources/gale_wind.png", + "superseded_prompt": "Create one completely original seamless 16x16 logical-pixel Minecraft wind-band material tile, enlarged crisp pixel art. Opaque square to edges. Soft desaturated pale grey-blue #aac1c9 mid #d4e1e3 highlights #829faa shadow. Three gentle long broken horizontal directional streaks and tiny wisps in a restrained flat 5 color palette, classic vanilla pixel scale. No gradient, glow, alpha, lightning, noise, drawn icons or copied Minecraft pixels. This tile wraps narrow cubic wind bands on an original stone elemental.", + "author": "OpenAI image generation, directed and processed by Codex under Xefensor direction", + "status": "superseded by gale_core_breeze_prompts_2026-10-12.json; vanilla Breeze materials now referenced at runtime" + }, + { + "name": "nether_reactor_core", + "prompt": "Create one completely original 16x16 logical-pixel Minecraft inventory item sprite, enlarged crisp pixel art, transparent background. A small oblique cubic Nether Reactor Core inspired only conceptually by early Pocket Edition: dark charcoal frame, muted gold corner brackets #b69b48 and deep muted blue face panels #4c6b91 with a small pale blue central recess. Three clear visible cube planes, chunky compact simple vanilla pixels, seven flat colors maximum, 1px transparent margin. Original geometry and artwork, do not copy or reproduce any legacy texture, no red fire, glow, bevel gradients, text or wide outline.", + "source": "output/imagegen/retold-equipment-and-bosses/sources/nether_reactor_core.png", + "author": "OpenAI image generation, directed and processed by Codex under Xefensor direction", + "status": "Original generated development art; final in-game visual approval pending" + }, + { + "name": "earth_guardian_spawn_egg", + "prompt": "Create one completely original Minecraft spawn egg inventory sprite, EXACT16x16 logical pixels enlarged crisp pixel art, genuine transparent background. Compact conventional rounded stepped egg silhouette about10pixels wide and14pixels high, 1px transparent margin. Flat restrained6-8color palette, small irregular original shell flecks, no antialias, gradient, blur, eyes, face, letters, elaborate symbols, glow or copied vanilla egg pattern. Classic vanilla readability. Weathered warm stone-grey shell #7c8071/#a4a78d, darker olive moss flecks #53664a/#3d5140 to match an ancient blind jungle stone Guardian.", + "source": "output/imagegen/retold-equipment-and-bosses/sources/earth_guardian_spawn_egg.png", + "author": "OpenAI image generation, directed and processed by Codex under Xefensor direction", + "status": "Original generated development art; final in-game visual approval pending" + }, + { + "name": "gale_core_spawn_egg", + "prompt": "Create one completely original Minecraft spawn egg inventory sprite, EXACT16x16 logical pixels enlarged crisp pixel art, genuine transparent background. Compact conventional rounded stepped egg silhouette about10pixels wide and14pixels high, 1px transparent margin. Flat restrained6-8color palette, small irregular original shell flecks, no antialias, gradient, blur, eyes, face, letters, elaborate symbols, glow or copied vanilla egg pattern. Classic vanilla readability. Desaturated grey-blue mineral shell #627785/#94aab4, pale airy cyan-white flecks #aac1c9/#d4e1e3 to match a floating mineral Gale Core with pale wind bands.", + "source": "output/imagegen/retold-equipment-and-bosses/sources/gale_core_spawn_egg.png", + "author": "OpenAI image generation, directed and processed by Codex under Xefensor direction", + "status": "superseded by gale_core_breeze_prompts_2026-10-12.json; vanilla Breeze materials now referenced at runtime" + }, + { + "name": "steel_spear_in_hand", + "prompt": "Create one completely original Minecraft-compatible inventory item sprite for Retold. EXACT32x32 logical pixels enlarged as crisp pixel art, each logical pixel one flat uniform square. Classic vanilla proportions and readability, restrained 6-10 color palette, hard pixel edges, no blur, antialiasing, gradients, PBR/render sheen, huge mosaic shapes, bloom, neon, writing or copied Minecraft texture pixels. Genuine transparent background, 1 logical pixel breathing room. Steel palette: moderately dark cool silver/blue-grey (#687681 shadows, #8d9ca5 midtone, #bcc9cf restrained highlights, #394953 outline), distinctly darker than ordinary iron but unmistakably steel. Timber handles: muted brown (#684b32 and #98724a), no purple/Aender wood. Minimal neutral dark bindings.\nDedicated held spear sprite, EXACT32x32 logical pixels. One long straight shaft diagonallyfromlower-lefttoupper-right, about30logicalpixels long, shaftONEpixelthick excepttiny2pixel gripbinding, mutedbrownwood #684b32/#98724a. Compact leaf-shaped coolbluegrey steelhead4pixelslongand2-3pixelswide nearupperright, smallpale cutting edge #bcc9cf, darkbinding. Leave1pixel transparentmargin. Sameplain steel material as vanilla-scale inventory equipment, no decorations, lanceguard, trident or oversizedhead. Shape mustread thin full-length spear when held.", + "source": "output/imagegen/retold-equipment-and-bosses/sources/steel_spear_in_hand.png", + "author": "OpenAI image generation, directed and processed by Codex under Xefensor direction", + "status": "Original generated development art; final in-game visual approval pending" + }, + { + "name": "flint_spear_in_hand", + "prompt": "Create one completely original Minecraft-compatible inventory item sprite for Retold. EXACT32x32 logical pixels enlarged as crisp pixel art, each logical pixel one flat uniform square. Classic vanilla proportions and readability, restrained 6-10 color palette, hard pixel edges, no blur, antialiasing, gradients, PBR/render sheen, huge mosaic shapes, bloom, neon, writing or copied Minecraft texture pixels. Genuine transparent background, 1 logical pixel breathing room. Steel palette: moderately dark cool silver/blue-grey (#687681 shadows, #8d9ca5 midtone, #bcc9cf restrained highlights, #394953 outline), distinctly darker than ordinary iron but unmistakably steel. Timber handles: muted brown (#684b32 and #98724a), no purple/Aender wood. Minimal neutral dark bindings.\nDedicated held primitive spear sprite, EXACT32x32 logical pixels. One long straight shaftdiagonallyfromlower-lefttoupper-right, about30logicalpixelslong, shaftONEpixelthickexcepttiny2pixelbinding, mutedbrownwood #684b32/#98724a. Compact knappedflint spearhead4pixelslong2-3pixelswide nearupperright, darknaturalgrey #555b61/#80868b withtinypale flakeedge #b3b8bb, darksimplebinding. Leave1pixel transparentmargin. NOmetal, trident, guard or magic. Shape mustreadthin full-length primitive spear when held.", + "source": "output/imagegen/retold-equipment-and-bosses/sources/flint_spear_in_hand.png", + "author": "OpenAI image generation, directed and processed by Codex under Xefensor direction", + "status": "Original generated development art; final in-game visual approval pending" + } + ], + "active_revision_reference": "retold_asset_revision_2026-10-23.json", + "superseded_assets": [ + { + "name": "aender_eye", + "prompt": "Create one completely original 16x16 logical-pixel Minecraft floating magical eye sprite, enlarged crisp pixel art, transparent background. Compact horizontally oval pale stone-grey eye rim, muted green jade iris #5b9666 and deep dark vertical pupil #1f3734, tiny pale mint highlight. Familiar simple Minecraft scale and restrained contrast, original pixel arrangement, no copy of Eye of Ender pixels, no surrounding fire, wings, eyelash, excessive glow, neon, blue or purple takeover. Preserve green-eye concept, 1px transparent margin. Crisp flat 6-8 color pixels, no blur or antialias.", + "source": "output/imagegen/retold-equipment-and-bosses/sources/aender_eye.png", + "author": "OpenAI image generation, directed and processed by Codex under Xefensor direction", + "status": "Historical generated development art; superseded on 2026-10-23 at developer direction by direct reuse of the installed vanilla Eye of Ender texture as an emissive billboard. No custom Eye texture is packaged." + } + ] +} diff --git a/docs/internal/retold_asset_revision_2026-10-23.json b/docs/internal/retold_asset_revision_2026-10-23.json new file mode 100644 index 00000000..9b8ae998 --- /dev/null +++ b/docs/internal/retold_asset_revision_2026-10-23.json @@ -0,0 +1,291 @@ +{ + "date": "2026-10-23", + "generator": "Built-in image_gen tool", + "authorization": "Developer requested redoing and improving the uncommitted asset/rendering pass.", + "author": "OpenAI image generation, directed and mechanically packed by Codex under Xefensor direction", + "license": "LICENSE-ASSETS.md", + "status": "Original generated development artwork; final subjective in-game approval pending.", + "processing": "Nearest-neighbor reduction to native pixel dimensions; binary alpha for sprites/leaves and exact retained Steel coverage masks. Steel and Guardian use newly generated material-panel sheets, limited palettes and distinct per-face crops mechanically packed into unchanged UVs. Gale front/back plate artwork is revised while the previous restrained rim stays. No Minecraft texture pixels are copied.", + "local_working_artifacts": "output/imagegen/revision-2026-10-23 and output/imagegen/polish-2026-10-23 are ignored, preserved locally, absent from a clean checkout, and unused by the build and tests.", + "packing_helper": "output/imagegen/revision-2026-10-23/pack-art.py (initial pass); active Steel and Guardian overrides use the per-source packing_helper paths below.", + "sources": [ + { + "name": "flint", + "prompt": "Use case: precise-object-edit. Asset type: Retold Minecraft inventory item sprite, native 16x16 pixels. Edit target is the attached local flint_multi_tool.png; improve its silhouette. Replace the thin knife-like sliver with a sturdy palm-sized knapped flint handstone. Compact asymmetrical almond/wedge shape, 9 to 10 logical pixels wide and 12 logical pixels tall, thicker blunt lower grip, tapered upper point, a few deliberate angular flake scars and a readable cutting edge. No handle, binding, wood, metal, pupils, ornament or glow. Use a restrained six-color natural charcoal/neutral grey palette with a warm dark outline, medium grey faces, only a few pale edge pixels. Exactly 16x16 logical pixel art, displayed enlarged as sharp uniform pixel squares, transparent background, one logical pixel clear margin. Center the handstone; its shape should occupy most of the available width, have a clear useful grip, and remain readable at native size. No antialiasing, gradients, blur, text, grid lines, photorealism or copied vanilla artwork.", + "source": "output/imagegen/revision-2026-10-23/sources/flint.png", + "outputs": [ + "src/main/resources/assets/retold/textures/item/flint_multi_tool.png" + ], + "packaged_outputs": [ + { + "path": "src/main/resources/assets/retold/textures/item/flint_multi_tool.png", + "size": [ + 16, + 16 + ], + "sha256": "c3978aee594e968abc4c2ad430886f53ceb1cdbc29aca0c9d811427bf6ed75c2" + } + ] + }, + { + "date": "2026-10-23", + "generator": "Built-in image_gen tool", + "author": "OpenAI image generation, directed and mechanically packed by Codex under Xefensor direction", + "status": "Original generated development artwork; final subjective in-game approval pending.", + "name": "steel_material_polish", + "prompt": "Use case: precise-object-edit.\nAsset type: one flat material-panel sheet for the existing original Retold STEEL ARMOR game texture. The first supplied image is the CURRENT UV texture reference, and the second is its current OFFLINE EQUIPMENT RENDER for material/design reference only. Improve the same cool silver steel set, preserving its simple unornamented Minecraft-compatible plate armor identity and a tone darker/cooler than iron.\n\nOutput ONE WIDE RECTANGULAR PANEL SHEET, a crisp hard-edged 4-COLUMN by 2-ROW arrangement of eight equal SQUARE panels, edge to edge, NO gutters, labels, lines or margins. Canvas has 64 x 32 logical square pixels, displayed enlarged. Every panel is 16 x 16 logical pixels. This is raw material artwork to crop and mechanically pack into existing armor UVs, NOT a humanoid illustration, NOT an unfolded UV atlas.\n\nTop row left to right:\n1. Helmet front material: narrow pale steel brow, darker cheek walls, calm midtone; recognizable broad brow and two cheeks. The actual face opening is preserved later by the original alpha mask. Keep the useful front design in the central 8x8 pixels.\n2. Helmet BACK material: closed, calm steel with a quiet dark lower neck guard and two pale corner edges; absolutely NO visor, face opening, eyes or front-face details.\n3. Chest FRONT: a clear simple collar at upper edge, broad calm blue-grey breastplate, restrained pale edge at shoulders, darker lower hem. Design occupies central 8 pixels wide by 12 tall.\n4. Chest BACK: a simple broad calm back plate, different from the front: no collar opening, no V neck, no breastplate motif; just narrow shoulder edge and restrained dark lower hem. Design occupies central 8x12.\n\nBottom row left to right:\n5. ARM: one narrow vertical bracer panel, central 4x12 logical pixels: lighter shoulder cap at top, quiet middle, subtle dark wrist seam at bottom; no breastplate details.\n6. LEGGING: narrow vertical solid greave panel central 4x12: one quiet knee edge, calm shin, darker lower ankle; do not put wrist/collar details here.\n7. BOOT: narrow vertical steel boot panel central 4x12: restrained toe cap and darkest sole occupying its lower quarter; upper area calm steel.\n8. PLAIN STEEL: quiet 16x16 material swatch for sides and tops, almost flat cool grey-blue with just a few 2-3 pixel broad stepped metal tones, no panel borders or ornaments.\n\nColor palette: ONLY these seven flat colors or extremely close shades: deepest blue grey #394957, shadow #526374, mid shadow #6a7d8d, base steel #8296a6, light steel #9aabba, edge #b5c4ce, brightest edge #d7e0e5. Keep broad calm shapes. Deliberate sparse pixel clusters. The lightest color is a one-pixel edge accent, not a large white patch. No colored cyan/blue diagnostic pixels. All eight panels use the SAME coherent material.\n\nConstraints: original artwork only, opaque sheet. No random speckling, mottling, microtexture, gradients, bloom, PBR, gloss, gold, rivet spam, insignia, rust or fancy fantasy detailing. No text, numbers, letters, grid, labels, perspective, model render, character, skin or transparent holes. Crisp Minecraft-scale pixel art, flat hard uniformly square logical pixels, NO antialiasing. The final artist intent is cleaner planes and distinct FRONT/BACK surfaces, not additional complexity.", + "source": "output/imagegen/polish-2026-10-23/steel/steel-panels-source.png", + "source_original": "/home/xela/.codex/generated_images/01a1696f-16c7-7170-b9f8-c77c64668e81/exec-bd46c1c2-f5d9-4308-8f6f-263c6243de7d.png", + "source_sha256": "55ec83795fa1df437d78343239125058f46ab36cb40ee8065063f8d532159c9a", + "packing_helper": "output/imagegen/polish-2026-10-23/steel/pack-steel.py", + "processing": [ + "Point reduction of generated eight-panel artwork to a 64x32 sheet.", + "ImageMagick +dither -remap to the seven exact steel palette colors: #394957, #526374, #6a7d8d, #8296a6, #9aabba, #b5c4ce, #d7e0e5.", + "Crop generated material panels, resample with point filtering and pack individual front/back/side/top faces into the unchanged adult and 26.2 baby equipment UVs.", + "Keep chest front/back and helmet front/back distinct; separate generated bracer, greave and boot materials.", + "Apply exact pre-polish alpha channel from archived existing PNGs using CopyOpacity. No Minecraft pixels, new art drawing, geometry, stats or gameplay changes." + ], + "outputs": [ + "src/main/resources/assets/retold/textures/entity/equipment/humanoid/steel.png", + "src/main/resources/assets/retold/textures/entity/equipment/humanoid_leggings/steel.png", + "src/main/resources/assets/retold/textures/entity/equipment/humanoid_baby/steel.png" + ], + "packaged_outputs": [ + { + "path": "src/main/resources/assets/retold/textures/entity/equipment/humanoid/steel.png", + "size": [ + 64, + 32 + ], + "sha256": "24e6f84c7fcc6f7a512c1b5c5da5f8d95d72b06ec57058201f77bd64f8c248ee" + }, + { + "path": "src/main/resources/assets/retold/textures/entity/equipment/humanoid_leggings/steel.png", + "size": [ + 64, + 32 + ], + "sha256": "e6f7ea606f0008a5d3cc924a1b2be2d356cbee568b173498ec2ee4b35ed409c3" + }, + { + "path": "src/main/resources/assets/retold/textures/entity/equipment/humanoid_baby/steel.png", + "size": [ + 64, + 64 + ], + "sha256": "9745fb2d02f089e794aa13d464557f1a5d2f03f90ff5cbfbdf91bcf758d96349" + } + ], + "supersedes": "steel_atlas", + "validation": { + "alpha_identical_to_previous_outputs": true, + "opaque_palette_colors": { + "src/main/resources/assets/retold/textures/entity/equipment/humanoid/steel.png": 7, + "src/main/resources/assets/retold/textures/entity/equipment/humanoid_leggings/steel.png": 5, + "src/main/resources/assets/retold/textures/entity/equipment/humanoid_baby/steel.png": 7 + }, + "adult_chest_front_differs_from_back": true, + "in_game_review": false + } + }, + { + "date": "2026-10-23", + "generator": "Built-in image_gen tool", + "author": "OpenAI image generation, directed and mechanically packed by Codex under Xefensor direction", + "status": "Original generated development artwork; final subjective in-game approval pending.", + "name": "guardian_material_polish", + "prompt": "Use case: precise-object-edit. Reference image is the existing flat Retold Earth Guardian atlas, used only for established warm grey stone, sparse muted olive moss, closed blind face and ancient carved-statue character. Rebuild its artwork as ONE MATERIAL PANEL SHEET for this single guardian asset, NOT a finished UV map and NOT a character illustration. Exact 64x32 logical pixel canvas enlarged to a crisp 2:1 sheet. Four equal edge-to-edge vertical columns, each exactly16 logical pixels wide and32 high, no gutters, labels or outlines between them. COLUMN1, x0..15: upper16x16 is a square, flat, front-facing ancient carved stone face: heavy quiet brow, TWO CLOSED DARK HORIZONTAL SLITS with no eyeballs/pupils/glow, short broad squared nose, small recessed mouth, plain blocky cheek planes; the lower16x16 is quiet undecorated stone material. COLUMN2, x16..31: a tall monolithic chest surface, calm central12pixel-wide carved stone plane, slightly darker narrow side planes, a short shallow fracture low near one corner, a hint of moss at lower edge, NO breastplate rim, face, symbols or brickwork. COLUMN3, x32..47: solid tall rectangular stone limb panel, mostly uninterrupted warm grey plane, one restrained stepped fracture near the bottom quarter and sparse dark olive moss near that fracture, subtle top and bottom worn edges; no dense joint bands or outlines. COLUMN4, x48..63: plain reusable seamless stone surface, large calm midgrey areas with only a few connected 2-3pixel darker chips and one small olive moss cluster, NO diagonal camouflage. ALL ART must use the SAME tightly controlled seven flat shades: deepest crevice #3e443b, dark stone #62665b, mid stone #7e8173, light stone #999b89, edge #b1b09b, dark moss #555d3c, moss #70764e. Broad connected pixel clusters and quiet surfaces. No gradients, anti-aliasing, microtexture, random per-pixel noise, realistic stone photograph, perspective, lighting vignette, grid, text, icon, armor, iron-golem nose or copied Minecraft pixels. Entire sheet is opaque, every logical pixel is a hard uniform square. Preserve the old blind jungle-statue identity while making its carved planes readable.", + "reference": "src/main/resources/assets/retold/textures/entity/earth_guardian.png", + "source": "output/imagegen/polish-2026-10-23/guardian/source.png", + "source_original": "/home/xela/.codex/generated_images/01a1692a-3649-7b40-84a4-61fc76ab1c97/exec-9bf0351c-ae4f-4dbe-80aa-6f1e4b21286c.png", + "source_sha256": "5c21cdc6114bf6afd2834cfff4fb3271dc6c38f142c186704f78ac6c5147c7f1", + "packing_helper": "output/imagegen/polish-2026-10-23/guardian/pack.py", + "processing": "Nearest-neighbor 64x32 panel reduction, no-dither explicit seven-color remap, mechanical per-face crops/resizes into unchanged 128x64 model UVs. Front, back, sides and top use distinct generated material regions. Opaque atlas. No Minecraft pixels copied.", + "palette": [ + "#3e443b", + "#62665b", + "#797a69", + "#999b89", + "#b1b09b", + "#4b5732", + "#626d3e" + ], + "outputs": [ + "src/main/resources/assets/retold/textures/entity/earth_guardian.png" + ], + "packaged_outputs": [ + { + "path": "src/main/resources/assets/retold/textures/entity/earth_guardian.png", + "size": [ + 128, + 64 + ], + "sha256": "5a859d61ffd75ea022661defc8970a9c449ac8f8d8bbe127049ee28644616b11" + } + ], + "supersedes": "guardian_atlas", + "validation": { + "opaque_palette_colors": 6, + "allowed_palette_colors": 7, + "mesh_unchanged": true, + "in_game_review": false + } + }, + { + "name": "gale_plate", + "prompt": "Use case: stylized-concept. Asset type: one front material tile for Retold Gale Core's thin floating armor plate. The supplied atlas is only a palette reference, not the output layout. Generate ONE simple rectangle 5 logical pixels wide by8 logical pixels high, displayed enlarged with perfectly hard square pixels, edge to edge, no margin. Cool pale lavender silver outer rim exactly1 pixel thick on left/right/bottom, slightly lighter narrow upper edge, deeper muted purple-grey recessed center3pixels wide, calm broad flat interior with only one short restrained wear mark. Palette matches a purple Breeze: pale #b9bac9, mid#8c8ba8, inset#686987, deepest#525672; original restrained Minecraft scale. It is thin ceremonial armor, NOT face, gem, shield with crest, metal photograph or ornate decoration. No glow, gold, symbols, text, grid, gradation, shadow outside rectangle or copied game pixels. A single coherent flat UV plate tile, not a 3D object.", + "source": "output/imagegen/revision-2026-10-23/sources/gale_plate.png", + "outputs": [ + "src/main/resources/assets/retold/textures/entity/gale_core.png" + ], + "packaged_outputs": [ + { + "path": "src/main/resources/assets/retold/textures/entity/gale_core.png", + "size": [ + 32, + 32 + ], + "sha256": "4182d7e819609fdd9de4c5991fdf22d451a44279beb3ad3929bbb764a44e8842" + } + ] + }, + { + "name": "aender_grass", + "prompt": "Use case: stylized-concept. Asset type: ONE original seamless Minecraft terrain texture, flat top surface of Retold Aender purple grass. Exactly16x16 logical pixels enlarged as perfectly crisp uniform squares, square opaque image filling all edges; no border. Restrained inverted-world palette: dusty medium purple #80558e, low #704d7f, occasional #91649d highlights, deepest#63466f. Natural small connected 2-3pixel foliage clusters and short bent 2pixel grass blades distributed irregularly, calm broad midtone coverage, restrained contrast, no single-pixel random salt-and-pepper noise. Seamless on all edges, equal detail at edges and center, no larger motif or tile border. The surface reads as fine purple living grass at vanilla pixel scale, not stone, woven fabric, bricks, moss camouflage or a noisy checkerboard. No perspective, sky, text, grid, gradients, gloss, lighting baked into tile, bloom or copied game pixels. Original development art for a Minecraft mod.", + "source": "output/imagegen/revision-2026-10-23/sources/aender_grass.png", + "outputs": [ + "src/main/resources/assets/retold/textures/block/aender_grass_block_top.png" + ], + "packaged_outputs": [ + { + "path": "src/main/resources/assets/retold/textures/block/aender_grass_block_top.png", + "size": [ + 16, + 16 + ], + "sha256": "7b4e44061a9fad711b0b229a4f268e9f819453eafc9804dc772d206ba50c97a0" + } + ] + }, + { + "name": "aender_leaves", + "prompt": "Use case: stylized-concept. Asset type: ONE original seamless cutout Minecraft leaf block texture for Retold Aender trees. Exactly16x16 logical pixels enlarged as hard uniform square pixels. Purple leaves only: middle dusty violet #775183, light#956aa0, shadow#60446f, a few dark#4c375a. Natural interlocking small 2-4pixel leaf clusters, some angular diagonal leaf edges, about12percent genuinely transparent one/two pixel gaps scattered irregularly, gaps continue across tile edges; avoid a centered isolated bush. Consistent midtone across edges and center so it tiles all ways. Restrained contrast and coherent leaf shapes, no white/lilac confetti, heavy dark outline, veins everywhere or checkerboard. Flat usable terrain texture, no isometric cube, decorative frame, text, grid lines, blur, antialias, gradients, glow or copied Minecraft art. True transparent gaps, no colored backdrop.", + "source": "output/imagegen/revision-2026-10-23/sources/aender_leaves.png", + "outputs": [ + "src/main/resources/assets/retold/textures/block/aender_leaves.png" + ], + "packaged_outputs": [ + { + "path": "src/main/resources/assets/retold/textures/block/aender_leaves.png", + "size": [ + 16, + 16 + ], + "sha256": "14fc363a4925a896cb9edc06de960b1d56f1abb0ea54a3608f08757d3ba1ec6b" + } + ] + }, + { + "name": "reactor", + "prompt": "Use case: stylized-concept. Asset type: ONE original Retold Nether Reactor Core inventory sprite. Exactly16x16 logical pixels enlarged as perfectly crisp uniform pixel squares on genuine transparent background. Compact cubic artifact with three readable planes seen obliquely, about12pixels wide and13pixels tall, clear1pixel margin. Charcoal structural edges, muted brass corner clamps#b29a4f, deep blue face inset#45617f and midblue#7292af, small recessed pale blue square core. Simple heavy manufactured ancient reactor, calm solid panels and clear consistent top-left light, not ornate. Seven flat colors, avoid multicolor noise, circular eye, fire, glow, glass shine, exaggerated perspective, extra prongs, text, grid, antialias or blur. Inspired conceptually by old Pocket Edition reactor only; entirely original geometry and texture arrangement, do not reproduce legacy Minecraft pixels.", + "source": "output/imagegen/revision-2026-10-23/sources/reactor.png", + "outputs": [ + "src/main/resources/assets/retold/textures/item/nether_reactor_core.png" + ], + "packaged_outputs": [ + { + "path": "src/main/resources/assets/retold/textures/item/nether_reactor_core.png", + "size": [ + 16, + 16 + ], + "sha256": "c380a433517856bbd60bf0366d5dc4ad7665df15010da07a9093674d2ce70041" + } + ] + } + ], + "superseded_sources": [ + { + "name": "aender_eye", + "prompt": "Use case: stylized-concept. Asset type: ONE original Retold Aender Eye entity sprite. EXACT16x16 logical pixel game sprite enlarged as hard uniform square pixels on genuine transparent background, 1pixel clear margin all around. Floating compact green magical eye, horizontal oval shape about13pixels wide by9pixels high. A thin pale grey-green stone rim with a few muted grey facets, broad quiet jade iris in medium green#5b9666 and shadow#3f6d50, narrow very dark vertical pupil#203b32, one tiny desaturated mint highlight. Readable as an ancient watchful eye, no lashes, thick silver diamond frame, gem jewelry, wings, blood, neon or excessive glow. Restrained7color original arrangement, no copying Eye of Ender pixels. No text, border, antialias, blur, gradients, large gloss or perspective. Classic Minecraft-size readability and crisp silhouette.", + "source": "output/imagegen/revision-2026-10-23/sources/aender_eye.png", + "status": "Superseded on 2026-10-23 at developer direction: Aender Eye directly reuses the installed vanilla Eye of Ender texture as an emissive billboard. Historical provenance only; no custom Eye texture is packaged.", + "historical_outputs": [ + "src/main/resources/assets/retold/textures/entity/aender_eye.png" + ], + "historical_packaged_outputs": [ + { + "path": "src/main/resources/assets/retold/textures/entity/aender_eye.png", + "size": [ + 16, + 16 + ], + "sha256": "3a62655993819aa329a73b37176c71923f2007c5ca5385defba24dd5167bb44f" + } + ] + }, + { + "name": "steel_atlas", + "prompt": "Use case: precise-object-edit. Edit target: the supplied enlarged 64x32 UV texture atlas for original Minecraft-compatible Steel armor, NOT a character illustration. Output the same flat 2:1 rectangular UV sheet, exactly 64 by 32 logical pixels enlarged with sharp square pixels. Preserve existing canvas proportions and alpha coverage precisely. Improve the almost featureless metal with purposeful vanilla-scale armor craftsmanship: cool dark blue-grey edge shadows, one-pixel pale steel edge highlights, restrained stepped plate seams, a simple collar and breastplate, subtle darker waist band and boot soles. Quiet flat steel broad surfaces, only 5-7 cool steel shades, no random mottling, no rust, no glow, gold, rivet spam or insignia. Keep the material slightly darker than iron. Standard classic humanoid armor UV: head 0..31 x 0..15; torso 16..39 x16..31; right arm40..55 x16..31; leg0..15 x16..31. Front chest is x20..27,y20..31: put a narrow collar at y20, broad calm breastplate beneath, gentle bottom hem y30; front arm x44..47,y20..31 has a subtle shoulder edge and a wrist seam. Head front x8..15,y8..15: define a clean brow ridge and cheek plates around the existing transparent face opening. Never move the UV panels. No labels, text, drawn grid, rendered person, perspective or anti-aliasing. Original texture pixels only. This is a usable game texture sheet, not a presentation.", + "source": "output/imagegen/revision-2026-10-23/sources/steel_atlas.png", + "status": "Superseded by steel_material_polish on 2026-10-23. Historical exact prompt, source and packaged output hashes retained.", + "superseded_by": "steel_material_polish", + "historical_outputs": [ + "src/main/resources/assets/retold/textures/entity/equipment/humanoid/steel.png", + "src/main/resources/assets/retold/textures/entity/equipment/humanoid_leggings/steel.png", + "src/main/resources/assets/retold/textures/entity/equipment/humanoid_baby/steel.png" + ], + "historical_packaged_outputs": [ + { + "path": "src/main/resources/assets/retold/textures/entity/equipment/humanoid/steel.png", + "size": [ + 64, + 32 + ], + "sha256": "e21fb52eb10315dc2f3fa370e26b2aa52aab1fd946aa6ecdb675a2f1eb0567a3" + }, + { + "path": "src/main/resources/assets/retold/textures/entity/equipment/humanoid_leggings/steel.png", + "size": [ + 64, + 32 + ], + "sha256": "a347c74814c701ea3f4fed29923748a207ea2c7df745c4ec503aaea7d2d00b01" + }, + { + "path": "src/main/resources/assets/retold/textures/entity/equipment/humanoid_baby/steel.png", + "size": [ + 64, + 64 + ], + "sha256": "26ad92ee73eda0f794452b3ed1b309a39195c01ad9c41a032ac6b5ed59d18ec9" + } + ] + }, + { + "name": "guardian_atlas", + "prompt": "Use case: precise-object-edit. Edit target: the supplied flat 128x64 logical-pixel texture atlas for Retold's original ancient blind jungle stone guardian. Output a flat 2:1 rectangular UV atlas with EXACTLY128x64 logical hard square pixels, enlarged. Preserve exact native placement: 8x8 face at x8..15,y8..15, stone body front at x6..17,y22..40, chest raised panel x1..10,y41..46, arm front x46..51,y6..33, shoulder front x72..79,y8..12, fist front x71..77,y23..30, leg front x45..49,y37..52. Improve the featureless camouflage material: calm warm grey carved stone overall, coherent gentle block-plane value changes and sparse short fractures at joints, subtle darker recessed panel borders where those named front regions end, sparse muted olive moss in creases. The face is solemn carved dead stone with a heavy brow, CLOSED dark horizontal blind slits, squared short nose, small recessed mouth; no pupils or luminous eyes, no iron golem nose, no teeth. The torso is a single ancient carved statue rather than cobblestone brick wall or moss camouflage. Each limb reads as solid worn stone, with a simple wrist/ankle edge, a few chips, largely quiet surfaces. 7 restrained grey/olive palette colors; no random per-pixel noise, excessive fine cracks, outlines around atlas panels, grid lines, text, labels, humanoid illustration, perspective, vignette or antialias. Entire canvas remains opaque stone. Original artwork only.", + "source": "output/imagegen/revision-2026-10-23/sources/guardian_atlas.png", + "status": "Superseded by guardian_material_polish on 2026-10-23. Historical exact prompt, source and packaged output hashes retained.", + "superseded_by": "guardian_material_polish", + "historical_outputs": [ + "src/main/resources/assets/retold/textures/entity/earth_guardian.png" + ], + "historical_packaged_outputs": [ + { + "path": "src/main/resources/assets/retold/textures/entity/earth_guardian.png", + "size": [ + 128, + 64 + ], + "sha256": "12257c4786bd88ac38f27d8ad816ec5c0538ff1f0b9b9eb5bdb91744b0713ed4" + } + ] + } + ], + "active_source_count": 7, + "active_output_count": 9, + "runtime_reuse": { + "aender_eye": "minecraft:textures/item/ender_eye.png from installed Minecraft resources, used directly as an emissive billboard including resource-pack texture replacements; no Retold Eye sprite packaged" + } +} diff --git a/docs/internal/retold_design_risks.md b/docs/internal/retold_design_risks.md index a8a2a766..c334a3f7 100644 --- a/docs/internal/retold_design_risks.md +++ b/docs/internal/retold_design_risks.md @@ -6,10 +6,13 @@ | Area | Risk / open item | Current note | | --- | --- | --- | +| Equipment and boss visual approval | Development models and artwork are installed, but their final appearance has not been accepted. | Technical checks and the original-art-only offline preview do not establish visual quality or boss-combat balance. Awakening uses synchronized remaining server time; actual client delivery and late joins remain unverified. Developer review must cover Steel trims and adult/baby geometry, held spear scale, Earth poses and edge-of-view culling, Gale wind translucency/glowing face/plate readability/Heavy Core visibility, Aender Eye's installed texture billboard and resource-pack texture replacements, shaders, and connected multiplayer. Exact automated results are in [`testing_strategy.md`](testing_strategy.md#asset-and-boss-presentation-checks). | +| Earth Guardian roaming encounter identity | Presence repair still searches only the loaded structure bounds plus eight blocks. A guardian outside that area or in an unloaded chunk may be mistaken for a missing encounter entity. | The 2026-09-07 center-teleport fix preserves an existing roaming guardian during rebinding, without broadening searches or adding chunk tickets. It does not establish global encounter identity: SavedData currently tracks lifecycle, not guardian UUID. Persisted identity and compatible recovery rules need a separate focused pass, including outside-bound pursuit and chunk unload/reload tests. | | Progression | Stage 1 Wither/Nether star End access gating is undecided. | Do not implement until developer decides. | -| Ritual sacrifices | Earth still needs a completed acquisition path, and enabling the full six-item hatch gate now would make Stage 3 unobtainable. | Saved state reserves stable bits for all six sacrifices; Water, Air, Fire, Life, and Death are accepted, while Water/Air/Life/Death remain temporarily required. Wildfires provide Nether Reactor Cores through a deliberately boss-tier Stage 2+ Nether encounter with three to five Blaze escorts, reinforced shields, stronger fireballs, shockwave, and fire recovery. Idle encounters use persisted numbered escorts for a single-file patrol that releases for combat or recovery; healthy leaders maintain lava-surface buoyancy and reposition around ranged targets under a recovery-preemptible movement owner. At half health, a leader prefers nearby lava, submerges under persisted recovery ownership, restores full health and shields, and resurfaces. Their dedicated 600-tick player-centered owner ignores biome mob weights and the ordinary monster cap but retains a 128-horizontal/64-vertical local exclusion, so natural testing must confirm the required Fire artifact is reliably discoverable without becoming repetitive or farmable, that the formation can turn through real Nether terrain, and that lava entry, submerged healing, resurfacing, and combat movement remain readable without clipping or exploitable reset loops. The fixed controller is intentionally not frequency-tunable through biome spawn-list datapacks; a Retold-owned data/config extension remains a future compatibility option if needed. Artifact identity is authoritative; no hidden source provenance is stored. Focused state, interaction, rewards, independent spawn, formation, lava-surface, full lava-recovery, combat-movement, and encounter tests pass. Wildfire balance/presentation and Air pacing/readability, wider seeds, upgraded worlds, dedicated servers, and multiplayer still need verification. | +| Ritual sacrifices | The six-item gate is now enabled, but natural discoverability, reward retrieval, and upgraded-world completion need verification. | All six sacrifices are accepted and required, including Earth Guardian Lodestone. Existing saved bits and Stage 3 state remain unchanged; unfinished Stage 2 worlds must obtain missing artifacts. The vanilla Lodestone recipe and new Ruined Portal/Bastion Bridge chest drops are removed without invalidating old stacks. New alternative datapack recipes/loot can intentionally bypass encounter acquisition. Wildfires provide Nether Reactor Cores through a deliberately boss-tier Stage 2+ Nether encounter with three to five Blaze escorts, reinforced shields, stronger fireballs, shockwave, and fire recovery. Idle encounters use persisted numbered escorts for a single-file patrol that releases for combat or recovery; healthy leaders maintain lava-surface buoyancy and reposition around ranged targets under a recovery-preemptible movement owner. At half health, a leader prefers nearby lava, submerges under persisted recovery ownership, restores full health and shields, and resurfaces. Their dedicated 600-tick player-centered owner ignores biome mob weights and the ordinary monster cap but retains a 128-horizontal/64-vertical local exclusion, so natural testing must confirm the required Fire artifact is reliably discoverable without becoming repetitive or farmable, that the formation can turn through real Nether terrain, and that lava entry, submerged healing, resurfacing, and combat movement remain readable without clipping or exploitable reset loops. The fixed controller is intentionally not frequency-tunable through biome spawn-list datapacks; a Retold-owned data/config extension remains a future compatibility option if needed. Artifact identity is authoritative; no hidden source provenance is stored. Focused state, interaction, rewards, independent spawn, formation, lava-surface, full lava-recovery, combat-movement, and encounter tests pass. Wildfire balance/presentation and Air pacing/readability, wider seeds, upgraded worlds, dedicated servers, and multiplayer still need verification. | +| Earth Labyrinth generation and unrestricted mutation | Every newly generated Jungle Pyramid must gain a randomized two-level labyrinth without changing already-generated pyramids or producing unsolvable initial layouts. Once awake, the guardian is deliberately allowed to destroy player builds, containers, mechanisms, Bedrock, and terrain outside the labyrinth, which can permanently damage worlds and erase block-entity inventories. | `EarthLabyrinthPlanner` provides stable world/structure-position seeding and 512-seed coverage requiring every cell and the fixed guardian chamber to remain reachable from the fixed entrance, four or five separated vertical links outside the arena, at least one loop, unique adjacent passages, and a 77- or 101-block footprint. The `minecraft:jungle_pyramid` definition creates a serialized compatible temple wrapper and separate chunk-bounded labyrinth piece whose floors are 64 and 78 blocks below the pyramid base. Initial generation preserves the vanilla puzzle and builds a safe access route. The guardian foundation resolves only Retold pieces, persists lifecycle independently, wakes only for a Stage 2 Survival player, and suppresses respawn after `DEFEATED`. Awakening makes it damageable; clues within 24 blocks lock a persisted floor position for a 30-tick warning before cycling through protection-approved ceiling collapse with a clear fall path, a persistent 3×3 lava pool replacing the supporting layer, and a 3×3 pit up to four blocks deep without granting sight-like tracking. Its terrain controller makes at most 12 edits per ten-tick pulse while pursuing an in-range clue, accepts any loaded non-air state without an ownership, hardness, block-entity, or labyrinth-bound check, and conserves the exact state through a persisted 128-block reserve. Placement rejects occupied cells, while `mobGriefing`, NeoForge entity griefing, and `RetoldWorldProtection` remain server-authoritative overrides. Relocated block entities do not retain inventory or other NBT. Focused GameTests cover initial geometry/lifecycle, environmental-warning persistence, real falling ceiling debris, blocked/open-sky fallback and lava ground conversion and vanilla contact damage, bounded floor collapse with protected columns and vanilla fall damage, plus outside-bound Chest and Bedrock relocation, conservation/save-load, and protection denial. Fresh multi-seed generation, repeated destruction reach, loss of valuable/NBT-bearing blocks, modded/unusual fluid-state relocation, long-session fluid replenishment, path escape, hazard dodge readability/balance, ceiling depletion, cumulative pits and escape routes, lava-pool presentation and accumulated fluid spread, collateral mob damage, claim adapters, multiplayer, dedicated servers, existing worlds, and player-facing warnings remain unverified. Versioned new-start side rooms now add chunk-bounded arrow traps and treasure with no lights or spawners; vanilla natural spawning still depends on darkness, distance, difficulty, biome, and caps. Multi-seed/chunk-border natural generation and room pacing remain unverified. The new body-clearance/ramp helper walks real edited terrain toward clues, with persisted heading, loaded-only short work segments, and bounded twelve-edit pulses. Supported 3×3 trailing walls share that pulse budget, require stored material, and have a forty-tick cooldown. Faster excavation and deliberate walls increase world damage and can seal retreat routes; natural pacing, obstruction recovery, and active multi-guardian mutation cost need verification. Its 128-state reserve and trailing backfill keep material finite. It may stall where protection or lack of usable support material prevents a physical route; no teleport fallback is added. A production-generated lower-maze server regression now verifies pursuit after an unprotected lava eruption and periodic encounter repair; it exposed and fixed vanilla destruction leaving lava sources in the route. Exact source/flowing/waterlogged relocation and protection tests also pass. This one-layout mock-player pass does not establish natural mixed maze/combat pacing, upper-floor pursuit, or idle cross-floor patrol. The 2026-09-08 direction adds heard-player contact melee, faster pursuit, and continued approach during hazard warnings. Close strikes use vanilla reach and golem damage with a fresh obstruction check and persisted 30-tick cooldown; combined damage, knockback, dodging space, and natural maze pressure need balance testing. Fire/lava immunity for the guardian and dropped artifact is undecided and not implemented; traversal tests guard an off-route attack pad so locomotion checks do not establish combined hazard safety. Loot tables expose treasure, finite trap ammunition, and the boss's Lodestone drop; ordinary item despawn, lava destruction, and mob-loot rules still apply. Pit excavation removes at most 36 loaded blocks without drops or reserve storage and stops each column at denied terrain. Initial lava placement checks both break and place protection; later vanilla fluid spread and fire follow Minecraft and installed server protections, without per-flow guardian attribution. This destructive scope is intentional developer direction as of 2026-09-02, with real floor-to-lava conversion confirmed on 2026-09-07; do not silently restore block or labyrinth restrictions. | | Air Temple discovery | An explorer map could select a delayed Air Temple start that retrogen later suppresses because an upgraded-world chunk was edited. The initial synchronous structure search and biome-preview rendering may also cause a noticeable interaction stall. | Basic cartographer interaction and exact-map behavior were developer-verified on 2026-07-22. Failed searches are throttled for five minutes per cartographer. In wider fresh and upgraded test worlds, measure the first interaction and confirm the marker leads to a generated tower, including a world where a nearby deferred start is permanently skipped. | -| Aender | The horizontal portal, 8:1 scaling, counterpart creation, persisted global/regional and per-chunk reality state, generator V3, player-scoped regional volatility, player-centered blank-then-regenerate transitions, deferred stabilizer release, adaptive tick-time budgets, indefinite safe-core arrival gate, living terrain blocks, complete wood family, experimental per-island Aender Desert, cave tunnels, Aenderite deposits, and expanded topology/decorations need fresh-world, existing-world, rapid re-entry, high-view-distance, and multiplayer verification. | JUnit tests cover order-independent terrain interval composition, equivalent cached/direct vertical biome selection, biome-owned archetype families, relief differences, erosion silhouettes, satellite distribution, cave continuity/entrance balance/fragile-island exclusion, vegetation clearings, rare-formation planning/intersection, deterministic Aenderite frequency/size/underside bias/chunk-border continuity, adaptive budget scaling, active-region watcher transitions, deferred-release watcher/overlap policy, and the portal transition gate. Deterministic GameTests cover shape lifecycle, scaling, counterpart creation/indexing, living terrain/wood/desert/ore survival data, full-pipeline cave carving and Aenderite block placement, vanilla creative-tab integration, reality/stability serialization including the deferred attachment state, chunk attachment state/cache restoration, entity cleanup, blank transitions, and stable-versus-volatile policy. The GameTest server does not load the custom Aender dimension, so still verify crash recovery, V1/V2/V3 selection, desert frequency/palette/atmosphere, all island archetypes/undersides/detached satellites, cave shape/entrances/chambers and Aenderite exposure, warped satellite coastlines, erosion openings, split ravines, clustered decorations, formation frequency, vertical biome transitions, biome replacement packets, shared and unattended multiplayer regions, deferred two-player stabilizer release, ring regeneration, tick-load throttling, V3 borders, arrival safety, and client models in normal clients. Repeat the TPS-graph scenario to measure remaining per-chunk spikes after biome-column caching, paced blanking, measured-cost admission, and removal of synchronous stale-load/portal-search regeneration. `dev_aender_portal_frame` and the 23 remaining credited AI-generated Aender textures remain provisional; Aender Sand has an accepted original replacement. | +| Aender | The horizontal portal, 8:1 scaling, counterpart creation, persisted global/regional and per-chunk reality state, generator V3, player-scoped regional volatility, player-centered blank-then-regenerate transitions, deferred stabilizer release, adaptive tick-time budgets, indefinite safe-core arrival gate, living terrain blocks, complete wood family, experimental per-island Aender Desert, cave tunnels, Aenderite deposits, and expanded topology/decorations need fresh-world, existing-world, rapid re-entry, high-view-distance, and multiplayer verification. | JUnit tests cover order-independent terrain interval composition, equivalent cached/direct vertical biome selection, biome-owned archetype families, relief differences, erosion silhouettes, satellite distribution, cave continuity/entrance balance/fragile-island exclusion, vegetation clearings, rare-formation planning/intersection, deterministic Aenderite frequency/size/underside bias/chunk-border continuity, adaptive budget scaling, active-region watcher transitions, deferred-release watcher/overlap policy, and the portal transition gate. Deterministic GameTests cover shape lifecycle, scaling, counterpart creation/indexing, living terrain/wood/desert/ore survival data, full-pipeline cave carving and Aenderite block placement, vanilla creative-tab integration, reality/stability serialization including the deferred attachment state, chunk attachment state/cache restoration, entity cleanup, blank transitions, and stable-versus-volatile policy. The GameTest server does not load the custom Aender dimension, so still verify crash recovery, V1/V2/V3 selection, desert frequency/palette/atmosphere, all island archetypes/undersides/detached satellites, cave shape/entrances/chambers and Aenderite exposure, warped satellite coastlines, erosion openings, split ravines, clustered decorations, formation frequency, vertical biome transitions, biome replacement packets, shared and unattended multiplayer regions, deferred two-player stabilizer release, ring regeneration, tick-load throttling, V3 borders, arrival safety, and client models in normal clients. Repeat the TPS-graph scenario to measure remaining per-chunk spikes after biome-column caching, paced blanking, measured-cost admission, and removal of synchronous stale-load/portal-search regeneration. Aender material artwork follows the confirmed static inverted-world palette and remains development art. Grass and ore retain their exact Soil and Stone host backgrounds; original plank art is retained and generated Sand supersedes the developer drawing. See [`ASSET_CREDITS.md`](../../ASSET_CREDITS.md) for the active texture inventory and source records. Tiling, foliage settings, cutout edges, signs/boats, inventory readability and resource reload still need developer review. | | Aender | A separate in-dimension teleportation network and late-game rewards are still planned. | Cross-dimension travel is implemented; remaining travel/reward design needs clarification before code. | | End | End City/outer End removal needs fresh-world and existing-world verification. | Data/mixins exist, but generated-world behavior should be tested. | | Elytra | Elytra should remain an item but not be survival-obtainable. | Depends on End Cities not generating and no alternate survival source being added unintentionally. | @@ -51,7 +54,7 @@ | Villages | Container, Farmer-crop, and profession-tended livestock offenses use witnessed vanilla gossip. Sight and village-context checks can be sensitive to walls, crowded settlements, vertical farms, merged double chests, animal transport, automation, and multiplayer timing. | Generated village loot plus Villager-produced quantities are protected; player deposits and ambiguous already-opened existing-world contents are not. Farmer planting/replanting marks persistent crop positions. Shepherds, Leatherworkers, and Butchers claim only animals they successfully feed with two real storage items; player interaction/leashing marks previously unowned livestock as player-associated. Offspring of two owned parents inherit persisted village ownership, while an automatic offspring of a player-associated unowned parent inherits player protection. Witnessed direct Survival kills add `-50`; monsters, environment, Creative, and Spectator do not. Four focused animal tests plus the crop/container groups cover persistence, ownership separation, conservation, offense strengths, witnesses, and exclusions; the latest 50-Villager TPS peak is 7.259 ms/tick. Naturally verify physical storage-to-pen routes, wandering/boat-transport edge cases, full harvest/replant cycles, trade prices, golem reaction, double chests, hoppers, simultaneous players, dedicated servers, and existing worlds before calling the loop fully verified. | | Stage 3 | Raid creation is now gated to Stage 3, but the broader illager behavior may need clearer player-facing feedback later. | Avoid major raid redesign without developer approval. The Stage 2 live creation rejection and Witch/Illager same-raid cooperation are regression-tested; natural Bad Omen preservation, Stage 3 Raid Omen conversion, wave participation, healing, and raid-exit behavior still need in-game verification. Existing raids deliberately continue if an administrative command moves the world back below Stage 3. | | Piglins | Stage 3 piglin/pigman hiring or follower behavior is planned but not implemented. | Needs feature design. | -| Items | The implemented Flint-through-Diamond spine changes first-spawn assumptions, leaf/bush loot, chest and Villager alternatives, Mending acquisition, Copper distribution, Campfire ignition, recipes, station use, mining speed, Flint/Steel Spears, ten Steel equipment items, animal-armor enchanting, and the effective maximum durability of existing Diamond equipment. Its provisional balance, fuel economy, compatibility, and reused visuals need validation. Later equipment and combat reworks remain planned. | Focused GameTests cover the material ladder through Steel, six-attempt ordinary/large Copper placement across seeded chunk-border origins, scaled leaf/Dead Bush/living-bush Stick rolls and harvest exclusions, Flint/Steel Spear recipes/tags, bonus and Village chest ceilings, mastery/price trade tiers, enchanted trade rarity, Wandering Trader pricing, Mending source tags, Campfire/Brick Furnace boundaries, all twelve enchantable Diamond items including a curse-only durability unlock, and animal-armor enchant effects. Curses intentionally count as enchantments, but revisit that choice if curse acquisition makes full Diamond durability too cheap. Chest/trade/enchantment overrides are global server data and therefore consistent across players, but existing saved Villager offers are deliberately not rerolled and datapacks may replace the same tables/tags. Naturally verify new and existing worlds, Villager leveling/discounts/restocking, multiplayer/dedicated servers, every chest type, fishing and structure Mending absence, bush farming, Spear combat/repair/enchanting, reused visuals, fresh-seed Copper pacing, Campfire visuals/automation, Steel fuel economy, and dynamic Diamond durability. Existing Mending items remain functional, and commands/Creative retain access. Aenderite still provides only an ore/raw/ingot foundation. | +| Items | The implemented Flint-through-Diamond spine changes first-spawn assumptions, leaf/bush loot, chest and Villager alternatives, Mending acquisition, Copper distribution, Campfire ignition, recipes, station use, mining speed, Flint/Steel Spears, ten Steel equipment items, animal-armor enchanting, and the effective maximum durability of existing Diamond equipment. Its provisional balance, fuel economy, compatibility, and the new original development visuals need validation. Later equipment and combat reworks remain planned. | Focused GameTests cover the material ladder through Steel, six-attempt ordinary/large Copper placement across seeded chunk-border origins, scaled leaf/Dead Bush/living-bush Stick rolls and harvest exclusions, Flint/Steel Spear recipes/tags, bonus and Village chest ceilings, mastery/price trade tiers, enchanted trade rarity, Wandering Trader pricing, Mending source tags, Campfire/Brick Furnace boundaries, all twelve enchantable Diamond items including a curse-only durability unlock, and animal-armor enchant effects. Curses intentionally count as enchantments, but revisit that choice if curse acquisition makes full Diamond durability too cheap. Chest/trade/enchantment overrides are global server data and therefore consistent across players, but existing saved Villager offers are deliberately not rerolled and datapacks may replace the same tables/tags. Naturally verify new and existing worlds, Villager leveling/discounts/restocking, multiplayer/dedicated servers, every chest type, fishing and structure Mending absence, bush farming, Spear combat/repair/enchanting, original equipment visuals, fresh-seed Copper pacing, Campfire visuals/automation, Steel fuel economy, and dynamic Diamond durability. Existing Mending items remain functional, and commands/Creative retain access. Aenderite still provides only an ore/raw/ingot foundation. | | Environment | Death drops should despawn much later than vanilla, not never. | No implementation confirmed. | | Beds | Beds should not skip night; valid daytime bed rest is allowed when night skipping is disabled. | Healing behavior not confirmed implemented. | | Nether portal drain | Permanent corruption around an Overworld portal can surprise builders, damage classified blocks, compete across many loaded portals, or cross a claim boundary. Area scaling allows a sufficiently large portal to reach a 48-block death radius and 24-block corruption radius, greatly increasing candidate count, lava-scan area, and overlap potential. Concurrent fronts can also become visually uneven when the death wave has few eligible blocks but the corruption wave crosses dense stone, while chunk/server reload can temporarily revisit already transformed inner positions. | The implemented stage-independent owner uses separate deterministic nearest-to-farthest death and corruption cursors, slow background work, bounded successful-traveler pulses, loaded-chunk indexing, fair queues, and no forced loading. The standard 2×3 portal remains 16/8; each additional interior block adds one outer-radius block before the 48 cap, and corruption remains at half radius. A compact primitive index avoids a retained `BlockPos` object per candidate. Corruption can advance only when its squared distance is at most one quarter of the inspected death front. Each cursor skips up to 48 ineligible or already transformed positions per work unit and cycles after both fronts reach their edges so later player construction remains eligible. It protects all block entities plus tagged portals, ores, storage blocks, Obsidian, Crying Obsidian, and Retold Aender infrastructure. Explicit semantic palette tags replace the former generic mining/full-block fallbacks: native Nether results are stable and unclassified vanilla or modded blocks remain unchanged unless a datapack opts them into a transformation. A separate fair queue scans no more than two loaded chunks every five ticks for lava sources inside each outer sphere. Its completed snapshot applies exact fractional work credit, pauses initial spread until known, ignores flowing lava, and stops both fronts when sources match or exceed portal blocks without consuming lava. Every individual edit asks the `NETHER_PORTAL_DRAIN` protection category. Focused tests cover area calculations/cap/index extent, the nested-radius invariant, Coarse-Dirt intermediate state, death-wave stone exclusion, explicit stable/change/unchanged mappings, coral death, frozen melting, water and waterlogged evaporation, lava-source boundaries and linear rates, protected valuables, denial, and pulse caps. Naturally verify performance and pacing at several portal areas including the cap, lava placement/removal response time, dense lava fields, many simultaneous portals, two-front readability, dense builds, adjacent/overlapping portals, chunk borders/unloads, save/reload, existing worlds, representative modded blocks/datapacks, real claim adapters, multiplayer, and dedicated servers before tuning cadence or scaling. | diff --git a/docs/internal/retold_issues.md b/docs/internal/retold_issues.md index 5c2c30a3..75e06b45 100644 --- a/docs/internal/retold_issues.md +++ b/docs/internal/retold_issues.md @@ -15,6 +15,12 @@ When adding an issue, include: | Area | Issue | Reproduction / Evidence | Status | | --- | --- | --- | --- | +| Earth Guardian stalls on its own lava | Vanilla block destruction preserves fluids, so trying to excavate a lava source returns no change. Floor repair then retries the same lava cell indefinitely while the boss keeps hearing the player. | On 2026-09-08, `earth_guardian_pursues_into_generated_maze` failed twice after 2,400 server ticks in generated lower-floor geometry: roughly ten blocks from center, 2,392 ticks with a clue, five stored states, and `blockedState=minecraft:lava[level=0]`. Environmental attacks and forty-tick presence repair were enabled. | Fluid-bearing excavation now replaces the entire state with air under the existing protection/material guards. The generated-maze pursuit and exact fluid-state/protection regressions pass. Connected-client, existing-world, long-session, and upper-floor confirmation remain pending. | +| Earth Guardian ramp support after rapid excavation | Residual movement could put the wide body just inside the next unplaced stair support. Occupancy protection correctly rejected placement, leaving construction stuck indefinitely. | The rapid-edit ascent fixture failed after 24,000 ticks with 250 health, 127 stored states, and the next support overlapping the guardian's bounding box. | Construction now replans from actual feet when the guardian occupies an unplaced support. The ascent regression passes. Backfill/walls also exclude the whole active stair workspace. Natural ramp and wall-placement tuning remains unverified. | +| Earth Guardian moving-clue tunnel stall | Every changed footstep position discarded the current excavation segment and stopped navigation, so the boss heard the player but remained at the maze entrance after a few ceiling edits. | `earth_guardian_follows_real_steps_into_tunnel` failed before the fix after 2,000 server ticks with 1,986 ticks of remembered clues, six excavated blocks, and the guardian still near the entrance. Events use Minecraft's dispatcher/listener/travel path, not direct clue injection. | The same regression passes after retaining the short committed landing across clue updates. The next segment follows the newest clue. Hearing rules, memory lifetime, edit budget, and protection checks are unchanged. Natural dungeon and connected-player verification remain pending. | +| Earth Guardian repeated center teleport | The 40-tick source scan called `configureForLabyrinth` on the existing guardian, which unconditionally restored its chamber position even while roaming. | Developer reported repeated center teleports on 2026-09-07. The extended exact `earth_guardian_foundation_spawns_and_persists_lifecycle` test failed before the fix when a displaced roaming guardian snapped to its anchor on the next repair. | Same-encounter repair now retains roaming position and avoids reapplying an unchanged lifecycle. The foundation regression passes, including repeated scans, preserved clue/state/velocity, reload rebinding, anchored dormant state, and uninterrupted awakening. Natural-world confirmation remains pending. | +| Earth Guardian movement ownership | Investigation and patrol claimed `EARTH_GUARDIAN` navigation ownership, then called vanilla navigation without the Retold-owned bypass, so movement was rejected. Finished/failed investigation paths also bypassed the intended retry delay. | `retold:earth_guardian_physically_investigates_vibrations` failed before the fix after 100 real entity ticks with the correct owner, `path=null`, and no approach toward a remembered clue 30 blocks away. | Investigation now uses the shared budgeted/throttled movement helper; patrol starts its selected path through the existing ownership bypass. Investigation retries remain at least 20 entity ticks apart even when navigation is done. The exact real-tick approach and patrol regressions pass. Natural maze routes, vertical links, multiplayer, and long-session pursuit still need verification. | +| Earth Guardian physical route clearance | The 3.2-block guardian could not fit ordinary three-block maze headroom, and the original excavation scan ignored the ceiling layer. The early ramp pass also stalled on wide-body ledges, support occupancy, and a full material reserve. | Code inspection confirms the hitbox/ceiling mismatch; real-tick fourteen-block ramp regressions exposed the landing, alignment, and backfill stalls. | A dedicated short-route helper excavates body clearance, builds solid conserved supports, preserves ramp heading, and walks exact landing waypoints. The reserve is bounded at 128 states and backfill covers the higher trailing corridor. Synthetic traversal and mutation-policy coverage do not establish natural combined maze/combat behavior, idle cross-floor patrol, or multiplayer. | | Panda bamboo navigation | A hungry Panda could repeatedly select a bamboo stalk after navigation had already shown it was enclosed and unreachable, leaving it idle or pushing near the same obstacle instead of trying another food source. Generic hunger search could also intermittently claim random movement and prevent the dedicated bamboo owner from starting. | Follow-up audit prompted by the developer's short-playtest Panda movement note on 2026-08-23. The initial end-to-end fixture placed the strictly nearer stalk inside a two-high stone enclosure and timed out after 320 ticks before the fix. The final focused regression isolates the selection contract: the bounded search must first choose that enclosed stalk, then choose the reachable alternative after the exact target is marked unreachable without consuming either block. Repeated validation also exposed the generic-search ownership conflict. The nearby adult-Panda jump caused by a baby sneeze is separate vanilla behavior and already excludes adults in water. | Fix implemented by reserving ordinary bamboo acquisition for the specialist owner, consuming the shared ground-navigation outcome, and temporarily excluding the exact failed stalk from that Panda's bounded bamboo search. The exclusion lasts 30 seconds, retains at most four positions per Panda, and is never created by LOD or path-budget deferral. The exact replacement and ordinary meal tests pass 1/1, and all five 50-Panda TPS phases hold 20 TPS with a 4.024 ms/tick peak. Needs natural grove, obstacle, and long-term depletion confirmation before moving to Resolved Issues. | | Phantom attack completion | Phantoms could acquire and retain valid Retold prey but circle near it without completing an attack. | Developer short-playtest report on 2026-08-30. The focused production-handoff regression assigns an exposed Cow through the real Phantom stalk owner and requires actual health damage; before the fix it timed out after 240 ticks with the correct target still retained and no damage. | Fix implemented with a bounded per-Phantom circle/dive state and narrow travel hook. Only an owned active dive receives constant-time line-of-sight and collision-checked steering; ordinary vanilla flight remains intact. Successful vanilla or fallback damage releases target/control and starts an eight-second recovery that blocks both Retold and vanilla reacquisition. All three Phantom behavior tests pass together, and the five-phase 50-Phantom benchmark holds 20 TPS with a 3.866 ms/tick peak. Needs natural terrain, player/prey variety, visual pacing, multiplayer, and dedicated-server confirmation before moving to Resolved Issues. | | Armed-mob weapon pose | Mobs carrying weapons could repeatedly lower and raise them while approaching an attack; it was unclear whether the visible reset also interrupted combat for a tick. | Developer short-playtest report on 2026-08-29. The exact Skeleton regression assigns a Retold-owned target, lets vanilla lower the aggressive pose and begins real bow use, then refreshes the unchanged target/source. It failed before the production fix because the refresh forced the weapon pose back up. | Fix implemented by making exact live target/source refreshes idempotent and suppressing only their redundant `aggressive=true` write. Active bow use now survives; target/source changes and explicit non-aggressive writes remain functional. The exact test passes 1/1; needs natural visual and attack-cadence confirmation across Skeletons, Pillagers, Piglins, and melee weapon users before moving to Resolved Issues. | @@ -49,6 +55,7 @@ Move issues here only after the implementation is complete and the behavior has | Area | Issue | Resolution | | --- | --- | --- | +| Earth Guardian client spawn | A dormant Earth Guardian disconnected the integrated client with `Network Protocol Error` when its spawn packet was received near a Jungle Pyramid. | Client construction no longer touches the server-authoritative AI ownership map before Minecraft assigns the guardian's network entity ID. The focused lifecycle GameTest and build pass, and the developer confirmed teleporting to the Jungle Pyramid works on 2026-09-02. | | Animal Feeder item duplication | Survival insertion and later retrieval could return more food than the player transferred. | Insertion now copies only into feeder storage and shrinks the Survival player's actual held stack by exactly the accepted count; Creative intentionally keeps its source stack. Automated coverage checks one-item insertion, sneak-bulk insertion, exact conservation, retrieval, and Creative non-consumption. The developer re-tested the controls and confirmed they work on 2026-08-04. | | Animal Feeder approach | A Sheep in an enclosed pen stopped one block short of the feeder because ordinary navigation accepted the node before the required access cell. | The final feeder approach now requests reach range zero and movement memories distinguish route precision. Automated coverage drives a real Sheep to consumption without teleporting. On 2026-08-04, the developer re-tested the reported enclosure and confirmed exact arrival and feeding, the two-second source-facing pose for feeder/dropped/forage food, immediate damage interruption, and several hungry Sheep using one trough. | | Passive mob fleeing | Damage from Zombies, players, projectiles/explosions, and environmental sources did not enter shared passive flee memory. | Successful health damage now immediately seeds remembered flight for eligible land and fish prey without overriding specialized defense/retaliation. Focused automated coverage passes, and the developer reported the ordered natural passive-flee acceptance pass works on 2026-08-03. | diff --git a/docs/internal/retold_mob_ai_system.md b/docs/internal/retold_mob_ai_system.md index 3f8317bc..1a5b55e1 100644 --- a/docs/internal/retold_mob_ai_system.md +++ b/docs/internal/retold_mob_ai_system.md @@ -1334,7 +1334,7 @@ dedicated-server observation, or profiler/JFR evidence. ### Per-Mob TPS Matrix -`RetoldPerMobTpsGameTests` registers one independent 50-subject test for each of the 83 loaded +`RetoldPerMobTpsGameTests` registers one independent 50-subject test for each of the 84 loaded mob profiles. Every species is measured through idle/rest, dropped-food/forage, hunt/target, danger/social, and habitat/day-night phases. Profile-appropriate fixtures provide water, caves, Nether ground, prey, threats, forage, hives, and other required stimuli. Each phase records real @@ -1384,6 +1384,39 @@ After restricting recovery to cached lava columns at least three blocks deep, th still sustains 20 TPS in all five phases with a 4.876 ms/tick peak. The complete matrix remains unnecessary because the additional constant-depth validation stays inside the existing bounded, cached Wildfire block search. +Earth Guardian expands current registration to 84 tests/420 phases. Its +route helper now supplies bounded full-body excavation and supported walking ramps when ordinary +navigation stops. Terrain work batches at most 12 edits per ten ticks, uses loaded chunks +and normal mutation protection, retains a 128-state material reserve and a saved ramp heading, +and routes exact walking waypoints through the shared path helper. It neither teleports nor +obtains a sight target. Natural route pacing and simultaneous terrain combat remain unverified. +Supported 3×3 trailing walls use only spare pulse budget and stored solid material, with a +forty-tick cooldown. No-progress route steps end the batch immediately; denied work is not retried +twelve times in a pulse. The 128-state reserve remains the hard material limit. +The generated-maze pursuit regression exposed a separate fluid stall: vanilla destruction +preserves lava sources, leaving route repair retrying one cell forever. Fluid-bearing excavation +now removes the complete state to air under the same protection/reserve transaction. Real +server ticks in generated lower-floor geometry verify continued pursuit after a lava eruption, +using dispatched mock-player footsteps and periodic encounter repair. No listener range, +memory, movement ownership, cadence, or path budget changes accompany this fix. +Moving footsteps no longer discard a committed short excavation/walking segment. The guardian +reaches its landing before using the newest clue for the next segment, avoiding repeated path +restarts at low tunnel entrances. A real-dispatch moving-footstep regression reproduces the old +stall and passes with this fix; its protected attack pad does not establish mixed hazard balance. +The 2026-09-08 combat direction adds `EarthGuardianMelee`, which resolves only the heard source +through the level's UUID lookup, checks contact every five ticks, and uses a fresh budgeted +obstruction ray before a cooldown-limited strike. It does not scan for nearby players or assign +a sight target. Investigation uses speed 1.4 and keeps approaching during hazard warnings; +arrival preserves the clue until normal expiry. The 30-tick melee cooldown survives entity reload. +The focused aggressive-combat TPS rerun passes all five phases at 20 TPS with a 13.915 ms/tick +peak; this griefing-disabled fixture is not a many-player close-melee benchmark. +The exact 50-guardian selector runs the active roaming state and passes all five phases below 50 ms/tick, +peaking at 7.302 ms/tick for hunt/targeting after adding supported excavation routes. +Command-spawned fixtures use the production terrain controller, dynamic listener, weighted memory, +bounded patrol/investigation, and fixed-location hazard checks. This benchmark disables griefing, +so actual block mutation, accumulated pits, and lava spread still need separate profiling. +The complete matrix remains unnecessary because these paths are +entity-local. The Stage 2 Undead-pressure rerun forces `UNDEAD_HUNGRY` and `UNDEAD_TOLERANT` benchmark fixtures to Stage 2, restores the previous saved stage during cleanup, and covers all eight affected species. All 40 exact phases passed below 50 ms/tick; Zombie hunt/targeting was the 6.046 ms/tick overall diff --git a/docs/internal/retold_mod_system.md b/docs/internal/retold_mod_system.md index 710ba147..55d360da 100644 --- a/docs/internal/retold_mod_system.md +++ b/docs/internal/retold_mod_system.md @@ -102,6 +102,7 @@ The main event registration is intentionally explicit. When adding a new system, | `villager` | villager teaching, trade refresh, communal food/supply, livestock tending, property reputation, golem construction, and torch maintenance | | `worldgen` | worldgen registry and structure tags | | `worldgen/air` | Air Temple structure, wind zone, Breeze spawning, and Gale Core encounter | +| `worldgen/earth` | composite Jungle Pyramid generation, deterministic Earth Labyrinth planning/placement, and persisted Earth Guardian foundation | | `worldgen/delayed` | stage-delayed structure generation and mob suppression | `NetherFogColorMixin` is a client-only atmospheric base-color hook. In the vanilla Nether dimension, @@ -190,7 +191,7 @@ split into these modules: | `RetoldFoundationModule` | blocks, entities, game rules, networking, client bootstrap, commands, player lifecycle, opening tool progression, reload listeners, and GameTests | | `RetoldStageModule` | stage runtime, End progression, recipe gating, and stage-gated patrols | | `RetoldMobModule` | undead, piglin, golem, enderman, and elder guardian events | -| `RetoldWorldgenModule` | worldgen registries, attachments, spawn cache, Air Temple, and delayed structures | +| `RetoldWorldgenModule` | worldgen registries, attachments, spawn cache, Air Temple, Earth Labyrinth, and delayed structures | | `RetoldAenderModule` | Aender registries, stability events, world ticks, and Chronolith events | | `RetoldAtmosphereModule` | global server-authoritative atmosphere scheduling across dimensions | | `RetoldFactionModule` | invalid-target cleanup, faction combat, and faction assist | @@ -202,6 +203,13 @@ order is dependency-aware: faction precedes territory, and territory precedes be ## Tool And Station Progression +`RetoldEquipmentAssets.STEEL` is the equipment resource key used by the registered Steel armor +material. `assets/retold/equipment/steel.json` owns its adult, leggings, and baby texture layers; +normal equipment components and vanilla armor/trim rendering resolve them without interception. +Original item sprites use standard generated/handheld parents, and Flint/Steel Spears retain the +existing display-context selector with Retold 16x16 inventory and 32x32 held artwork. Stats, repair tags, +recipes, and third-party component overrides are unaffected by this presentation layer. + `RetoldToolProgressionEvents` owns the non-data opening rules: logs require a correct held tool, the Copper Pickaxe receives a Stone-specific speed penalty, Copper and Iron Pickaxes receive the Steel-tier Deepslate penalty, and exact vanilla Wooden/Stone tool recipes are removed during recipe @@ -319,8 +327,8 @@ Current ritual model: - Dragon kill advances the world to Stage 2. - In Stage 2, the dragon egg accepts implemented ritual artifacts by item identity. -- Heavy Core represents Air, Heart of the Sea represents Water, Totem of Undying represents Life, - and Nether Star represents Death. The registered `air_element` and `water_element` items are +- Heavy Core represents Air, Heart of the Sea represents Water, Lodestone represents Earth, + Nether Reactor Core represents Fire, Totem of Undying represents Life, and Nether Star represents Death. The registered `air_element` and `water_element` items are legacy aliases retained for existing-world compatibility and are hidden from the ordinary Creative ingredients tab. - Acquisition order should be free; no path should require another path first unless the developer changes the design. @@ -328,13 +336,13 @@ Current ritual model: `RetoldWorldData` persists the mask under the legacy `offered_elements` field so old saves retain offered Water/Air progress. - The dragon egg crack overlay reflects the currently required offering count. -- The egg accepts Fire as well, but is currently removed and Stage 3 starts when Water, Air, Life, - and Death are offered. Change that threshold to all six only when Earth is survival-obtainable. +- The egg is removed and Stage 3 starts through `RetoldStageManager.setStage` only after all six + offerings. Stable saved bits preserve older progress; existing Stage 3 worlds are not downgraded. - Ritual stacks do not carry hidden source provenance. Unwanted alternative acquisition routes are removed or stage-gated instead; Trial Chambers are disabled and buried treasure no longer yields a Heart of the Sea. -Current limitation: +Current acquisition paths (presentation and natural-world verification remain incomplete): - Water uses the Ocean Monument/Elder Guardian path and the Heart of the Sea reward. - Air uses the WIP Air Temple/Gale Core path and the Heavy Core reward. The encounter is not final and still needs tuning/testing. @@ -360,8 +368,113 @@ Current limitation: owner makes up to 16 loaded-ground probes 48 to 96 blocks from one active player, independently of biome mob weights and the ordinary monster cap. It retains Peaceful, `doMobSpawning`, normal placement/despawn, player-distance, and 128-horizontal/64-vertical Wildfire-exclusion rules. The - core is accepted and persisted but deliberately remains outside the hatch threshold. -- Earth still needs a completed acquisition path and egg wiring. + core is accepted, persisted, and required for hatching. +- Earth Guardians use `retold:entities/earth_guardian` loot to drop one Lodestone under normal + mob-loot rules. `RetoldEndProgressionEvents` removes the vanilla `minecraft:lodestone` recipe + after resource layering, since false-conditioned overrides fall through to vanilla in 26.2. + `RetoldRemoveLodestoneLootModifier` removes only Lodestone from data-selected Ruined Portal and + Bastion Bridge chest tables. Existing items and placed Lodestones remain usable; intentionally + added datapack recipes/loot remain an integration boundary, not a provenance restriction. +- Earth is confirmed as a deterministic randomized two-level labyrinth beneath every newly + generated Jungle Pyramid, entered through the existing lever-puzzle room. Already-generated + pyramids remain untouched. The `minecraft:jungle_pyramid` data definition retains its registry id + but selects `EarthJungleTempleStructure` for new starts; each start serializes an + `EarthJungleTemplePiece` compatible with vanilla placement plus an `EarthLabyrinthPiece`. The + latter regenerates its layout from a stable world/structure-position seed and performs + chunk-bounded placement through `EarthLabyrinthGenerator`. The initial carved-cave network is 77 + or 101 blocks wide, with its floors 64 and 78 blocks below the pyramid base. Its logical nodes use + six-block spacing but receive deterministic inward-bounded X/Z offsets, and each open graph edge + becomes a bent cardinal path through a clamped intermediate point. Stone-lined passage shells + preserve closed barriers while irregular three-block-wide interiors, junction caverns, and the + depth-aware Stone/Deepslate/Andesite/Tuff palette avoid a regular cobblestone-grid appearance. It + has fixed entrance and guardian anchors, extra loops, a + protected long switchback route from the lever room, and four or five ladder connections placed + outside the arena. `EarthLabyrinthRooms` selects up to six separated dead-end rooms per floor + without changing the topology random stream. `EarthLabyrinthRoomPlacement` places finite-ammunition + vanilla pressure-plate/dispenser traps and occasional chests after carving, strictly within each + chunk. Both inventories use Retold-owned loot tables; existing containers are never refilled. + Rooms introduce no light sources, spawners, or spawn overrides. `ContentVersion=1` is persisted + for new starts; absent versions keep older/partially generated starts at empty-room version 0. + The lower maze wraps around a rough central + guardian arena with a guaranteed 31-block-wide core and ten blocks of headroom; its surrounding + shell can vary out to 33 blocks across. The wider level separation keeps the arena ceiling below + the complete upper maze. `retold:earth_guardian` is registered as an unmanaged boss-profile + entity with a spawn egg and original development stone-statue renderer. A bounded loaded-structure + scan resolves only serialized `EarthLabyrinthPiece` sources, spawns or repairs exactly one + persistent guardian initially at the fixed lower chamber, and ignores saved vanilla Jungle Pyramid starts. + Rebinding the same encounter is idempotent: a roaming guardian keeps its position, velocity, + path, and ongoing state. Only first binding or the dormant/awakening states use the chamber anchor; + repeated 40-tick source checks do not reapply an unchanged lifecycle, including after entity reload. + `EarthGuardianEncounterData` persists `DORMANT`, `AWAKENING`, `ROAMING`, or `DEFEATED` by chamber + key, while the entity separately saves its ownership, bounds, awakening timer, vibration listener, + strongest remembered clue, and bounded material reserve. It is immovable, + portal-blocked, boss-bar-hidden, and indestructible in Stage 1. A Survival-player chamber visit + in Stage 2 begins a three-second awakening and reveals the boss bar. The resulting `ROAMING` + state runs a vanilla dynamic vibration listener and persists its strongest remembered player + clue. Direct damage, explosions/projectiles, block changes, container actions, ground impact, and + movement use descending weights; Minecraft's vibration tag, occlusion, travel, and careful-step + rules remain authoritative. The guardian patrols or pathfinds to the remembered position through + `EARTH_GUARDIAN` AI ownership without acquiring a sight target. + Investigation uses `RetoldBehaviorMovement.throttledMoveToExact` for owned navigation, + shared path budget, path reuse, and failure backoff, with at least 20 entity ticks between requests. + When navigation stops, `EarthGuardianRoute` prepares a loaded-only short walking segment: + three-wide clearance for the full body (four blocks tall horizontally, five on ramps), + one-block elevation steps with extended landings, and solid full-block support taken from the + existing reserve. Missing solid material can be excavated beside, never out of, the planned floor. + Excavation/support/backfill share at most 12 edits per ten-tick pulse. A full reserve backfills entity-clear + trailing air up to eight blocks behind and twelve above the current feet, covering the higher + tunnel left during descent. Large-mob path-node alignment must not shift each successive segment + sideways. Ramp direction/target height are serialized; short work segments are reconstructed + from actual position and revalidated if walking stops. Cleared vibration memory ends the work. + A changing vibration clue does not discard an unfinished segment: construction and walking + commit to its short landing, then choose the next segment using the latest remembered clue. + Otherwise ordinary moving footsteps repeatedly restart navigation at the tunnel entrance. + Backfill and wall placement exclude the entire active segment, including its floor. If residual + movement carries the guardian into an unplaced raised support, the next segment is rebuilt + from its actual feet instead of retrying a permanently occupied support cell. + The shared movement helper uses exact waypoints so the mob physically steps down past a ledge. + Patrol starts its selected path through `RetoldAiControl.withNavigationBypass`. Clues remain valid within the + listener radius even outside the persisted labyrinth bounds. While following one, the controller + batches existing one-edit primitives and stops immediately on a no-progress result, avoiding + repeated denied/unloaded scans within the pulse. `EarthGuardianWalls` uses spare pulse budget + for a supported 3×3 trailing wall, three to six blocks behind the committed travel direction, + no more often than every forty ticks. It requires at least 18 stored states, spends only + full-collision states, and checks every cell's placement policy and entity clearance. Walls + are deferred until the active walking segment is ready and at least nine edits remain in the + shared pulse budget. There is deliberately no excavation whitelist, ownership/provenance check, block + entity exclusion, hardness check, or labyrinth boundary: player builds, mechanisms, containers, + fluids, and normally indestructible states are valid. Excavation retains the exact `BlockState` in + a 128-block entity-persisted reserve and placement consumes it, preventing unlimited material + creation; block-entity NBT is not retained, so relocated containers are newly empty instances. + Fluid-bearing states are explicitly replaced with air during excavation, rather than using + vanilla destruction, which preserves contained fluid and cannot remove a lava source. This + lets route repair clear eruption pools; source, flowing, and waterlogged states enter the + reserve whole. Ordinary dry blocks retain the existing destruction path. Neither branch + bypasses mutation protection or grants fire immunity. + Placement still rejects an occupied cell. Every edit passes `RetoldMobGriefing` plus + `RetoldWorldProtection`, preserving server-owner and claim-integration authority. The guardian + becomes damageable on entering `ROAMING`. `EarthGuardianMelee` supplies contact strikes against + only the remembered player: loaded entity UUID lookup, Survival/alive/same-level checks, + vanilla melee reach, administrative AI ownership, and a fresh budgeted wall check gate the + existing Iron Golem damage/animation. Contact checks run every five ticks and strike attempts + have a saved 30-tick cooldown. No live mob target is assigned. Investigation speed is 1.4 + (previously 1.05), with a 1.2-block clue-arrival threshold that stops movement without erasing + contact memory; normal clue expiry still applies. Remembered + clues within 24 blocks can begin a persisted + 30-tick warning at a fixed floor position. The persisted rotation converts up to five + protected-safe ceiling blocks with clear vertical fall paths into damaging `FallingBlockEntity` + debris or replaces up to nine loaded non-air blocks in a 3×3 supporting layer beneath the locked + target with real lava sources. Each replacement checks both break and place protection before + using normal block updates. Sources persist; Minecraft owns fluid flow, contact damage, and fire, + with no scripted damage, ignition, launch, or lava-particle burst. Subsequent vanilla fluid spread + has no guardian attribution. The third attack removes a 3×3 patch up to four blocks deep, + creating a permanent pit with ordinary falling and landing damage. Each column stops at a denied + block; at most 36 loaded blocks are removed without drops, independently of the relocation reserve. + After the pit the rotation returns to ceiling collapse; old saved lava-preference flags migrate to + the equivalent next attack, and existing pending attack ids remain valid. + Dust at the selected overhead blocks communicates the ceiling collapse; a collapse without valid, + unobstructed ceiling material falls back to lava. The windup preserves pursuit and contact melee but pauses terrain edits, + and it never assigns a sight target. Lodestone supplies the now-required Earth offering. - Normal survival reaches Stage 3 through the currently implemented Water, Air, Life, and Death paths. @@ -408,6 +521,21 @@ Current behavior: - Breezes spawn on the island/tower at runtime and are immune to the temple wind. - The Gale Core spawns near the tower top and drops a Heavy Core on death. +Client presentation uses `GaleCoreModel`, a `BreezeModel` subclass with the installed base geometry, +texture and keyframe animations. `GaleCoreDetailLayer` uses installed `BREEZE_WIND`/`BREEZE_EYES` +layers and vanilla wind/eye render types. `GaleCoreArmorModel` replaces the ordinary rods with four +thin original plates and a shallow pale circlet, using a separate 32x32 atlas registered through +`RetoldClientEvents.GALE_CORE_ARMOR_LAYER`. It poses its own Breeze model so deferred submission +order cannot change its transforms. Plates follow breathing and shooting poses. + +`GaleCoreRenderer` resolves installed `Blocks.HEAVY_CORE` into `GaleCoreRenderState.heavyCore`; +`GaleCoreHeavyCoreLayer` applies the animated body and center anchor before converting living-model +coordinates to block coordinates and submitting the installed block layers. The core follows the +rods' breathing height without their yaw spin. Breeze textures and Heavy Core block models retain +normal resource-pack resolution and render-layer behavior. Original art/source records are in +[`ASSET_CREDITS.md`](../../ASSET_CREDITS.md). Connected-world appearance, translucency and final +visual acceptance remain pending developer review. + Gale Core state: - Custom large Breeze-like entity with a boss bar. @@ -480,6 +608,7 @@ Access behavior: Generation behavior: - Aender uses a custom chunk generator. +- Material faces (grass, soil, stone, bark, leaves, and ore) use static 16x16 textures with no animation metadata, following the developer clarification on 2026-10-12. Their original inverted-world palettes and vanilla-scale detail are maintained in the asset prompt record; the runtime portal sprite is a separate effect. - Terrain is floating-island based. - Chunks are generated from sampled island data. - Fresh worlds select generator V3. It retains V2's merged vertical island intervals and chunk-halo decorations, then assigns a deterministic biome to each island in three dimensions. @@ -1374,6 +1503,25 @@ Design rule: Monument defense is a purpose system, not ordinary animal AI. Guardian/elder guardian special behavior should be preserved. +## Boss Presentation + +`RetoldClientEvents` registers original `EARTH_GUARDIAN_LAYER` and `GALE_CORE_LAYER` meshes. +`EarthGuardianModel` consumes `EarthGuardianRenderState`, the synchronized lifecycle and melee +attack ticks. `EarthGuardian.AWAKENING_TICKS` synchronizes the remaining server countdown through +the existing entity-data channel. `awakeningProgress(partialTick)` interpolates it for the model; +late observers use the remaining encounter time rather than restarting a client clock. The saved +server countdown and 60-tick duration are unchanged. Lifecycle decisions and persistence remain +server-owned. Earth/Gale renderers expand their culling bounds to include raised arms, wind and +floating plates. + +The `clientModelTest` source set under `src/testClient/java` provides `RetoldBossModelChecks`. +The `validateBossModels` Gradle task bakes actual model layers and checks poses, UV bounds, +silhouettes and independent armor/core transforms without a game window or graphics device. +It runs as part of `check`/`build`. Resource contracts have separate JUnit coverage in +`RetoldAssetResourcesTest`; neither check depends on ignored generation artifacts. Exact results +and visual limitations are recorded in [`testing_strategy.md`](testing_strategy.md#asset-and-boss-presentation-checks). +Final visual approval remains pending. + ## Aender Eye Entity Technical owners: @@ -1390,7 +1538,7 @@ Entity: Behavior: - Custom ambient entity type with registered attributes/spawn placement. -- Client renderer handles visual presentation. +- Client renderer directly uses the installed `minecraft:textures/item/ender_eye.png` texture as an emissive billboard, including resource-pack texture replacements. No dedicated Retold Eye sprite is packaged. Design rule: @@ -1491,6 +1639,8 @@ Technical owner: - `RetoldCommands` - `RetoldCommandEvents` +- `command/showcase/RetoldShowcaseWorld` +- `command/showcase/RetoldShowcaseEntities` - `RetoldBehaviorDebugEvents` Commands: @@ -1500,11 +1650,33 @@ Commands: /retold stage set <1-3> /retold sky get /retold sky randomize +/retold testworld [ ] /retoldbehavior ... ``` `/retold` is for general mod progression/debug controls. +`/retold testworld` is player-only Overworld developer instrumentation under the existing level-2 +permission gate. `RetoldShowcaseWorld` reads the live Retold item/block/entity registries, plans an +aerial content gallery, validates its entire empty volume plus per-position world and portal +permissions, and then places supported exhibits, supplies, Steel armor stands, and workstations. +It teleports the executing player to the entrance without changing stage, game mode, or game rules. +The default footprint is centered on the player's horizontal position, at `level.getMaxY() - 18`. +Explicit coordinates choose the minimum platform corner. Every footprint chunk must have its +entity sections actually loaded and ticking before occupancy is accepted; incomplete activation +rejects without edits or teleportation and asks the player to stay near the center and retry. +The one-shot command adds no persistent tickets or queued build jobs. No existing gallery or terrain is cleared. +See [`../test-world.md`](../test-world.md) for use and scope. + +`RetoldShowcaseEntities` gives exhibits the persisted `retold.showcase` entity tag, invulnerability, +and persistence, skipping spawn finalization so boss escorts/encounters are not created. +`RetoldCommandEvents` cancels server `EntityTickEvent.Pre` only for tagged exhibits, also suppressing +their Post dispatchers; NoAI alone cannot stop Gale Core's direct movement or Guardian encounter +ticks. Tagged mobs alone receive `MobDespawnEvent.DENY` so Peaceful does not remove them before Pre. +This static developer display is outside the ordinary mob behavior pipeline; normal entities retain +their existing ticks and despawn policy. Client rendering continues, and the live portal remains +functional. The gallery does not establish natural AI, progression, structure, or visual approval. + `/retoldbehavior` is for AI and territory debugging; see the AI doc. ## Mixins diff --git a/docs/internal/retold_roadmap.md b/docs/internal/retold_roadmap.md index 1de95c6f..bddb2428 100644 --- a/docs/internal/retold_roadmap.md +++ b/docs/internal/retold_roadmap.md @@ -9,6 +9,7 @@ Retold is still built around: - three world stages - four classical element paths plus Life and Death, with all six sacrifices completable in any order - Aender replacing normal late End access while vanilla End remains command-accessible +- static Aender material block textures with vanilla-scale detail and the original inverted-world color families: purple vegetation, blue soil/bark and desert stone, and cool stone; grass sides use organic fringes rather than straight bands (clarified 2026-10-12) - horizontal Aender portals using implemented 8:1 Overworld/Aender travel scaling - elytra remaining as an item but not being survival-obtainable through End Cities - recipe knowledge and villager teaching instead of a vanilla-style recipe-book restore @@ -30,6 +31,26 @@ Retold is still built around: colored nylium and rare fungal landmarks instead of dense trees and undergrowth - beds not skipping night - rain extinguishing normal torches +- every newly generated Jungle Pyramid containing a deterministic randomized two-level Earth + Labyrinth reached through its lever-puzzle room, while already-generated pyramids remain untouched +- the Earth Guardian beginning as an indestructible Stage 1 statue, awakening on a Stage 2 chamber + visit, sensing players through vibrations, roaming the maze, and permanently relocating any + loaded block—including player blocks, block entities, Bedrock, and terrain outside the labyrinth— + to open paths and build defenses; only administrative griefing/protection policy may deny edits; + once awake it becomes damageable and attacks remembered positions through a telegraphed ceiling + collapse, a persistent 3×3 pool of real lava replacing the ground beneath the marked position, + or a 3×3 floor collapse up to four blocks deep with ordinary fall damage, + without acquiring a sight target (floor-to-lava direction confirmed 2026-09-07) +- labyrinth side rooms containing traps, some treasure, and naturally spawning mobs in darkness, + without dedicated spawners; the Earth Guardian drops Lodestone as the Earth egg sacrifice + (confirmed 2026-09-07), with ordinary recipe/chest acquisition removed +- the full-sized Earth Guardian carving its own traversable tunnels and physical ramps between + floors rather than relying on boss-sized pregenerated stairs (confirmed 2026-09-07) +- faster multi-block tunnel excavation and deliberate wall building from relocated material + (confirmed 2026-09-08), superseding the initial one-block-per-second implementation +- the Earth Guardian pursuing more aggressively into close-range melee while retaining its + environmental attacks (confirmed 2026-09-08); this supersedes the earlier environment-only + attack restriction, not vibration-based tracking or administrative protection rules ## High Priority @@ -40,10 +61,13 @@ These are the strongest next design-aligned areas: torch-maintenance, and trade-stock loops in ordinary, multiplayer, dedicated-server, and existing villages; identify remaining coordination and survival gaps; then design and implement the next coherent village-society slice. -2. Finish the six-sacrifice Dragon Egg ritual after all paths are survival-obtainable. -3. Add the missing Earth item/challenge path; verify and tune the initial roaming Wildfire Fire - path, implemented Life and Death acquisition boundaries, cartographer Air Temple discovery map, - and Air Temple/Gale Core path. +2. Verify the newly completed six-sacrifice Dragon Egg gate in fresh, upgraded, and multiplayer worlds. +3. Complete the missing Earth path from its generated labyrinth and persisted vibration-investigating, + terrain-relocating guardian: verify and tune its initial arrow-trap/treasure side rooms, + environmental hazards, Lodestone reward, and natural dark-area spawning. Also + naturally verify the maze across seeds, borders, and upgraded worlds, and verify and tune the + initial roaming Wildfire Fire path, implemented Life and Death acquisition boundaries, + cartographer Air Temple discovery map, and Air Temple/Gale Core path. 4. Decide whether Stage 1 needs Wither/Nether star End portal activation. 5. Add remaining Aender in-dimension teleportation and late-game travel/building rewards. 6. Replace the provisional `dev_aender_portal_frame` name/assets when the final portal-frame design is chosen. @@ -346,7 +370,8 @@ These areas are not finished forever, but the current direction is acceptable fo Do not implement these without asking the developer first: - Stage 1 Wither/Nether star requirement before End access -- jungle/desert pyramids as boss tombs +- Desert Pyramids or additional pyramid boss tombs beyond the confirmed Jungle Pyramid Earth + Labyrinth - Nether dragon role in the ending - Aender dragon role in the ending - New Game+ / world ending ideas @@ -365,6 +390,16 @@ Do not add these unless the developer changes direction: - removal of Trail Ruins; they should remain part of normal world generation - removal of fossils; they should remain part of normal world generation +## Equipment And Boss Art Direction + +The approved custom-art scope covers Steel equipment, Nether Reactor Core, Earth Guardian, Gale +Core and Flint tools. Original development sprites, armor atlases and boss geometry are installed +for review. Aender Eye uses the installed vanilla Eye of Ender appearance at developer direction; +it does not need a dedicated Retold sprite. Earth Guardian remains a blind weathered statue. Gale Core retains the installed +Breeze head, glowing face, wind and animations with a visible Heavy Core, shallow pale circlet +and four thin floating plates. Final creative approval and natural encounter tuning remain open. +Source records and historical credits are in [`ASSET_CREDITS.md`](../../ASSET_CREDITS.md). + ## Roadmap Maintenance Update this file when: diff --git a/docs/internal/testing_strategy.md b/docs/internal/testing_strategy.md index 6ebd6431..8251da7f 100644 --- a/docs/internal/testing_strategy.md +++ b/docs/internal/testing_strategy.md @@ -45,8 +45,109 @@ visual scenarios to the developer. `./gradlew build` runs compilation, JUnit tests, PMD, and assembly; it does not run NeoForge GameTests. It is the normal final code-quality check, not something to repeat after every edit. +## Asset And Boss Presentation Checks + +The 2026-10-23 revision retains development status for the Aender/equipment/boss artwork. Exact +source-to-output mappings are in +[`retold_asset_revision_2026-10-23.json`](retold_asset_revision_2026-10-23.json), with authorship and +the offline review image in [`ASSET_CREDITS.md`](../../ASSET_CREDITS.md). + +`validateBossModels` bakes the actual Earth/Gale layers from `src/testClient/java` without starting +Minecraft or a graphics device. It checks synchronized awakening poses, pose resets, finite geometry, +UV bounds, model extent against culling allowances, Breeze keyframe compatibility, and independent +armor/Heavy Core transforms. Guardian bounds are checked at ten melee poses across eight yaw angles +so raised arms fit the horizontal allowance while turning. It is wired into Gradle `check`, so the +normal build also runs it. + +`RetoldAssetResourcesTest` covers packaged local references, Steel adult/leggings/baby UV coverage, +native texture dimensions/binary alpha, static metadata removal, and spear display contexts. +These checks use repository resources and installed classes, never ignored `output/` sources. +Aender Eye directly samples installed `minecraft:textures/item/ender_eye.png` on its full-bright +billboard; check the vanilla texture and resource-pack replacements in the developer visual pass. + +The following commands passed during the 2026-10-23 presentation work. After the Steel/Guardian +material polish and replacement of the custom Eye sprite with the vanilla texture, the focused +resource selector and full build were rerun. The two server selectors cover unchanged lifecycle +and material rules and were not repeated for this final texture-only polish. + +```bash +bash ./gradlew validateBossModels +bash ./gradlew test --tests 'cz.xefensor.retold.client.assets.RetoldAssetResourcesTest' +bash ./gradlew runGameTestServer --args="net.neoforged.fml.startup.GameTestServer --tests retold:earth_guardian_foundation_spawns_and_persists_lifecycle" +bash ./gradlew runGameTestServer --args="net.neoforged.fml.startup.GameTestServer --tests retold:tool_progression_harvest_rules_enforce_material_ladder" +bash ./gradlew build +``` + +The resource selector passed all four JUnit tests. The exact Earth lifecycle selector passed 1/1, +including saved half-awakening, encounter rebinding, and interpolated synchronized progress. +The exact Steel material-ladder selector passed 1/1. The final polished-resource build passed +compilation, all 102 JUnit tests with no failures/errors/skips, `pmdMain`, `pmdTest`, +`pmdClientModelTest`, `validateBossModels`, and assembly. Package inspection of +`build/libs/retold-0.4.0.jar` confirmed all 65 Retold PNGs match their source bytes, including all +nine active revision PNGs with matching provenance hashes and dimensions. No custom Eye sprite, +local output artifacts, or client-model test code is packaged. Steel's adult, leggings, and baby +alpha masks remain identical to the previous revision; the polished atlases use at most seven +opaque colors. The Guardian atlas uses six colors from a seven-color material palette. These +are resource/packing checks, not visual approval. The server fixture does not connect a rendering +client or establish real late-join packet delivery. + +No client startup, connected-client rendering, multiplayer, shader/resource-pack check, or subjective +visual test was performed for this revision. The tracked review image renders original Retold +meshes/textures offline; it contains no extracted vanilla pixels and is not a game screenshot. +Developer visual review remains required for tiling/cutouts, equipment scale and trims, boss poses, +Gale translucency and Heavy Core presentation, lighting, resource reload and late joins. AI agents +must not operate the game client or desktop UI to supply that subjective review. + ## Focused GameTests +For the developer content gallery, run these exact selectors separately, followed by one build: + +```bash +bash ./gradlew runGameTestServer --args="net.neoforged.fml.startup.GameTestServer --tests retold:showcase_contains_live_registry_and_stable_exhibits" +bash ./gradlew runGameTestServer --args="net.neoforged.fml.startup.GameTestServer --tests retold:showcase_rejects_occupied_and_protected_volume_without_edits" +bash ./gradlew runGameTestServer --args="net.neoforged.fml.startup.GameTestServer --tests retold:loaded_mob_ai_work_remains_bounded" +bash ./gradlew build +``` + +These cover the live catalog/supporting placements, persistent passive exhibits, and rejection +before edits. They do not replace connected-client visual review, a real save/reload, multiplayer, +or natural boss/progression tests. Use [`../test-world.md`](../test-world.md) for the manual gallery +entry point. No broad mob TPS matrix is required for this developer-only tagged exhibit path. +The exact `loaded_mob_ai_work_remains_bounded` selector supplies a representative 256-mob shared-work +regression because the constant-time exhibit-tag check in `EntityTickEvent.Pre` also runs for ordinary +untagged entities. This scoped global-hook check does not justify a complete per-mob TPS matrix. +On 2026-10-23, both exact gallery selectors passed 1/1 on the final implementation. The catalog test +checks all 52 items, 37 blocks, and six entity types, supporting placements, armor, 30 ticks of frozen +exhibits, and saved exhibit tags. The rejection test covers occupied blocks, protection denial, +preservation of an ordinary Cow, and unready remote entity sections without gallery edits. +The exact shared-work selector passed 1/1 with 256 mobs over 200 ticks, averaging 17.548 ms per tick +and satisfying its work budgets. The final `bash ./gradlew build` passed JUnit, all PMD checks, +`validateBossModels`, and assembly; `build/libs/retold-0.4.0.jar` contains the new showcase helpers. +No client/desktop UI was operated. Connected-client visuals, multiplayer, and an actual world +save/reload remain unverified. + +For Earth Guardian pursuit with real maze geometry and simultaneous terrain combat, use +`retold:earth_guardian_pursues_into_generated_maze`. It embeds the production-generated lower +maze in host stone, moves a mock Survival source along a walkable generated route, dispatches +real `STEP` events, and runs forty-tick encounter repair with griefing and environmental attacks +enabled. It requires the guardian to move beyond the central arena toward the player after +observing a real lava eruption on the trail. No direct vibration injection, protected attack pad, +guardian teleport assistance, or fire immunity is used. Failure diagnostics include the blocking state. +On 2026-09-08 this failed twice before the fluid fix at 2,400 ticks on an unchanged lava source, +then passed after whole-state fluid removal; the final strengthened run completed at guardian +tick 239, approximately 19.1 blocks from center, with `lavaSeen=true`. +The exact `retold:earth_guardian_relocates_fluids_without_stalling` selector also passed, covering +source water/lava, flowing lava, waterlogged slabs, empty-source duplicate prevention, +exact-state spending, protection denial, and disabled griefing. +Both selectors were run individually with +`bash ./gradlew runGameTestServer --args="net.neoforged.fml.startup.GameTestServer --tests retold:"`. +This is real Minecraft server gameplay with a mock event source, not a connected-client, +subjective visual, natural multi-seed, upper-floor, existing-world, or multiplayer playtest. +No TPS rerun is required for this local mutation fix: cadence, scans, navigation requests, and +budgets are unchanged, and the existing griefing-disabled benchmark would not exercise it. +The pass also completed `bash ./gradlew build` (compilation, JUnit, PMD, assembly) and +`git diff --check` successfully. + Use the exact `retold:` test ID for the changed contract. For example: ```bash @@ -80,14 +181,133 @@ implementer records the exact GameTest command and result for the change before For Dragon Egg ritual changes, select the exact contract affected: `retold:world_data_tracks_ritual_progress` covers distinct offering bits and the current hatch -threshold; `retold:dragon_egg_accepts_final_and_legacy_offerings` covers the four active item -identities, Survival consumption, duplicate rejection, and upgraded-world aliases; +threshold; `retold:dragon_egg_accepts_final_and_legacy_offerings` covers all six item +identities, Survival consumption, duplicate rejection, upgraded-world aliases, and actual hatching; +`retold:lodestone_is_exclusive_to_earth_guardian` covers real boss-death loot, recipe removal, and +both vanilla chest bypasses; `retold:gale_core_drops_heavy_core` and `retold:elder_guardian_drops_heart_of_the_sea` cover the two implemented guardian rewards; and `retold:buried_treasure_excludes_heart_of_the_sea` covers the removed alternative acquisition route. Run only the exact changed contracts, then verify a real Stage 2 egg interaction in-game when the hatch threshold, crack presentation, or Stage 3 transition flow changes. +For Earth side-room changes, run `EarthLabyrinthRoomsTest` and the exact +`retold:earth_rooms_keep_loot_and_fire_across_chunk_border` integration test. Generation placement +changes also need `retold:earth_labyrinth_piece_places_connected_maze_geometry`; saved content +version changes need `retold:earth_labyrinth_pieces_round_trip_without_upgrading_old_pyramids`. +These cover deterministic side branches, container/no-refill rules, real redstone firing across a +chunk boundary, generated room placement, and old-start version retention. They do not establish +natural spawn rates, full multi-seed chunked worldgen, balance, or visual approval. Generation-only +content and death-time loot do not require a per-mob TPS rerun. + +The 2026-09-07 room/reward pass ran each following ID individually with +`bash ./gradlew runGameTestServer --args="net.neoforged.fml.startup.GameTestServer --tests retold:"`; +all six exact tests passed: + +- `lodestone_is_exclusive_to_earth_guardian` +- `earth_rooms_keep_loot_and_fire_across_chunk_border` +- `dragon_egg_accepts_final_and_legacy_offerings` +- `world_data_tracks_ritual_progress` +- `earth_labyrinth_pieces_round_trip_without_upgrading_old_pyramids` +- `earth_labyrinth_piece_places_connected_maze_geometry` + +`bash ./gradlew test --tests "cz.xefensor.retold.worldgen.earth.EarthLabyrinthRoomsTest"` also passed +512 deterministic room-selection seeds. Natural multi-seed/chunk-border worlds, natural mob rates, +dedicated multiplayer, upgraded-world end-to-end completion, lava-exposed reward retrieval, and +subjective visuals were not verified by these automated fixtures. +The final `bash ./gradlew build` passed compilation, the full JUnit task, PMD, and assembly; +`git diff --check` passed. No client/desktop visual test or unrelated TPS matrix was run. + +For Earth Guardian excavation/ramp changes, run each changed contract separately: +`retold:earth_guardian_batches_excavation_with_protection` verifies a full twelve-block slice, +the ten-tick pulse guard, Bedrock excavation, mid-pulse denial, and griefing denial. +`retold:earth_guardian_builds_conserved_trailing_walls` verifies the production wall trigger, +3×3 geometry, exact state consumption, the forty-tick cooldown, griefing, protected cells, +and occupied-cell rejection. Batch/backfill/wall changes also require the exact ascent and descent +selectors because walls must preserve the active stair workspace and support placement must +recover if movement drift occupies the next step. Run the moving-footstep tunnel selector for +pursuit integration and the single guardian TPS selector for cadence/search-cost changes. +The 2026-09-08 batch/wall policy selectors passed individually. The ascent selector exposed a +real occupied-support stall, then passed after actual-feet replanning. One initial descent run +timed out with a healthy entity already removed; two subsequent exact reruns passed without a +removal-behavior change. Temporary tracing in the second rerun showed only normal successful-test +cleanup and was removed afterward. The earlier removal cause remains unestablished; do not claim +an in-world death/despawn fix or fully established long-session traversal reliability from this pass. +The final moving-footstep tunnel selector also passed, as did the exact 50-guardian TPS selector +(7.281 ms/tick peak, 20 TPS in all five phases). Each selector was run separately with +`bash ./gradlew runGameTestServer --args="net.neoforged.fml.startup.GameTestServer --tests retold:"`. +No complete GameTest suite or unrelated TPS species was selected. The griefing-disabled TPS +fixture does not establish the cost of many simultaneous mutation bursts or wall physics. +The batch/wall pass also passed `bash ./gradlew build` (compilation, JUnit, PMD, assembly) +and `git diff --check`. No connected-client, multiplayer, natural-world, or subjective visual +verification was performed. + +`retold:earth_guardian_follows_real_steps_into_tunnel` covers a moving mock Survival player using +actual `level.gameEvent` footstep dispatch, dynamic listener registration, vibration travel, and +full-sized pursuit/ceiling excavation through a three-block-high tunnel. It does not call the +guardian's vibration callback directly. The destination is protected from block mutation while +attack windups remain enabled. The exact selector failed before the moving-clue fix at 2,000 ticks +and passed afterward on 2026-09-07. This fixture is not a connected-client or natural maze test. +The exact `retold:mob_tps_earth_guardian` rerun also passed, peaking at 9.649 ms/tick with 50 +subjects and 20 TPS in all five phases; no unrelated selectors or full matrix were run. +The moving-clue pass also passed `bash ./gradlew build` (compilation, JUnit, PMD, assembly) +and `git diff --check`. + +For fixed-clue body clearance, elevation, and mutation policy, use: +`retold:earth_guardian_carves_low_tunnel`, `retold:earth_guardian_carves_ascending_ramp`, +`retold:earth_guardian_carves_descending_ramp`, and +`retold:earth_guardian_ramp_conserves_and_respects_protection`. The traversal fixtures use real +server entity ticks and a continuously refreshed synthetic vibration; ascent/descent cover the +full fourteen-block floor separation but protect an off-route attack pad to isolate locomotion. +The policy test checks independent break/place denial, a mid-construction griefing change, exact +support-state reuse, the 128-state cap/reload, and saved ramp heading. It does not prove a natural +mid-climb reload, real-player vibration dispatch, idle cross-floor patrol, or combined combat. +Run `retold:mob_tps_earth_guardian` for repeated search/navigation changes; that baseline still +disables griefing, so it does not profile fully occupied reserves, active excavation/backfill, +or long-session fluid spread. No unrelated species matrix is warranted. + +The 2026-09-07 traversal pass runs those four exact IDs individually with the same +`bash ./gradlew runGameTestServer --args="net.neoforged.fml.startup.GameTestServer --tests retold:"` +command. The final ramp fixtures reserve enough entity-ticking chunk rings for their full footprint; +merely loaded chunks had left a healthy guardian unticked near the far landing in an earlier fixture. +Protected attack pads are intentional isolation, not evidence of guardian fire/lava immunity. +All four exact traversal/policy IDs passed, as did the exact 50-guardian TPS selector, with a +7.302 ms/tick peak and 20 TPS in all five phases. Natural combined combat, traversal pacing, +dedicated multiplayer, and subjective visual approval remain unverified. +The traversal pass also completed `bash ./gradlew build` (JUnit, PMD, compilation, assembly) and +`git diff --check` successfully. + +For Earth Guardian source-repair changes, use the exact +`retold:earth_guardian_foundation_spawns_and_persists_lifecycle` test for initial placement, +stationary anchoring, uninterrupted awakening, repeated roaming repair, entity-state preservation, +reload rebinding, and defeated suppression. Use +`retold:earth_guardian_physically_investigates_vibrations` for real pursuit crossing a 40-tick +repair without moving the entity or replacing its path/owner. Both were run individually with +`bash ./gradlew runGameTestServer --args="net.neoforged.fml.startup.GameTestServer --tests retold:"` +on 2026-09-07 and passed after the center-teleport fix; the extended foundation test first failed +against the unconditional chamber placement. This fix changes neither scan cadence nor search +scope, so no TPS rerun is warranted. Natural dungeon pursuit, actual chunk unload/reload, and +connected multiplayer remain unverified; reload coverage directly restores entity state. +The source-repair pass also passed `bash ./gradlew build` (compilation, JUnit, PMD, assembly) +and `git diff --check`. + +For Earth Guardian melee-plus-environmental combat, use the exact +`retold:earth_guardian_melee_respects_contact_and_cooldown` selector for heard-source, player-mode, +reach, fresh-wall, real-damage, cooldown/save-load, and dormant-state guards. Use +`retold:earth_guardian_pursues_during_hazards_and_melees` for real-tick approach during the 30-tick +warning, released ceiling debris, and automatic melee damage in the same encounter. The fixture +waits for physical navigation readiness after chunk preparation; test time is not entity time. +Its mock player has a synthetic packet listener with vanilla client-loading invulnerability cleared, +not a connected client. Changed pursuit speed/arrival and warning movement also warrant the exact +moving-footstep tunnel regression and the single `retold:mob_tps_earth_guardian` selector. These +do not establish natural combined balance, multiplayer, subjective strike presentation, or lava safety. +On 2026-09-08 the two combat selectors and the moving-footstep tunnel selector passed individually +using `bash ./gradlew runGameTestServer --args="net.neoforged.fml.startup.GameTestServer --tests retold:"`. +The exact 50-guardian TPS run also passed all five phases at 20 TPS, peaking at 13.915 ms/tick. +It disables griefing and does not measure fifty simultaneous close-player melee strikes. +The combat pass also passed `bash ./gradlew build` (compilation, JUnit, PMD, assembly) and +`git diff --check`. No game client, connected multiplayer, or subjective visual checks were run. + For the Fire path, `retold:wildfire_uses_independent_stage_two_spawner` covers the dedicated Stage 2 Nether owner, ordinary-monster-cap independence, and normal placement boundary; `retold:wildfire_targets_undead_and_drops_fire_artifact` covers boss-tier attributes, @@ -508,6 +728,72 @@ path at a deterministic successful candidate, verifies that no Dried Ghast is ge confirms that the block itself remains placeable. This narrow worldgen hook does not justify mob or TPS selectors; naturally verify fresh Nether fossils across multiple seeds. +For the pure Earth Labyrinth topology, run the JUnit +`cz.xefensor.retold.worldgen.earth.EarthLabyrinthPlannerTest`. It samples deterministic layout +variation and requires 512 seeds to keep both levels, every cell, and the guardian chamber reachable +from the fixed entrance, with four or five arena-safe stairs, loops, adjacent unique passages, and +the intended 77- or 101-block footprint; it also guards stable world/structure-position seed +derivation. Run the +exact `retold:jungle_pyramids_use_earth_labyrinth_structure`, +`retold:earth_labyrinth_pieces_round_trip_without_upgrading_old_pyramids`, +`retold:earth_labyrinth_staircase_leaves_puzzle_room_safely`, and +`retold:earth_labyrinth_piece_places_connected_maze_geometry` GameTests for registry replacement, +new/old serialized-piece compatibility, safe lever-room egress, and representative placed cavern, +tunnel interior/shell, ladder, entrance geometry, and the huge guardian arena's 31-block core and +ten-block vertical clearance. +These tests do not prove natural placement. Verify multiple +fresh seeds, both footprint sizes, all pyramid orientations, height extremes, chunk borders, caves, +neighboring structures, and an upgraded-world pyramid before describing world generation as fully +verified. Run exact `retold:earth_guardian_foundation_spawns_and_persists_lifecycle` for guardian +registration/spawn-egg mapping, structure ownership, duplicate repair, Stage 1 dormancy, Stage 2 +Survival-player awakening, entity save/load, authoritative encounter state, and the permanent +defeat boundary. This foundation deliberately does not test sensing, combat, or mutation. +Run exact `retold:earth_guardian_tracks_weighted_vibrations_without_sight` for accepted +Survival-player sources, weighted multiplayer clue replacement, direct-damage investigation, +absence of sight targeting, `EARTH_GUARDIAN` movement ownership, and remembered-clue save/load. +Vanilla vibration dispatch and particle networking cannot be exercised with clientless mock players; +verify real connected-player steps, sneaking, occlusion, projectiles, and simultaneous sources on a +dedicated server before describing the sensory path as fully verified. +Run exact `retold:earth_guardian_physically_investigates_vibrations` for actual movement toward a +remembered clue outside attack range with guardian ownership and no sight target. Run exact +`retold:earth_guardian_physically_patrols_maze` for physical idle patrol inside a bounded maze fixture. +These tests cover the production navigation handoff; complex generated routes and vertical links +still need natural-world verification. Changes to this path also select the exact guardian TPS case. +Run exact `retold:earth_guardian_uses_environmental_attacks` for rejected direct melee, the fixed-location 30-tick +warning, pending-hazard save/load, real protection-approved ceiling blocks with clear fall paths +becoming damaging falling debris, open-sky and obstructed-collapse fallback to lava, 3×3 floor +conversion including Bedrock and containers, independent break/place protection denial, griefing +disabled during windup, absence of scripted damage/ignition/launch, and no sight target. The synthetic +test drives the attack clock directly. Run exact +`retold:earth_guardian_ceiling_debris_hits_on_server_ticks` for ordinary entity ticking through the +full harmless warning and release, a target that moves after lock-on, physical falling-block travel, +and a real `minecraft:falling_block` damage source at the original location. Run exact +`retold:earth_guardian_lava_ground_burns_on_server_ticks` for real lava placement after the warning, +a victim sinking into the replaced floor and taking vanilla `minecraft:lava` damage, retained source +blocks, and safe ground after moving away from the locked patch. Run exact +`retold:earth_guardian_floor_collapse_causes_real_fall` for the bounded 3×3-by-four-block pit, +Bedrock/container removal, protected-column preservation, fixed target after moving away, +pending floor-warning save/load, legacy next-attack migration, and real `minecraft:fall` damage +on landing. The synthetic environmental test also checks the ceiling/lava/floor rotation and +disabling griefing during the floor warning. These tests do not establish +particle or sound readability, arena ceiling depletion, accumulated lava spread/fire or encounter +balance, connected-player networking, multiplayer, or claim-plugin integration. +Run exact `retold:earth_guardian_relocates_any_loaded_block` for the intentionally unrestricted +block policy. It proves that an outside-bound Chest/block entity and Bedrock are valid material, +that an outside vibration triggers excavation, that the exact block states pass through the +persisted 64-block reserve without duplication, and that independent `MOB_BREAK`/`MOB_PLACE` +protection denials remain authoritative. The synthetic fixture does not establish natural pursuit +cadence, maximum escape/destruction reach, fluid or unusual-state behavior, block-entity data loss, +many accumulated edits, client readability, multiplayer contention, or real claim-plugin behavior. +Verify those in a disposable generated world with `mobGriefing` both enabled and disabled before +describing unrestricted terrain shaping as naturally verified. +Run exact `retold:mob_tps_earth_guardian` when listener, memory, patrol, investigation, attack, or +terrain-edit cadence or work changes. The 50-active-guardian run passes all five phases below +50 ms/tick after adding the floor-collapse rotation, with a 10.104 ms/tick hunt/targeting peak on 2026-09-07. +Command-spawned guardians share the same terrain controller and bounded hazard checks, but this +benchmark disables `mobGriefing`: actual mutation and accumulated fluid-spread cost still need +separate natural-world profiling. + For sparse Nether forests, run the exact `retold:nether_forests_use_sparse_desert_vegetation` selector. It reads the modified biome registry, verifies that both forests replaced every targeted dense vanilla placement with the Retold sparse diff --git a/docs/klei-field-guide.md b/docs/klei-field-guide.md new file mode 100644 index 00000000..9f215f4e --- /dev/null +++ b/docs/klei-field-guide.md @@ -0,0 +1,280 @@ + + +

For Klei · A companion to your living-world video

+ +# Retold + +

A living-world field guide

+ +I've been working on a Minecraft mod called Retold. Your video, [How can we make Minecraft feel alive? (It isn’t structures)](https://www.youtube.com/watch?v=cBmt2FNP1Ug), made me want to share the parts you might enjoy playing with. + +Animals need food, remember places, and react to one another. They can consume the plants around them, move toward better feeding grounds, hunt, flee, and breed when their needs are met. I’m interested in what happens when those rules meet the place you build in. + +Retold also changes crafting, magic, villages, and progression. This guide starts with the ecology. You can try it immediately in a Creative playground, or start a Survival world and meet the systems as you go. + +### Three connections to your video + +| Your principle | Something to look for in Retold | +| --- | --- | +| **Sympathy** | Different diets, daily rhythms, homes, and senses give familiar animals reasons to act. | +| **Feedback loops** | Forage is eaten; food shortages can move a herd; births create more mouths to feed. | +| **Stewardship** | A reachable food supply and safety support breeding and make a place worth staying in. | + +This is an experiment with those kinds of interactions. There is no lichen-and-substrate succession system, and long-term ecosystem balance still needs more playtesting. + + + +### Pick a way in + +- **Start a Survival world:** [the opening changes, page 2](#getting-started). +- **Follow the ecology:** [food and ranges, page 3](#food-and-ranges). +- **Try things straight away:** [the playground, page 7](#playground). + +

Retold 0.5.0 alpha · Minecraft 26.2 · NeoForge 26.2.0.7-beta · Java 25
Guide checked against the bundled build on 13 November 2026.

+ + + +

02 / Start playing

+ +## The opening is different + +Use **Minecraft Java 26.2**, **NeoForge 26.2.0.7-beta**, and **Java 25**. Put **retold-0.5.0.jar** in the instance’s mods folder. It needs to be installed on both the server and every client for multiplayer. Start a fresh world; keep an existing save backed up before experimenting. + +For a quick look, make a **Creative world with cheats** and turn to page 7. For Survival, these are the changes most likely to catch you out. + +### From Flint to your first metal + +1. **Gather Sticks and Flint.** Leaves can drop supplemental Sticks; Gravel supplies Flint. Logs do not drop wood when harvested bare-handed. Wooden and Stone equipment recipes are removed. +2. **Make a Flint Multi-tool** in the inventory grid. It harvests Logs and ordinary exposed Copper Ore, but not Stone or Deepslate Copper. Make a Crafting Table once you have wood. +3. **Build a Campfire.** It needs no Coal and starts unlit. Right-click with bare Flint to light it, consuming one Flint in Survival. Cook eight Clay Balls into eight Bricks; four positions allow two batches of about thirty seconds each. +4. **Build the Brick Furnace** from eight Brick items. This is the renamed vanilla Smoker. With suitable fuel it smelts Copper, cooks food, and turns Logs into Charcoal. Make a Copper Pickaxe, then collect Cobblestone for a normal Furnace. + +
+ +
+ +**Flint Multi-tool · 2×2** + +```text +Flint Flint + · Stick +``` + +
+ +
+ +**Campfire · 3×3** + +```text + · Stick · +Stick · Stick + Log Log Log +``` + +
+ +
+ +**Brick Furnace · 3×3** + +```text +Brick Brick Brick +Brick · Brick +Brick Brick Brick +``` + +
+ +
+ +### Keep these rules in mind + +- **Copper → Iron → Steel → Diamond.** Copper is slow on Stone. Steel is needed for Deepslate and Diamond Ore; a fuelled Blast Furnace turns Iron Ingots into Steel. Diamond is fragile until enchanted. [Full equipment route and recipes](player-guide.md#2-your-first-days-and-equipment). +- **Beds set spawn but do not skip night by default.** Shelter and lighting still matter. Exposed torches can go out in rain or snow; cover them and relight them with Flint and Steel or a Fire Charge. +- **An empty recipe book does not block valid manual crafting** under ordinary settings. Learn through making things and Villager lessons. The full handbook has the recipe diagrams if you get stuck. + + + +

03 / Food changes where animals live

+ +## A pasture can run out + +A herd has a remembered feeding range. Animals graze, consume food, and return around that range. If hunger rises while usable forage is depleted, the herd can seek a better feeding ground. A suitable, accessible feeder near its range can make that move unnecessary. + + + +### Watch first, then change one thing + +Find a few Cows in a grassy area. Watch what they eat and where they return. Then provide a reachable Animal Feeder with Wheat. You are changing the food supply that helps hold their range in place. This is also a way to maintain animals without repeatedly holding out food to lead them around. + +A fence alone does not meet those needs. Desperate eligible land animals can break wooden fences and closed wooden gates. Hungry wild predators can breach the same barriers to reach prey. Cracking gives you a chance to notice; food and safety address the pressure behind it. + +### Give the right food in the right way + +| Animals | A useful starting point | +| --- | --- | +| Cows, Sheep, and other grazers | Reachable Wheat in a feeder, or suitable plants to graze. | +| Pigs, Chickens, and Rabbits | Suitable seeds or produce; their dropped-food diets are broader than vanilla breeding food. | +| Wolves | Suitable meat or fish; wild Wolves can also hunt prey. | +| Schooling fish | Maintain suitable aquatic plants. They do not use land-animal feeders. | + +Dropped food, feeder food, habitat forage, and the ordinary right-click interaction are distinct routes. A Cow can eat a dropped Carrot even though Wheat remains its familiar direct interaction. Some specialist forage represents browsing without removing a block; other meals consume real plants. + +### The Animal Feeder + +Craft a two-row U from five Planks: two in the corners of one row, with three directly below them. It holds one stack. **Right-click with suitable food** to insert one item; **sneak-right-click** to insert as much of the held stack as fits. Sneak-right-click with an empty hand to retrieve it. Leave a clear approach beside the trough. + + + + + +

04 / Care changes populations

+ +## Give them a reason to thrive + +Retold replaces instant item-triggered breeding with sustained care for supported animals. Feeding an adult relieves hunger. A pair can become ready to breed after both adults have remained well fed and safe for **five minutes at normal game speed**. + +
Food + safetyFive minutes of sustained satisfactionA ready pair can mate
+ +### What the pair needs + +- **Continuous food satisfaction.** A single meal is not a promise that they will remain fed for the whole preparation period. +- **No panic, damage, or active combat target.** A predator on the other side of a fence can still make the place unsuitable. +- **A compatible adult nearby.** Ready partners need to be within eight blocks and able to complete normal mating behavior. Babies and adults still on their age cooldown cannot start another birth. + +After a birth, the parents become hungrier and keep the normal age cooldown. More animals also mean more demand on the same pasture or feeder. Keeping the food supply working becomes an ongoing part of animal care. + +### A small experiment + +Put two adult Cows in a safe enclosure with an accessible Wheat feeder. Stay nearby so they remain active. Keep food available and watch for a birth after the satisfaction period and normal pairing time. If nothing happens, inspect food access and danger before adding more animals. + +You can observe naturally, or use the page 7 commands to start with both Cows well fed. That removes the initial hunger variable; it does not create instant breeding or bypass the five-minute preparation. + +### Where this differs from your Muskox proposal + +Retold does **not** impose a population-count cap on breeding. This build does not establish a special production bonus for open space, sunlight, or an ideal herd size. A crowded group can still breed if its other requirements are met. + +The present stewardship reward is a maintained population and a useful food source that can hold animals near their range. There is room to explore stronger positive rewards for good habitats. I would not describe the current system as a finished answer to humane farm design. + + + + + +

05 / Predators have needs

+ +## A hunt has a cause + +Wild Wolves, Foxes, Cats, and other supported predators have food needs and species-specific prey choices. A hungry Wolf can hunt Sheep, Rabbits, Chickens, or fish. Tamed Wolves and Cats do not start ordinary independent prey hunts. + +A successful eligible prey kill relieves the hunter’s hunger and clears its current hunt target. The hunter pauses to feed. Whether it hunts again depends on its remaining hunger and state; this is **not a fixed forty-minute post-kill cooldown**. + + + +### The prey changes the encounter too + +Prey can flee a nearby hungry predator before being hit. Damage and danger can spread panic through nearby companions. After flight, remembered homes and ranges help shape where animals regroup. + +The hunter uses sight, nearby audible activity, and short-range scent. It can search around clues and last-known positions instead of always knowing where prey is. Long or obstructed chases can tire an ordinary predator, slowing or ending its pursuit. + +These rules can interrupt one another. An animal that is fleeing may abandon a meal, and a hunter that is feeding may stop its pursuit. Observation is useful because the same animal can behave differently as its needs change. + +### Compare a fed Wolf and a hungry Wolf + +Use a wild adult Wolf with suitable prey in a disposable playground. Inspect it, then compare hunger 0 with hunger 50 using the page 7 commands. Avoid hitting it: retaliation is a separate reason to attack. Leave room for both pursuit and escape. + +Watching one kill does not demonstrate a balanced population. Watch what happens afterwards: whether hunger falls, the current target clears, the prey regroups, and the hunter finds another reason to act. + + + + + +

06 / Time and weather

+ +## Come back and look again + +Different species have different rhythms. Grazers tend to rest at night; Chickens return to their roost during inactive periods and rain. Ordinary predators also have active and resting periods. Hunger or danger can interrupt rest. + +A home is usually a remembered position, not a newly generated building. These places help explain why a creature returns somewhere after feeding or fleeing. + +### When you leave an area + +Animals in unloaded chunks are not continuously acting out every missed tick. When they return, Retold can reconcile up to **seven Minecraft days** of missed ecosystem time using the world’s clock. + +That catch-up can consume real food, advance eligible breeding preparation, resolve suitable wild predation, or relocate an eligible foodless group when a safe route exists. Closing a single-player save for a week does not itself advance that clock. This is also not general offline crop growth or a complete village economy. + +Named and tamed animals have a one-health floor against starvation during this catch-up. That protection does not make them immune to ordinary loaded starvation or attacks. + +### The environment reaches your base too + +
+Gameplay comparison in rain: three torches under an overhang remain lit, while three exposed torches to their right are extinguished. +
Rain and cover matter: sheltered torches remain lit beside exposed extinguished ones. Earlier development build, captured in game by Xefensor, 18 July 2026; this is not a capture of the bundled build.
+
+ +Cover ordinary, Soul, and Copper torches to keep weather off them. Relight extinguished ones with Flint and Steel or a Fire Charge. Beds do not skip night by default, so you can watch a place change through the day and night. + + + +

07 / A small playground

+ +## Three things to try + +Make a disposable **Creative world with cheats**, using ordinary active animals near ground level. Stay close so they keep ticking. Both Retold command roots require operator permission level 2. These are experiments; changing hunger deliberately is not a natural observation. + +### 1 / Maintain a breeding pair + +Use `/retoldbehavior sethunger 0` while looking at **each Cow in turn**. Give the two adults a safe enclosure and an accessible Wheat feeder. Keep food available and wait at least five minutes, then allow time for pairing. Compare with a second observation after changing access to food. Use `/retoldbehavior get` to see their current state. + +### 2 / Change the food supply + +Watch a Cow group’s range with `/retoldbehavior home`. In an open area, compare a depleted patch with an accessible nearby patch containing plenty of suitable forage. Look at a Cow and set hunger to **70** to make food pressure visible sooner. Then try a reachable Wheat feeder near the existing range. A move still requires a suitable destination and route; food somewhere beyond a barrier is not enough. + +### 3 / Compare a fed and hungry hunter + +Use a wild adult Wolf with suitable Sheep prey and space to move. Look at the Wolf and set hunger to **0**, then later **50**. Inspect its state, prey response, and hunger after a successful hunt. Do not attack it. Use a fresh subject if a previous fight or panic makes the comparison unclear. A chase or kill is conditional, not guaranteed on a timer. + +### Look at the animal, then type + +| Command | Use | +| --- | --- | +| `/retoldbehavior get` | Inspect the looked-at creature’s current state. | +| `/retoldbehavior home` | Inspect its remembered home or range. | +| `/retoldbehavior sethunger 0` | Make that creature well fed. | +| `/retoldbehavior sethunger 50` | Give it moderate hunger for a comparison. | +| `/retoldbehavior sethunger 70` | Increase food pressure for the range experiment. | + +Single-creature commands target the eligible mob you look at within roughly 24 blocks. **0 is well fed; 100 is starving.** Setting hunger does not clear every other state or stop future hunger changes. + + + + + +

08 / Explore further

+ +## There is more when you want it + +You do not need to finish a progression route to play with the ecology. If you want to keep going, these systems connect the world to the player in other ways. + +**Villages.** Villagers can use accessible communal food stores, Farmers can deposit surplus, and selected professions can tend livestock. Village-owned supplies and animals have property and reputation rules. The wider settlement economy is unfinished. [Handbook chapter 9](player-guide.md#9-living-with-villagers). + +**Recipe knowledge.** Show a professional Villager a finished item in the teaching panel and pay the displayed Emerald cost to learn a supported recipe. The sample is returned. Valid unknown recipes can still be crafted manually under ordinary settings. [Chapter 3](player-guide.md#3-learning-recipes-and-villager-lessons). + +**Enchanting.** Three-glyph inscriptions replace random table offers. Compare examples, experiment, or learn through completed enchanted-book transfers at an Anvil. Bookshelves do not increase table power. The handbook explains the interface without solving the alphabet. [Chapter 4](player-guide.md#4-enchanting-from-the-beginning). + +**Later progression — spoilers in the reference.** The dragon changes the world’s stage; further expeditions lead toward the Dragon Egg ritual and the Aender. This guide leaves the solutions in the full handbook. [Chapters 10–14](player-guide.md#10-the-three-world-stages). + +### What this build is still exploring + +- **Ecology:** long-term population balance, marginal food patches, dense groups, and behavior across varied natural terrain need broader playtesting. Local population loss is possible. +- **Stewardship:** there is no breeding population cap or finished habitat-quality production reward. This is a different approach from the Muskox system in your video. +- **Scope:** plant succession and substrate renewal are absent. Aender rewards and travel systems, broader village society, and parts of progression remain unfinished. +- **Verification:** old saves, multiplayer, dedicated servers, and complete natural progression still have gaps. Code and automated checks do not establish every natural encounter. + +### Reference and contact + +The package includes **Retold-Player-Guide.html** and **Retold-Player-Guide.pdf** for detailed recipes, diets, commands, troubleshooting, and progression spoilers. This is the 11 November 2026 development edition whose mechanics form the basis of 0.5.0. + +[Project and credits](https://github.com/xefensor/Retold) · [Issues](https://github.com/xefensor/Retold/issues) · [Discord](https://discord.gg/S3g98zEY8a) · [alex@alexejtusl.cz](mailto:alex@alexejtusl.cz) + +

I wanted to give you something you could poke at and play with. I hope you find an interaction here worth following.
— Xefensor

diff --git a/docs/media/aender-original-palette.png b/docs/media/aender-original-palette.png new file mode 100644 index 00000000..c554cb64 Binary files /dev/null and b/docs/media/aender-original-palette.png differ diff --git a/docs/media/asset-review-2026-10-23.png b/docs/media/asset-review-2026-10-23.png new file mode 100644 index 00000000..a74a4c7c Binary files /dev/null and b/docs/media/asset-review-2026-10-23.png differ diff --git a/docs/player-guide.md b/docs/player-guide.md new file mode 100644 index 00000000..f4b3b64b --- /dev/null +++ b/docs/player-guide.md @@ -0,0 +1,2632 @@ +# Retold Player Handbook + +**A beginner's journey and complete reference to the current mod** + +For the **0.4.0 development source**, targeting **Minecraft 26.2**, **NeoForge 26.2.0.7-beta**, and **Java 25**. Updated 11 November 2026. Older release JARs may contain fewer features. + +Start with Sticks and Flint, build your first home, learn recipes and magic, and discover a world whose creatures have needs and alliances. Defeat the dragon, complete six sacrifices, and prepare for the changing islands of the Aender. + +The opening chapters assume you are new to Retold and explain the Minecraft basics needed to follow along. Later chapters teach animal care, village life, territory, bosses, and dimension travel. The appendices provide recipe diagrams, lesson prices, trades, equipment values, content IDs, and practical troubleshooting. + +**Full progression and boss spoilers.** The solved enchanting alphabet and exact spell words are omitted. Retold is experimental; unfinished features and important current-build differences are identified where they affect your choices. + +## Contents + +- [1 Getting started](#1-getting-started) +- [2 Your first days and equipment](#2-your-first-days-and-equipment) +- [3 Learning recipes and Villager lessons](#3-learning-recipes-and-villager-lessons) +- [4 Enchanting from the beginning](#4-enchanting-from-the-beginning) +- [5 Keeping animals and pets](#5-keeping-animals-and-pets) +- [6 Understanding the living ecosystem](#6-understanding-the-living-ecosystem) +- [7 Creature field guide](#7-creature-field-guide) +- [8 Factions and territory](#8-factions-and-territory) +- [9 Living with Villagers](#9-living-with-villagers) +- [10 The three world stages](#10-the-three-world-stages) +- [11 Completing the Dragon Egg ritual](#11-completing-the-dragon-egg-ritual) +- [12 Structures and guardian expeditions](#12-structures-and-guardian-expeditions) +- [13 The Nether and the End](#13-the-nether-and-the-end) +- [14 Your first Aender expedition](#14-your-first-aender-expedition) +- [15 Other changes and experimental tools](#15-other-changes-and-experimental-tools) +- [16 Commands and server settings](#16-commands-and-server-settings) +- [17 Current build limits and unfinished work](#17-current-build-limits-and-unfinished-work) +- [Appendix A Recipes and processing](#appendix-a-recipes-and-processing) +- [Appendix B Villager lesson index](#appendix-b-villager-lesson-index) +- [Appendix C Equipment and trade reference](#appendix-c-equipment-and-trade-reference) +- [Appendix D Enchantment catalog without spell solutions](#appendix-d-enchantment-catalog-without-spell-solutions) +- [Appendix E Complete custom content catalog](#appendix-e-complete-custom-content-catalog) +- [Appendix F Troubleshooting](#appendix-f-troubleshooting) +- [Further reading and support](#further-reading-and-support) + +## 1 Getting started + +### What you are playing + +Minecraft is a game about exploring a block-built world, collecting materials, making equipment, and surviving its dangers. Retold is a mod for Minecraft Java Edition: it changes that game rather than replacing it with a separate application. When this handbook says **vanilla**, it means ordinary Minecraft without Retold's changes. + +Retold changes both your early survival routine and what happens after the Ender Dragon. You begin with primitive Flint equipment, learn recipes and magic, and live among creatures that respond to food, danger, and one another. Major achievements change the entire world's stage. The dragon fight opens a longer journey through six sacrifices and eventually the Aender dimension. + +You do not need to memorize this handbook before playing. Read this chapter and the opening walkthrough, then look up a system when you meet it. The later chapters reveal progression and boss mechanics. Exact enchanting words and the solved alphabet are deliberately omitted so that the language remains a discovery. + +### Install the matching version + +This edition describes the **0.4.0 development source** for **Minecraft 26.2**, **NeoForge 26.2.0.7-beta**, and **Java 25**. An older released Retold JAR may have fewer features. Use the version supplied with the mod rather than assuming any Minecraft or loader release will work. + +1. Create or choose a Minecraft Java instance using the matching NeoForge loader. An instance is a separate game installation with its own mods and settings. +2. Put the Retold JAR in that instance's `mods` folder. Keep it as a JAR; do not unpack it into loose files. +3. Start the NeoForge instance. Make a new **Survival** world for the most consistent introduction to progression. +4. For multiplayer, install the same Retold version on the server and on every player's client. The server runs the shared world; a client is each player's game application. +5. Copy an existing world's save somewhere safe before adding or updating the mod. Newly generated terrain and already explored terrain can behave differently. + +Retold does not require a separate collection of content mods. Datapacks or other mods can change its defaults, so a server's handbook may need additional rules. Official download and support links are at the end. + +### Learn these controls first + +The following are ordinary keyboard-and-mouse defaults. Rebound controls take precedence; check **Options → Controls** if a key does something different. + +| Action | Default control | Why you need it | +| --- | --- | --- | +| Walk and look | W/A/S/D and mouse | Move around and aim at blocks or creatures | +| Jump | Space | Climb one-block steps and cross gaps | +| Sneak | Left Shift | Move carefully; also modifies feeder interactions | +| Sprint | Left Control while moving | Travel faster, but some creatures react to sprinting | +| Break a block or attack | Left mouse button | Hold it to break a block; careless clicks can hurt creatures | +| Use an item, open a block, or place a block | Right mouse button | Open stations, light a Campfire, feed animals, and place materials | +| Open inventory | E | See carried items, armor, and the small crafting grid | +| Select a hotbar slot | Number keys 1–9 or mouse wheel | Choose the item held in your hand | +| Drop the held item | Q | Useful for dropped food, but also an easy way to lose valuables | + +Right-clicking while aiming at a creature is different from dropping an item near it. Animals can have a broader autonomous diet than the items accepted by their ordinary hand-feeding interaction. Similarly, Shift-clicking an inventory slot moves items within a menu; sneaking while right-clicking a placed feeder performs a world interaction. + +### Understand your inventory and crafting grids + +A collected object becomes an **item** in your inventory. A **block item** can usually be placed back into the world. Most ordinary materials stack, often up to 64 per slot, while tools and other items have different limits. A recipe's quantity refers to items, not full stacks: “three Ingots” means three individual Ingots. + +The inventory has a **2×2 crafting grid**. Place ingredients in the required arrangement and take the result. A placed Crafting Table opens a **3×3 grid**, which is needed for larger recipes. Merely putting ingredients into a grid does not complete crafting; you must take the output. + +For example, a Log becomes Planks, and four Planks in a square make a Crafting Table. Retold changes how you obtain that first Log, so follow the Flint instructions in chapter 2 instead of trying the usual punch-a-tree opening. + +The **recipe book** is a convenience for known recipes. An empty book does not mean crafting is impossible. Unless a server adds a separate restriction, you can arrange a valid unknown recipe manually. A removed recipe is different: no amount of arranging its old ingredients will restore it. + +### Health, food, experience, and durability + +Your red hearts represent health. One full heart equals two health points, so a creature with 120 health has sixty hearts' worth before defenses. Armor, resistances, and shields can change how much of an attack reaches that health. + +Your own food bar is separate from Retold's hidden creature hunger. Eat suitable food by holding its use action. Keeping yourself fed supports ordinary survival and healing rules. Retold does not add a completed system that heals you simply for lying in bed. + +Green experience orbs fill your experience bar and increase the level number above the hotbar. **Experience points and experience levels are different units.** An enchanting cost of fifteen levels subtracts fifteen levels; it is not fifteen individual orbs. The experimental Chronolith instead drains experience points. + +Equipment has **durability**, meaning how much use it can withstand before breaking. A tool can wear out even when it is the correct tool. Retold's unenchanted Diamond items have especially low durability; chapter 2 explains how enchanting changes that. + +In Survival, death uses ordinary Minecraft consequences unless the server changes them. Return for dropped equipment promptly. Retold's proposed longer death-drop lifetime is unfinished, so do not assume your belongings will wait indefinitely. A valid Overworld bed can set your respawn destination, but by default sleeping does not skip night. + +### Words used throughout the handbook + +| Word | Meaning | +| --- | --- | +| Mob | A living creature controlled by the game, such as a Cow, Zombie, or Villager | +| Passive, neutral, hostile | Broad descriptions of danger: peaceful, reactive under certain conditions, or ordinarily aggressive; Retold adds more context to these categories | +| Structure | A generated place such as a Jungle Pyramid, Ocean Monument, or Air Temple | +| Dimension | A separate world space, such as the Overworld, Nether, End, or Aender | +| Chunk | A 16×16 horizontal column of world terrain through its height | +| Loaded area | Terrain currently kept active by the game; distant areas may be unloaded and stop ordinary entity ticking | +| World stage | A saved, shared progression state that changes world rules for all players | +| Faction | A group that helps determine creatures' alliances, enemies, and defense rules | +| Territory | A particular defended place, with local guards and suspicion about intruders | +| Datapack | World/server data that can change recipes, tags, and other definitions without editing Retold's Java code | +| Operator | A player granted administrative command permission by the server | + +A creature's remembered home is often a location in its behavior, not a newly generated building you can find. “A Wolf den” therefore does not necessarily mean a visible cave or constructed kennel. A chunk being unloaded also does not mean the real-world clock continues to simulate every action there; chapter 6 explains Retold's limited catch-up. + +### Your immediate priorities + +Find Sticks and Flint, obtain your first wood with a Flint Multi-tool, secure food and shelter, and establish covered lighting. Keep valuable storage away from active Nether portals and dangerous boss sites. Treat Villagers' belongings and guarded structures as property rather than free supplies. + +Survival introduces the intended rules. Creative gives unlimited materials and different creature-targeting behavior, so a peaceful Creative encounter does not demonstrate how that creature treats a Survival player. Adventure and Spectator have their own restrictions as well. + +## 2 Your first days and equipment + +The numbered steps describe the equipment route; they are not an instruction to postpone eating or shelter. Secure food whenever you find a safe source, cook it as soon as you have fire, and place covered Torches as soon as Charcoal is available. If night arrives before you reach Steel, stay with the shelter and supplies you already have. + +### Step 1 Gather Sticks and Flint + +Find a tree and break its leaves. Retold gives leaves a chance to drop supplemental Sticks; several bushes and Dead Bushes can also supply them. Not every leaf drops a Stick, so keep gathering. Break Gravel to look for Flint. Keep enough for **two Flint in the Multi-tool and a third if you will use bare Flint to ignite your first Campfire**. + +Punching a Log can break it, but it does not give you its wood without a correct harvesting tool. Start with the smaller resources rather than spending your first minutes repeatedly destroying trunks without collecting anything. + +### Step 2 Make a Flint Multi-tool + +Open your inventory and use its 2×2 grid: + +```text +Flint Flint +empty Stick +``` + +Take the **Flint Multi-tool** from the output. Hold it and break Logs to collect wood. It has 48 durability, so keep spare Flint and avoid spending all its life on unnecessary blocks. + +This tool combines primitive chopping, digging, and selected soft-material mining. It can harvest ordinary exposed Copper Ore, Sandstone and its supported variants, Tuff, and Calcite. It cannot collect ordinary Stone or Deepslate Copper Ore. Cutting wood also does not make it a full-featured Axe for every right-click action. + +The normal Wooden and Stone tool, weapon, and Spear recipes are removed. You cannot bypass the Flint opening by following an ordinary Minecraft wooden-pickaxe tutorial. + +**If nothing drops:** check the held tool, the block type, and whether your tool broke. Deepslate Copper looks different from ordinary Copper Ore and belongs to a later mining tier. + +### Step 3 Turn wood into a working base + +Craft a Log into Planks in the inventory grid. Four Planks in a square make one Crafting Table. Place it and right-click to open the larger grid. Two Planks placed vertically make four Sticks. + +Set up a small shelter with a roof, an entrance you can close, and room for stations. A Chest made from eight Planks around an empty center stores your excess materials. Keep emergency food and a spare tool there. Avoid digging directly down into an unknown drop or working at a cliff edge while learning the controls. + +Beds use the normal three-Wool-over-three-Planks recipe. They can set a valid Overworld respawn point, but **night continues while you rest** under Retold's default setting. Shelter and lighting remain useful even after you make a bed. + +### Step 4 Build and light a Campfire + +At the Crafting Table, arrange three Sticks and three Logs: + +```text +empty Stick empty +Stick empty Stick +Log Log Log +``` + +Coal is not an ingredient. Place the Campfire and notice that it starts **unlit**. Hold bare Flint and right-click it to light it, consuming one Flint in Survival. Flint and Steel can also ignite it later. A waterlogged Campfire must be made suitable for lighting first. + +A lit Campfire can cook four items at once. Hold a valid input and right-click the cooking surface to place items; wait for completed outputs to pop out, then collect them. The crafted Campfire does not need a continuing inventory of furnace fuel to keep this cooking fire going. Keep yourself off the flames. + +### Step 5 Fire eight Bricks + +Find Clay, commonly in or near water, and collect Clay Balls. Put them on the lit Campfire. **One Clay Ball becomes one Brick after thirty seconds** at normal game speed. Four cooking positions let you make eight Bricks in two batches. + +Bricks are individual items here. Do not combine them into the decorative Bricks block when the recipe asks for eight Brick items. + +Use the eight Bricks to make the **Brick Furnace**: + +```text +Brick Brick Brick +Brick empty Brick +Brick Brick Brick +``` + +This block occupies the vanilla Smoker's place in the game, with a new name and an earlier progression role. You are not looking for a second, separate custom furnace with the same function. + +### Step 6 Smelt Copper and make a Pickaxe + +Harvest exposed ordinary Copper Ore with the Flint Multi-tool to obtain Raw Copper. Open the Brick Furnace. Put the material to process into the input slot, suitable fuel into the fuel slot, and take the finished product from the result slot. + +The Brick Furnace cooks food, smelts Raw Copper and supported Copper Ore inputs into Ingots, and turns burnable Logs into Charcoal. Suitable wooden fuel gets you started before you have Coal. Charcoal is fuel and a Torch ingredient; it is different from decorative Coal-colored blocks or raw ore. + +Make a Copper Pickaxe at the Crafting Table: + +```text +Copper Copper Copper +empty Stick empty +empty Stick empty +``` + +Each “Copper” is one Copper Ingot. Use the Pickaxe to collect ordinary Stone as Cobblestone. Copper mines normal Stone slowly in Retold; slow progress here does not mean you chose a completely unusable tool. + +### Step 7 Make a normal Furnace and obtain Iron + +Eight Cobblestone around an empty center make a **Furnace**. It is a different station from the Brick Furnace. Place it and smelt Raw Iron into Iron Ingots using ordinary fuel. Find Iron in ordinary Stone while you are still below Steel; dark Deepslate ores are not an early shortcut. + +Iron gives you useful tools and utilities such as a Bucket, Shield, and Flint and Steel. A Bucket needs three Iron Ingots. Flint and Steel needs one Iron Ingot and one Flint in a shapeless recipe. Ingredient quantities and grids are collected in Appendix A. + +Iron tools still do not harvest Deepslate or Diamond Ore correctly under Retold's material rules. Make Steel before committing to deep mining. + +### Step 8 Turn Iron into Steel + +First obtain three Smooth Stone. Smelt Cobblestone into Stone, then smelt that Stone again into Smooth Stone. These are three distinct item names; decorative Smooth Stone Slabs will not substitute for the blocks. + +Make a Blast Furnace: + +```text +Iron Iron Iron +Iron Furnace Iron +Smooth Stone Smooth Stone Smooth Stone +``` + +Use five Iron Ingots, one normal Furnace, and three Smooth Stone. The uneven word widths in the diagram do not change its three columns. + +Put an Iron Ingot in the Blast Furnace's input and ordinary suitable fuel below it. **One Iron Ingot becomes one Steel Ingot in five seconds** at normal tick speed. Charcoal works as fuel; it is not an additional fixed-ratio ingredient mixed into the crafting grid. + +Three Steel Ingots and two Sticks make a Steel Pickaxe in the same arrangement as the Copper Pickaxe. Steel also makes an Axe, Shovel, Hoe, Sword, Spear, Helmet, Chestplate, Leggings, and Boots. Appendix A contains every pattern. + +### Step 9 Establish food and reliable lighting + +Use food you can obtain safely, and cook suitable raw meat or fish. Three Wheat in a horizontal row make Bread. A crop farm is useful for your own food and for animals, but do not assume every plant a creature eats will be left untouched. Grazers and hungry foragers can consume their surroundings. + +One Coal or Charcoal above one Stick makes four normal Torches. Place them under solid cover where possible. Exposed normal, Soul, and Copper torches can go out in rain or snow. Extinguished torches stop lighting the area; their appearance is a clue, not a different permanent crafting ingredient. + +Relight a torch by right-clicking with **Flint and Steel or a Fire Charge**. Bare Flint is your early **Campfire** igniter, not the default extinguished-torch igniter. Flint and Steel loses durability; a Fire Charge is consumed. A torch you relight while still exposed to weather can go out again. Breaking an extinguished torch returns the corresponding ordinary lit torch item. + +### Know which equipment to bring + +| Tier | Your practical role for it | Important limit | +| --- | --- | --- | +| Flint | Obtain first Logs, soft materials, and exposed ordinary Copper Ore | Short-lived; not a Stone or Deepslate Pickaxe | +| Copper | Begin ordinary Stone mining and basic equipment | Slow on Stone; cannot collect Steel-gated deep materials | +| Iron | Useful tools, armor, utilities, and Blast Furnace construction | Still below the Deepslate/Diamond drops gate | +| Steel | Harvest Deepslate and both Diamond Ore variants; stronger complete equipment set | Cannot collect Obsidian or Ancient Debris | +| Diamond | Harvest Obsidian and Ancient Debris; bridge to Netherite | Fragile until enchanted | +| Netherite | Ordinary late upgrade and successful Aenderite mining | Needs the vanilla upgrade resources and Smithing Table | +| Gold | Optional fast, fragile equipment | Not a replacement for the required mining ladder | +| Aenderite | Ore, raw material, and Ingot foundation | No completed equipment or Ingot crafting uses | + +Breaking a block and successfully harvesting it are different. Steel's special permission covers Deepslate, its supported processed forms and ores, and ordinary Diamond Ore. It does not override every other block's unbreakability or loot rules. + +Copper is less frequent in newly generated terrain: its two modified ore placements use six attempts per chunk instead of sixteen. Existing ore is not retroactively removed. Iron and Diamond generation remain ordinary Minecraft in this part of the overhaul. + +### Make Diamond last + +Unenchanted Diamond tools and Spears have a maximum durability of **64**. Player armor is also fragile: Helmet 66, Chestplate 96, Leggings 90, Boots 78. Save the first Diamond Pickaxe for important mining instead of wearing it out on a mountain of common blocks. + +**Any enchantment restores ordinary Diamond maximum durability, including a curse alone.** You can use the enchanting table or apply an appropriate enchanted book at an Anvil. Chapter 4 teaches both routes. Creating an Enchanting Table itself requires Obsidian, so a fragile first Pickaxe can still perform the necessary Obsidian mining before you improve it. + +Enchanting does not promise to erase existing item damage. Removing every enchantment makes Diamond fragile again while preserving damage; a heavily damaged stripped item can have only one final use. A Grindstone is therefore not a free way to keep enchantment-strength durability without enchantments. + +Diamond Horse and Nautilus Armor has 96 durability before enchanting and 528 after, and takes wear from hits. Other Horse/Nautilus Armor remains indestructible under these changes. Wolf Armor and Horse/Nautilus Armor support compatible Chestplate enchantments; Fire Protection reduces fire harm without making the creature fireproof. + +### Repair and upgrade with care + +Flint is the Flint equipment repair material; Steel Ingots repair Steel equipment through the applicable repair workflow. Anvil repairs and combinations use normal costs and compatibility. Read the preview before taking the result, particularly if a change removes enchantments or alters a fragile Diamond item. + +Netherite still uses the ordinary Smithing Table workflow: an appropriate Netherite Upgrade Smithing Template, Diamond equipment, and a Netherite Ingot. The wider Retold Netherite redesign is unfinished. Aenderite Ore needs a Netherite Pickaxe for its drops; owning Diamond equipment alone is not enough. + +Equipment can also come from loot, trades, or other players. New smith trades are deliberately staged: Copper at Apprentice, Iron at Expert, and Diamond at Master. Those are trade progression levels, not the world stage and not a universal limit on Villager lessons. + +### A useful first-expedition checklist + +Before leaving your base for a long trip, bring food, an appropriate Pickaxe, a weapon, spare building blocks, covered-lighting supplies, an igniter, and a plan for returning. Keep spare tools and some materials at home rather than taking every resource into your first risky encounter. For a new player, a recoverable short expedition teaches more than losing the only working equipment far away. + +You are ready to move beyond the opening when you can replace your equipment, supply your own food, keep a small safe base, and explain which material your current tool can harvest. Learning recipes, working with Villagers, and enchanting then make that progress more reliable. + +## 3 Learning recipes and Villager lessons + +Retold changes how you discover crafting instructions. You can know that an item exists without knowing how to make it, and you can carry a finished item without unlocking its recipe. Recipes and items are separate things: a recipe is a set of inputs and a method, while an item is the result you can hold and use. + +Under ordinary world settings, an unknown valid recipe still works if you arrange its ingredients correctly. An empty recipe book does not mean crafting is disabled. It means the book has not learned the instructions for you. Use the opening recipes in this handbook to make your first tools and stations, then build up your own collection of discoveries. + +### What makes a recipe known + +Successfully crafting an item can record the recipe you used. Taking processed output from a Furnace, Brick Furnace, or Blast Furnace also provides a learning route. Some matching cooking recipes can be learned together when they use the same ingredient and produce the same result in different stations. + +That last condition matters. Learning to process Raw Copper does not necessarily reveal every recipe that produces a Copper Ingot. Copper Ore, Deepslate Copper Ore, and Raw Copper are different inputs, even though they can lead to the same metal. Likewise, the same finished food can have Furnace, Brick Furnace, and Campfire preparation methods. + +Picking up ingredients no longer gives you the usual automatic list of possibilities. Finding or buying a finished item is useful, but possession alone is not a general recipe unlock. You can use an item you found even when its crafting instructions remain unknown. + +Recipe knowledge belongs to your player and is saved. Another player's discoveries do not automatically become yours. Everyone shares the world's stage, but each player has their own recipe and enchantment knowledge. + +For this development build, do not rely on Campfire cooking or Smithing alone to reveal recipe-book entries. Their direct learning paths need further verification. This concerns discovering the instructions; the supported processing and Smithing operations themselves can still be performed. The beginner progression does not require every operation to appear in the book before you use it. + +### A lesson is different from a trade + +A normal trade exchanges items. For example, buying a tool gives you a tool to use. A **Villager lesson** exchanges Emeralds for crafting knowledge. It teaches a recipe for a finished sample you already possess; it does not hand you a newly made item or provide the ingredients. + +The two functions share the Villager's trading screen, but their slots and payments are separate. Buying equipment follows the Villager's available offers and profession level. Lessons depend on the profession's configured teaching list, your sample, your existing knowledge, and your Emeralds. You do not have to reach the equipment trade's mastery level to take a lesson that is otherwise available. + +A Toolsmith can teach tools, a Farmer can teach food, and a Librarian can teach selected books and workstations. Their professions are useful clues, not promises that they know every related recipe. Check the teaching panel for the actual answer. Wandering Traders do not teach through this system. + +### Taking your first lesson + +Open a professional Villager's ordinary trading screen. Look for the extra teaching panel beside the normal offers. It has a single sample slot, a status message, an Emerald cost, and a **Learn** button. + +1. Put **one finished example of the item you want to make** in the teaching slot. Show Bread to ask about Bread. Putting Wheat there asks about Wheat's own recipe; it does not ask what can be made from Wheat. +2. Keep the required Emeralds in your player inventory. The teaching slot is for the sample, and it does not accept Emeralds. +3. Read the status and price. An available lesson enables Learn and highlights the sample slot. +4. Click **Learn**, or press **Enter** or **keypad Enter** while the lesson is available. +5. Close the screen to recover your sample. You can also take it back from the sample slot; it is not consumed as the lesson payment. + +A successful lesson spends the displayed Emerald cost and records the recipe. It also gives the Villager experience, which can help it advance its profession level and gain further ordinary offers. Repeating a lesson you already know does not provide another paid unlock or repeat experience reward. + +The panel gives brief visual and sound feedback when the server accepts or rejects a request. Wait for its updated result before clicking again. The button temporarily pauses while a request is pending, so rapid clicking is unnecessary. + +### Worked example with Bread + +Suppose you have a piece of Bread from exploration, trading, or another player, but you have never crafted it yourself. You want the recipe to become visible in your book. + +Find a Farmer, open the trading screen, and put that Bread in the teaching slot. The current Bread lesson costs **one Emerald**. Keep at least one Emerald in your inventory and choose Learn. On success, you pay one Emerald and learn the recipe; the Bread remains your sample and comes back when you close the menu. + +You still need the ingredients to make more. Bread uses three Wheat across a crafting row. Learning the recipe supplies the instructions, not a stockpile of Wheat and not another free loaf. + +A Campfire is another useful example, with a different price: a Fisherman can teach its recipe for **two Emeralds** when you show a Campfire sample. The normal Campfire recipe is already provided in the opening walkthrough, so you can also make one manually without buying that lesson. An Enchanting Table lesson costs **twelve Emeralds** from a suitable Librarian or Cleric; that does not replace the materials needed to build the table. + +### Choosing the right teacher + +Use this as a starting point, then check the complete lesson reference for individual items and prices. The panel remains the final check for an item in your current world. + +| Profession | Examples of teaching topics | +| --- | --- | +| Farmer | Bread, several foods, seeds, Hay Bale, Composter | +| Fisherman | Fishing Rod, Barrel, Campfire, cooked fish | +| Butcher | Cooked meat and the Brick Furnace | +| Toolsmith | Flint Multi-tool, Copper/Iron/Steel/Gold/Diamond tools, selected workstations | +| Weaponsmith | Spears, swords, axes, Shield, Crossbow | +| Armorer | Selected metal armor, Shield, Anvil, Blast Furnace | +| Cleric | Brewing Stand, selected potion ingredients, Eye of Ender, Enchanting Table | +| Librarian | Books, paper, Bookshelf, Lectern, Enchanting Table | +| Fletcher | Arrows, bows, Crossbow, Target, Dispenser | +| Leatherworker | Leather armor, Bundle, Book, Cauldron, frames | +| Mason | Selected brick and stone building recipes, Stonecutter | +| Shepherd | Carpets, beds, Painting, Loom | +| Cartographer | Map, Compass, Cartography Table, selected frames | + +Some items have more than one teacher, and their prices can differ. A Book lesson, for example, does not have to come from the same profession as an Enchanting Table lesson. Choosing a cheaper available teacher does not change the resulting recipe. + +The current teaching data also contains entries whose recipe identifiers do not match available recipes in this Minecraft version. These include certain stew, wool, banner-pattern, and polished-wall entries. They are separated from available lessons in the reference appendix. Do not spend a journey looking for a teacher on the assumption that every configured entry can currently be learned; an unavailable panel is a reason to check that appendix. + +### When a lesson is unavailable + +Start with the simplest checks. Is the sample in the extra teaching slot? Is it the finished output you actually want? Does this profession teach it? Do you have enough Emeralds in your inventory? Have you already learned it? + +A sample is not a universal request to explain its ingredients. The current interface unlocks selected recipes; it does not give a separate spoken ingredient explanation. An unsupported item or missing recipe entry can therefore leave the lesson unavailable even if the item itself is perfectly usable. + +Rejected, unaffordable, unsupported, and already-known lessons do not consume Emeralds. The sample is not a fee, so take it back when finished. If your inventory has no room, be ready to collect returned items around you rather than leaving a valuable sample behind. + +You can continue experimenting with valid manual recipes, use the recipe atlas, or obtain instructions through another available route. Dedicated EMI and JEI support is unfinished, so do not assume an additional recipe viewer follows all of Retold's discovery rules. + +## 4 Enchanting from the beginning + +Enchanting adds magic to equipment. Retold keeps enchantments as working item properties, but changes how you identify and reproduce them. Instead of choosing a random table offer, you enter a short inscription made of **three Standard Galactic Alphabet glyphs**. + +The alphabet is a discovery puzzle. This chapter explains the controls and learning routes without giving you solved words or translating the symbols. Compare inscriptions you encounter and keep your own notes. Repeated shapes can become useful clues as you collect more examples. + +### What you need to begin + +There are two useful stations: an **Anvil** for applying enchanted books, and an **Enchanting Table** for writing inscriptions. Both use experience levels, so keep some experience after mining and combat rather than spending everything immediately. + +An Anvil uses three Iron Blocks and four additional Iron Ingots: **thirty-one Iron Ingots in total**. An Enchanting Table uses **one Book, two Diamonds, and four Obsidian**. The recipe diagrams appear in the crafting reference. A Book can be made from three Paper and one Leather; three Sugar Cane make three Paper. + +The ordinary route to mining Obsidian uses a Diamond Pickaxe. Retold's unenchanted Diamond equipment is fragile, but it still works: you can collect the Obsidian needed for your first table before enchanting the pickaxe. Its low durability is a reason to save it for the tasks that need it. + +For table use, obtain Lapis Lazuli and enough experience levels. **Bookshelves are not required and do not increase the table's power.** You do not need to build a ring of shelves or wait for random offers to refresh. + +### Understanding an enchanted item + +An unknown enchanted item still has working magic. You can equip it or use it normally even if you cannot read its enchantment name. Its tooltip shows the three-glyph inscription and, where applicable, an enchantment level. + +Once you learn that spell, its readable name appears alongside the inscription. That knowledge belongs to your player. Another player can see the same item differently because they have learned different spells. + +Finding a book, buying one, carrying an enchanted weapon, or reading its tooltip does not by itself teach the spell. Keep the distinction clear: **possessing working magic is different from learning how to write it**. + +### Learning through an Anvil + +An enchanted book contains magic you can transfer to compatible equipment. At an Anvil, put the equipment in the left input and the enchanted book in the right. Inspect the output and the ordinary Anvil cost, then take the completed result when you want to pay. + +A spell becomes known when that completed operation actually adds it to the result or increases its level. Merely placing the inputs in the Anvil is not enough. If the book's spell is incompatible, or would leave the result unchanged, it does not count as a learned transfer. + +A book with several enchantments is handled one spell at a time: each transferred or improved enchantment can become known, while incompatible or unchanged ones remain unknown. Combining ordinary enchanted equipment is still an Anvil operation, but the learning route described here depends on transferring enchantments from a book. + +You learn the spell itself, rather than a separate word for each level. Learning a low-level version can therefore give you the inscription used for its higher legal levels later. You still need compatible equipment, a table-eligible spell, and the resources for the level you request. + +### Starting with an empty Known spells list + +An empty list is normal for a new player. It means you have not yet learned any eligible spells to display. You have two routes forward. + +The first is to obtain an enchanted book and complete a compatible Anvil transfer. Afterwards, the learned spell can appear in the table's list if the table is allowed to write it. + +The second is to experiment at the table. You can copy the three visible glyphs from an unknown enchanted item or book into your own notes, then enter the same shapes. You do not have to know the readable name before trying the inscription. Start with level I while learning the controls, and choose a suitable target; a plain Book is a useful option for a table-eligible spell. + +A successful valid inscription teaches its spell. A copied word can still fail if that enchantment is unavailable at the table, incompatible with the target, conflicting with existing magic, or requested at an illegal level. The game does not translate those failures into hints about the alphabet. + +### Writing at the table + +Open the Enchanting Table and place your target item in its item slot. Put at least **three Lapis Lazuli** in the Lapis slot. A plain Book is also a valid target and becomes an Enchanted Book after a successful cast. + +Enter three glyphs, either by clicking the onscreen glyph keyboard or using the physical A–Z keys. These keys select glyph shapes; they do not reveal the symbols' meanings. Each entry fills the next empty position. Once all three positions are filled, extra letters do not add a fourth symbol. + +Choose a level with the Roman-numeral buttons, the number keys 1–5, or keypad 1–5. Check the displayed cost, then click **Write**, press **Enter**, or press **keypad Enter**. A successful cast applies the spell, records your knowledge, clears the inscription, and briefly highlights the target in green. + +You can add further compatible enchantments to equipment in later casts. Each cast has its own cost. The selected level is the spell's requested final level, not a number of levels to add to its current strength. + +### Editing and using the spell list + +You do not need to close the table to correct an inscription: + +| Control | Effect | +| --- | --- | +| Backspace | Remove the last glyph | +| Click an inscription position | Remove that glyph and every glyph after it | +| Clear | Empty all three inscription positions | +| Click a known spell | Fill its complete inscription | +| Left and right list arrows | Move between pages of known spells | + +Known spells appear four per page. With no target inserted, the list can show your known table-eligible spells. Inserting an item filters out choices that do not fit it, conflict with its current enchantments, or are already at their maximum level. + +A missing list entry does not necessarily mean you forgot the spell. Remove the target to check whether filtering explains its absence. Some learned treasure spells remain unavailable at the table entirely. + +For known words, the controls respect the registered maximum level and disable excess choices. Manually entered unknown words keep generic controls, without a preview that tells you whether the word is correct. Choosing a word from the list also keeps the selected level within its limit. + +### Paying for a cast + +Every successful table cast costs **three Lapis Lazuli**, plus **five experience levels for each requested enchantment level**: + +| Requested enchantment level | Lapis Lazuli | Experience levels | +| --- | --- | --- | +| I | 3 | 5 | +| II | 3 | 10 | +| III | 3 | 15 | +| IV | 3 | 20 | +| V | 3 | 25 | + +These are player experience **levels**, not individual experience points. A level III cast costs fifteen levels even if it upgrades an existing lower-level copy of that enchantment. The Lapis cost stays three. + +For example, with twenty experience levels and three Lapis, a successful level III cast spends the three Lapis and leaves you with five levels. Make sure the spell actually supports level III; the table cannot invent a higher maximum for a weaker spell. + +An invalid, conflicting, unaffordable, or non-improving cast spends nothing. Failure leaves the inscription in place and gives a generic red highlight and low sound. Check your target, level, resources, and existing enchantments before assuming the word itself is wrong. A valid word that successfully applies a different spell from the one you intended still counts as a paid success. + +### Compatibility and unavailable spells + +Normal enchantment conflicts still matter. Fortune and Silk Touch cannot share the same pickaxe, and the main Protection alternatives conflict with one another on the same armor piece. Knowing both inscriptions does not remove those restrictions. + +The table can write only enchantments allowed by its normal eligibility rules. Learning a treasure enchantment through an Anvil does not automatically make it available there. The reference distinguishes table-eligible spells from mapped spells that need another acquisition route; it does not expose their glyph solutions. + +**Mending is excluded from new random loot and Librarian trades in this build.** Existing Mending equipment continues to work. Do not plan your first enchanting setup around buying a new Mending book, and do not mistake the missing offer for a lesson you need to unlock. + +### Why this matters for Diamond + +Unenchanted Diamond tools and Spears have a maximum durability of only **sixty-four**. Diamond armor also has reduced durability. Applying **any enchantment**, including a curse, restores the equipment's normal full Diamond durability while that enchantment remains. + +Removing every enchantment makes the item fragile again. Its existing damage is preserved, so stripping a heavily used item can leave only one final use. Keep this in mind before using a Grindstone. Enchanting does not erase damage or turn that transition into a free repair. + +Diamond Horse and Nautilus Armor follows the same fragile-until-enchanted principle. Wolf, Horse, and Nautilus Armor can receive the supported Chestplate-style enchantments, but normal compatibility and material behavior still apply. Retold's wider enchanting balance and acquisition changes remain in development; learning the current controls does not make every planned spell or equipment feature available. + +## 5 Keeping animals and pets + +A Retold farm needs a food supply, safe surroundings, and room for animals to reach what they eat. Putting two cows behind a fence is only the beginning. They can graze the enclosure bare, become hungry, search for another feeding range, and eventually try to escape. A named pet also needs care: a name tag and taming do not prevent starvation while the creature is active in the world. + +Many creatures have Retold hunger, including livestock, ordinary predators, fish, Bees, Bats, and Villagers. Some do not. Polar Bears, Skeletons, most guards, and several specialist monsters have no Retold hunger cycle. A creature does not necessarily need feeding merely because another member of its faction does. + +### Four ways to provide a meal + +**Direct feeding** means using an item on the animal. Its ordinary species-specific interaction still matters: the expanded Retold diet does not make every listed food a valid right-click item. For supported adults, normal breeding food relieves hunger instead of instantly producing love mode. Taming, healing, growing a baby, and other special vanilla interactions can still have their own conditions. + +**Dropped food** means throwing a compatible item on the ground. Hungry creatures with that diet can approach and consume it. This lets a species eat more foods than its familiar vanilla breeding item. A cow can eat a dropped Carrot, for example, even though Wheat remains its familiar direct interaction. Nearby predators or Slimes may also notice loose food, so dropping a stack is not a private delivery to one chosen animal. + +**An Animal Feeder** stores food in a wooden trough. It supplies suitable animals that can physically reach it. It is useful for a maintained enclosure because food stays in a container until a meal is taken. + +**Foraging** means the animal obtains food from its surroundings. Some meals remove real plants or crops; others represent browsing or digging without destroying the habitat. A Mooshroom can graze Mycelium without removing it, whereas a Panda eats the Bamboo block it reaches. Do not assume all natural feeding leaves the landscape unchanged. + +After a meal, many creatures briefly stop and face the food source while eating. Danger takes priority: an animal being chased or attacked may abandon its feeding attempt. Food somewhere in the pen is not enough if the animal cannot reach it or cannot stop fleeing long enough to eat. + +### What to feed each creature + +The table describes the current default diets. The dropped-food column also describes what a suitable feeder can offer where that species uses feeders. It does not expand the animal's direct right-click controls. Datapacks can change these defaults. + +| Creature | Food you can supply | Food or feeding behavior in its habitat | +| --- | --- | --- | +| Cows, Mooshrooms, Sheep, Goats, Horses, Donkeys, Mules, Llamas, Trader Llamas, Camels | Wheat, Hay Bales, Apples, Carrots, Potatoes, Beetroot, grasses, and ferns | Grazing plants, flowers, and crops. Mooshrooms also browse Mycelium; Goats scrape Stone, Snow Blocks, Packed Ice, and Gravel; Camels browse Dead Bushes. Those special habitat meals do not remove the source. | +| Pigs, Chickens, Rabbits | Wheat Seeds, Beetroot Seeds, Melon Seeds, and Pumpkin Seeds; Carrots, Potatoes, Beetroot, and Dandelions | Grasses, flowers, and crops. Rabbits can also browse Dead Bushes without removing them. These three species share a broader diet than their usual vanilla breeding foods suggest. | +| Wolves | Raw or cooked meat and fish, including Rotten Flesh | Hunt Sheep, Rabbits, Chickens, and fish when hungry. Tamed Wolves do not start independent prey hunts. | +| Foxes | Meat, fish, Sweet Berries, and Glow Berries | Hunt Rabbits, Chickens, and fish; can carry food toward their den. | +| Cats and Ocelots | Meat, fish, and Phantom Membranes | Can hunt Rabbits, Chickens, Frogs, fish, and Phantoms. Tamed Cats stop ordinary independent prey hunts. | +| Dolphins | Meat and fish as compatible dropped food | Hunt fish and share hunting activity with their pod. They do not use land-animal feeders. | +| Spiders and Cave Spiders | Meat and fish as dropped food | Hunt suitable animals, fish, and Bats at night. They are not feeder livestock. | +| Armadillos | Spider Eyes and their ordinary species food | Dig for abstract grubs in suitable exposed ground, including dirt-like soil, Red Sand, Terracotta, and Mud, without removing it. | +| Turtles | Seagrass | Feed on suitable Seagrass and remember beach and water locations. | +| Pandas | Bamboo | Approach and consume planted Bamboo; the reached block disappears without producing a dropped item. | +| Parrots | Their ordinary seed foods, plus Wheat, Carrots, Potatoes, Beetroot, and Melon Slices as dropped food | Can forage planted crops. | +| Bees | Flowers | Flower visits provide meals without destroying the flower. | +| Cod, Salmon, Tropical Fish, Pufferfish | Maintain suitable aquatic plants | Graze Seagrass, Tall Seagrass, Kelp, and Kelp Plants. They do not share the Squid diet of dropped raw fish. | +| Squid and Glow Squid | Dropped raw Cod, Salmon, Tropical Fish, or Pufferfish | Do not hunt living fish. They do not use feeders. | +| Nautiluses | Fish as dropped food | Wild hungry Nautiluses hunt living fish; tamed ones stop autonomous hunting. | +| Frogs | Their normal direct feeding interaction remains relevant | Hunt suitable small arthropods and small Slimes or Magma Cubes. Do not rely on a feeder or generic dropped-food diet for them. | +| Axolotls | Their normal direct feeding interaction remains relevant | Hunt suitable fish, Squid, Glow Squid, and Drowned. Guardians are a defensive fight rather than ordinary food. They do not use feeders. | +| Bats | Dropped Spider Eyes | Hunt arthropods at night and can catch abstract cave insects. They do not use feeders. | +| Piglins, Hoglins, Striders | Their expanded dropped diet includes meat, Crimson and Warped Fungus, and red and brown mushrooms | Hoglins forage Crimson Fungus; Piglins can forage Crimson Fungus and mushrooms. Striders can forage Warped Fungus, and lava sustains them without being consumed. | +| Slimes and Magma Cubes | Every kind of dropped item | Swallow items even when completely fed. Living-prey combat is governed separately by hunger. | +| Villagers | Bread, Carrots, Potatoes, and Beetroot in their own inventory or accessible village Chests and Barrels | Farmers can supply communal surplus. Villagers do not eat from Animal Feeders. | + +Existing or Creative-created Sniffers obtain food through their special ground-foraging behavior. Normal survival acquisition of Sniffers is disabled, so they are not part of the ordinary new-world farming route. + +### Using an Animal Feeder + +Craft the trough from five Planks, with Planks in the two upper corners and across the bottom row. Place it where animals can stand beside it; a food container behind an obstacle is not a working feeding station. + +| Interaction | Result | +| --- | --- | +| Right-click with suitable food | Insert one item | +| Sneak-right-click with suitable food | Insert as much of the held stack as fits | +| Sneak-right-click with an empty hand or an unsuitable item | Retrieve the stored food | + +The feeder holds one stack and animals consume one item per meal. It saves its contents normally. Its inventory and comparator behavior also allow ordinary storage arrangements. + +The trough accepts several food categories because different animals use it. Acceptance does not mean every nearby animal can eat its contents. A trough containing meat can be useful to a Wolf and useless to the cows beside it. Use the diet table and provide an accessible approach, then watch for an actual meal. + +Aquatic groups, Villagers, hostile monsters, Slimes, and Magma Cubes do not use the trough. Some specialist animals also need habitat or prey rather than a compatible stored item. One feeder is not a universal solution for an entire mixed collection. + +### Breeding through sustained care + +Retold replaces immediate item-triggered breeding with sustained satisfaction for supported animals. Both adults must stay well fed, without panic, damage, or an active combat target, for **five minutes** at normal game speed. Ready compatible adults within eight blocks can then begin their ordinary mating behavior. + +Feeding two hungry cows once does not guarantee that they will breed five minutes later. They need to remain well fed throughout the wait. If they eat their grass, become hungry again, or keep fleeing a nearby predator, their preparation can reset. After a birth, both parents become hungrier and retain the normal age cooldown before they can breed again. + +Vanilla still handles genetics, tame ownership, Horse and Donkey crosses, Turtle eggs, Frog pregnancy, and other special birth behavior. Babies do not immediately become breeders. They also are not exempt from the needs of their species: keep their habitat supplied rather than treating a newborn as safe because it is young. + +There is no separate population-count cap on this reproduction. A well-supported group can grow, so allow for the extra food and space its offspring will need. A local herd splitting into several social groups does not mean reproduction has been capped. + +### Keeping an enclosure working + +Imagine a small cow pen whose floor is mostly grass. At first, grazing supports the herd. As usable food disappears, the cows become hungry and may seek another range. A feeder with reachable Wheat can keep that place worth staying in. Adding more fence without adding food does not solve the underlying problem. + +Desperate eligible ground animals can break wooden fences and closed wooden fence gates. Actively hunting wild predators can also break these barriers to reach prey. You can see cracking before the block breaks, and the broken block drops normally. Doors, trapdoors, walls, iron barriers, and open gates are outside the default weak-barrier set. Tamed predators, leashed animals, and passengers do not use this particular breach behavior. + +If cows will not settle or breed, check the food itself, the approach to it, and nearby danger before assuming the breeding system failed. If a feeder is ignored, try a simple supported position beside the animals and one known compatible food. If plants are not being consumed on a server, check its griefing rules: disabling mob terrain changes prevents destructive forage and fence breaking, while dropped food and feeder meals can still work. + +## 6 Understanding the living ecosystem + +Retold creatures remember places, respond to each other, and have reasons to interrupt what they were doing. A Wolf stopping a hunt, a Chicken returning to a roost, or fish leaving a depleted plant patch can be ordinary behavior rather than a broken target or lost path. + +### Homes and feeding ranges + +A home is usually a remembered location. Wolves and Foxes can have den locations, Chickens roosts, Rabbits warrens, and aquatic creatures feeding or home ranges. These names do not mean the animal automatically builds a new den building or excavates a Rabbit tunnel. Spider lairs are a separate exception because their webs are real placed blocks. + +Herds and foraging groups organize around local ranges. Cows and Mooshrooms can share a bovine group. Horses, Donkeys, and Mules can mix, as can Llamas and Trader Llamas. Many other land groups are species-specific. Cod, Salmon, Tropical Fish, and Pufferfish form separate schools of their own species, even though fish can share panic more broadly. + +Usable food helps hold a range in place. When hunger rises and nearby food is depleted or inaccessible, a group may migrate toward a better area. There is no permanent enclosure flag that makes player-placed animals forget these needs. Maintaining food where you keep them is what makes that location attractive. + +### Day, night, weather, and rest + +Species have different daily rhythms. Grazers and Pigs tend to rest at night. Chickens return to roost during their inactive periods and in rain. Foxes and Wolves are more active around dusk, night, and dawn and may rest by day. Cats and Ocelots have their own dusk and night activity, including late-night rest; Dolphins also have a late-night resting period. + +Watch the animal's situation before interpreting a pause. A Cat can lie down, a Fox sleep, a Wolf sit, or a Camel settle near its home. Food needs and danger can interrupt these routines. A hungry animal may search when its satisfied neighbor is resting, and a frightened Rabbit may return to its warren after a chase. + +Social safety also affects behavior. Creatures can recover from danger near a familiar home or compatible group. Isolation can make social animals more nervous, while meals and successful hunts can improve their willingness to act. These are background states, not normal Survival bars that you must constantly monitor. + +### Predators do not know everything + +Ordinary food hunting follows prey diets. A hungry Wolf does not automatically select a player as its next meal. Wolves, Foxes, Cats, Ocelots, Dolphins, and Spiders seek different kinds of prey, and retaliation is separate from feeding. A predator that attacks after being hurt is defending itself, even if it was not hungry beforehand. + +Predators use sight, nearby audible activity, and short-range scent. A distant scent clue can guide a search without revealing a perfect live target through every wall. Losing sight of prey can lead to searching around its last known location rather than following its current position without limit. + +Long chases can tire ordinary predators. A hunter that stays far from its prey or repeatedly loses sight can slow down, abandon the pursuit, and take a break before hunting again. A blocked or impossible route can also make it give up or reconsider. Do not assume that a predator stopping means it has become friendly; the next encounter may have different conditions. + +Real damage matters too. A successful hit from a living attacker that leaves an ordinary wild predator below one quarter of its health can make it abandon its ordinary hunt or retaliation and flee for ten seconds. Tamed defenders, Undead, bosses, and active territory duties have different priorities. This is not a universal surrender rule for every enemy. + +### Danger can spread through a group + +Prey can flee a nearby hungry predator before the first bite. A successful damaging hit also causes passive creatures to panic, and nearby companions may react. Some creatures can respond when they see a mob genuinely targeting them, before it lands its attack. They do not read a player's crosshair or decide that merely holding a sword proves hostile intent. + +Social defenders can help an injured ally, but help depends on species, faction, ownership, awareness, and whether the helper is already busy. Standing tame Wolves of the same owner can cooperate; a sitting pet does not join ordinary owner defense. Dolphins can defend an injured podmate even when not hungry. A creature with another urgent task may not join the same fight. + +Creepers have special safety rules. Mobs do not deliberately select or directly melee them. Cats hiss and retreat, while Creepers retain their avoidance of Cats. Many mobile non-Undead creatures flee a lit fuse, including defenders that would otherwise stand and fight. Undead and other Creepers do not use that escape response. + +### What happens when you leave an area + +Unloaded creatures are not continuously acting out every moment somewhere beyond view. When you return, Retold can reconcile up to **seven Minecraft days** of missed ecosystem time. This uses time that advanced in the world, not the number of real days a stopped save sat on your disk. Closing a single-player world for a week does not itself create a week of simulated hunger. + +Reconciliation changes real things. Food can leave a feeder or village store, plants can be consumed, and a suitable reachable wild prey animal can disappear without dropping loot or experience. Breeding preparation can advance across periods that remained well fed. A foodless herd, Pig group, or fish school can relocate together when a safe reachable destination is available. This process does not break barriers to invent an escape route. + +Named mobs and tamed animals, including tamed horses, have protection from death during this hunger catch-up and stop at one health. **Untamed unnamed horses are not automatically protected.** Catch-up predation also protects named or tamed prey and animals being ridden or carrying passengers. These protections do not make pets safe from ordinary starvation or attacks while their area is loaded. + +Some Farmer crop work and ordinary spawning can also be reconciled under limited conditions. This is not general offline crop growth or a complete offscreen village economy. On returning, inspect actual food and animal health rather than assuming an area was perfectly frozen or fully simulated in your absence. + +## 7 Creature field guide + +The entries below describe Retold's distinct behavior families. Ordinary Minecraft actions can remain alongside them: a special diet does not replace every taming, riding, or interaction rule. Custom boss encounters and their progression rewards are explained in the guardian and dimension chapters. + +### Farm animals and smaller wildlife + +**Cows and Mooshrooms** share herds, feeding ranges, and group panic. Mooshrooms have renewable Mycelium grazing in addition to the broader grazer diet. **Sheep and Goats** also graze and group; Goats can obtain habitat meals by scraping suitable rock, snow, ice, or gravel. **Horses, Donkeys, Mules, Llamas, Trader Llamas, and Camels** use grazer life behavior, with compatible mixed groups where described earlier. Camels have Dead Bush browsing, and a Trader Llama linked to a living Wandering Trader can receive caravan sustenance. + +**Pigs, Chickens, and Rabbits** forage rather than behaving like identical miniature grazers. Pigs use feeding ranges, Chickens return to roost, and Rabbits can hide at remembered warrens after panic. Rabbits also have Dead Bush browsing. Their expanded dropped-food diet is useful when maintaining a mixed small-animal area. + +**Wolves** organize pack hunts, search together, regroup, and return toward their den. Hungry members matter when choosing who starts or continues a hunt, and a satisfied leader can give way to a hungry member. Den defense specifically includes Skeleton-family enemies such as Skeletons, Strays, Bogged, and Wither Skeletons. A remembered den does not make every passing player a territorial enemy. + +**Foxes** are opportunistic solo hunters with den memory. A Fox carrying edible food may take it home rather than immediately eating where it found it. **Cats and Ocelots** also have individual territories and hunger-driven prey hunting. Cats hiss and withdraw around Creepers; do not interpret that retreat as a plan to kill the Creeper. + +**Polar Bears** have no Retold hunger cycle. Adults protecting cubs can stand, face an intruder, and give a short warning before attacking. Leaving promptly can avoid escalation; harming them is a different situation and can provoke immediate defense. Nearby adults may help. + +**Armadillos** distinguish ordinary walking from visible sprinting nearby. Sprinting and genuine danger can trigger defense or retreat; hungry ones can perform a grub-dig meal in suitable ground. **Turtles** remember beaches and can flee toward water. In the current build, any visible Survival player coming within roughly five and a half blocks can frighten a Turtle, even without sprinting. Approach with space rather than relying on peaceful walking to keep it still. + +**Pandas** remember Bamboo groves, approach Bamboo to eat, and can seek another stalk if one is unreachable. They remove the reached block without drops. **Parrots** forage seeds and crops. Tame Parrots, including shoulder riders, can warn an owner of a recent attacker or a nearby mob actively targeting the owner. The cue is a low-pitched hurt-like call with angry particles; the Parrot is warning, not becoming a combat pet. + +**Bees** feed through flowers and are generally peaceful around their work. Actual damage, breaking their hive, or harvesting a full hive with Shears or a Bottle without smoke can bring colony defense. Smoke matters, and nearby Bees already occupied with something else are not guaranteed to join every response. + +### Rivers, oceans, and caves + +**Cod, Salmon, Tropical Fish, and Pufferfish** form exact-species schools around feeding ranges. Keep suitable aquatic plants available if maintaining them. Hunger and depletion can move a school, and danger can panic fish beyond a single species. **Squid and Glow Squid** instead use separate same-species danger groups and eat dropped raw fish; they are not living-fish hunters. + +**Dolphins** hunt fish in pods and can defend an injured podmate. Hunger drives food hunts, but a real defensive incident does not require an empty stomach. **Nautiluses** hunt fish while wild and hungry; tamed ones stop autonomous hunting. Capturing a fish or Axolotl in a bucket does not by itself turn it into a tame pet. + +**Frogs** use wetland homes and hunt suitable small prey, including small arthropods and appropriately small Slimes or Magma Cubes. Both ordinary tongue kills and Retold feeding attacks can contribute meals. **Axolotls** have water-range behavior and suitable aquatic prey. They do not routinely hunt ordinary Guardians for food; a Guardian attack can instead cause retaliation or genuine assistance. + +**Bats** are active members of the cave ecosystem. They use dark supported ceiling roosts, return during the day, and seek individual hanging places. At night they can form small hunting parties, seek Spider Eyes, hunt arthropods, or catch abstract cave insects. Disturbing a roost causes panic and a delay before settling again, rather than an immediate return to the same ceiling spot. + +### Spiders, swarms, and Cubes + +Hungry **Spiders and Cave Spiders** can hunt animals and Bats at night. Daylight ends ordinary food hunting but does not prevent retaliation. Their familiar player aggression still depends on darkness. Recently fed Spiders can establish shared webbed lairs in genuinely dark sheltered places, add or repair persistent webs, and return by day. An exposed field becoming dark at night is not enough shelter. Web construction obeys the server's mob terrain-change rules. + +**Silverfish and Endermites** have separate identities and coordinate with their own species. They do not act as one interchangeable swarm. Normal survival Endermite spawning, including the Ender Pearl chance, is disabled, while existing, Creative, or command-created specimens still function. + +**Slimes and Magma Cubes** are dangerous when hungry enough and stop ordinary prey combat when fed. Even a hungry size-one member can damage a valid target. They tolerate fellow Cube creatures for ordinary targeting and do not deliberately hunt Creepers. + +Their appetite for items is separate: **even a fully fed Slime or Magma Cube can swallow every kind of dropped item**. It stores the exact stack and releases stored items on death. Feeding items also lets it grow through increasingly expensive sizes, up to size ten. Compatible same-species small natural sizes can merge, but size ten is currently a large ordinary creature, not a special boss transformation. + +At maximum hunger, larger Cubes split into smaller hungry children; size-one Cubes die. Normal splitting also passes part of the parent's hunger to its children. Keeping one fed can reduce living-prey aggression, but it does not make loose valuables safe beside it. + +### Undead and specialist enemies + +**Zombies, Husks, Drowned, Zombie Villagers, and Zombified Piglins** use hunger and local horde behavior. They can obtain meals from living victims. **Skeletons, Strays, and Bogged** do not have this hunger loop; they maintain ranged spacing, avoid firing through an Undead ally, and try to find a clearer angle. + +Stage 2 expands Undead awareness and cooperation and removes sunlight protection as a reliable player tactic. The change does not simply add health or damage. Combat fire still matters where the creature is vulnerable. Stage 3 cleanses Retold Undead across dimensions, including **Ghasts, Zoglins, and wild Zombie Nautiluses**. A name tag does not protect a wild Undead creature from stage cleansing. + +**Ghasts** retain long-range artillery behavior with Undead relationships. **Zoglins** retain aggressive rampage behavior while tolerating other Undead. **Zombie Nautiluses** keep their specialist vanilla role, with taming changing their generic Undead relationship. + +Wild **Skeleton Horses, Zombie Horses, and Camel Husks** can be hostile. Claimed mounts defend themselves and their owner without independent prey hunting. Mounting an already-tame, ownerless, riderless Skeleton Horse or Camel Husk can claim it; Zombie Horses retain their bucking and taming process. Ownership is important because claimed mounts no longer have the same generic Undead identity as wild ones. + +**Phantoms** are rare solitary open-sky threats at night or in suitable dark storm conditions. They are independent of insomnia, so sleeping is not a complete counter. They commit to a damaging swoop, then recover before stalking again. **Withers** retain their flight, heads, healing, and destruction but recognize Retold Undead relationships and choose serious living threats rather than always favoring a player. + +### Guards and encounter creatures + +**Guardians and Elder Guardians** immediately defend against suitable living intruders; they do not use the same gradual territorial warning as Illagers. Guardian beams and monument pressure can interfere with mining. The Elder is invulnerable while in water, vulnerable when exposed, and suffers drying damage. Its Water progression role requires solving that encounter rather than winning an ordinary underwater damage race. + +**Blazes, Piglin Brutes, Wither Skeletons, Shulkers, Iron Golems, and Snow Golems** have guard-purpose behavior, including returning toward posts and limiting pursuit. A guard returning home is not necessarily forgetting its faction. **Piglins and Hoglins** also have food-related behavior, while **Striders** receive passive sustenance from lava and keep Warped Fungus as a food option. + +**Pillagers, Vindicators, Ravagers, Vexes, and Illusioners** have raider or support roles. Idle raiders can roam, while structures, raids, danger, and nearby village activity can take priority. **Evokers** and appropriately allied **Witches** can support from behind other combatants. Vex direct strikes deal half their otherwise calculated damage. + +**Creepers, Endermen, Breezes, Creakings, the Ender Dragon, and the Warden** retain much of their specialist vanilla identity. Endermen ignore gaze after Stage 1 but still retaliate, with Stage 3 adding nearby group defense. The **Gale Core, Wildfire, Earth Guardian, and Aender Eye** have their own encounter or dimension roles rather than ordinary farm-animal life. + +### Supported does not always mean obtainable + +Normal survival acquisition of Sniffers and Endermites is disabled. Wardens and their usual survival route are removed, and normal End City progression does not supply Shulkers. Existing or Creative-created specimens can retain working AI. Illusioner behavior support likewise does not establish a new ordinary survival spawn route. + +Do not plan around future mob concepts as if they were installed encounters. Natural Killer Bunny reintroduction, Iceologers, the music-disc monster, the old display-statue Tuff Golem concept, and a special size-ten Slime boss remain unfinished or undecided. + +## 8 Factions and territory + +Faction relationships explain why two monsters may ignore one another, defend each other, or fight even when the player is nearby. A faction does not give every member the same diet, awareness, or combat style. Ordinary prey hunting, retaliation, and defending a structure are also different reasons for selecting a target. + +### The relationships you will notice + +| Group | Practical relationship | +| --- | --- | +| Undead | Generally tolerate other Undead and attack suitable living outsiders, excluding Creepers. Retold includes Ghasts, Zoglins, and wild Zombie Nautiluses in this family. | +| Nether Remnants | Piglins, Brutes, Blazes, and Wildfires share an alignment and oppose Undead and other threats. | +| Illagers | Structure defenders and raiders; Witches are loose allies whose combat cooperation depends on a shared active raid. | +| Village Defenders | Iron and Snow Golems protect against danger; idle Endermen and Nether Remnants are not automatic enemies. | +| Enders | Endermen and Shulkers have their own relationship family. Enderman retaliation and Stage 3 group defense are especially relevant to players. | +| Guardians | Tolerate other Guardians and immediately oppose suitable living outsiders. | +| Cubes and smaller groups | Slimes and Magma Cubes tolerate their family; Spider families, Silverfish, Endermites, and other groups have their own narrower relationships. | + +The player is not the universal first choice in every mixed fight. An Undead creature may select nearby living prey, and an enemy actively harming a defender's ally may become more urgent than another bystander. Conversely, watching two factions fight does not grant safe passage through their occupied structure. + +### Entering an occupied structure + +Four structure settings use the main territorial warning system: **Bastions, Nether Fortresses, Pillager Outposts, and Woodland Mansions**. Remnant territory applies in the Nether. A physically present defender must notice the intruder; an empty abandoned building does not warn by itself. + +A guard can observe you, issue a warning, move into a threatening position, give a final warning, and eventually attack. Look for angry particles, repeated hostile sounds, and deliberate attention or repositioning. A ranged defender may raise or charge its weapon during the final warning. These are reasons to leave, even before it fires. + +Consider an Outpost approach. If a Pillager notices you and starts warning, back away and give it space. Walking closer, lingering nearby, opening a container, or breaking blocks can add suspicion. The absence of an immediate arrow does not mean the Pillager has accepted you. At a Fortress, a Blaze can participate in the equivalent Remnant warning process. + +Territorial container rules are strict: witnessed opening of a listed container can count as stealing even before you move an item. This differs from village property, where actual protected withdrawals matter. Treat occupied Bastion or Mansion containers as an action against their defenders, not a harmless inventory preview. + +### Escalation and leaving + +Suspicion is remembered for you in that territory. Leaving the doorway or briefly moving out of sight does not instantly erase it. Once guards have lost sight, suspicion can gradually decay; repeated trespass or serious offenses can make a quick return much more dangerous. + +There is no universal safe countdown that lets you take a few actions before combat. Earlier suspicion, close approach, property interference, and direct violence change the situation. Attacking a defender can trigger immediate retaliation, and nearby allies may help. Ordinary faction assistance is not supposed to turn a peaceful warning into an instant attack merely because another guard noticed you. + +If withdrawal seems ineffective, move farther away and stop interacting with the structure or its occupants. A defender may retain a genuine attack target for a while rather than immediately returning to a warning posture. Creative or Spectator behavior is not a useful rehearsal for how the same encounter treats Survival players. + +### Stage changes and special encounters + +Living Piglin and Brute natural or structure spawning is blocked before Stage 3. Blazes still make Nether structures relevant earlier, and Stage 2 introduces roaming Wildfire encounters. Do not assume every Remnant encounter offers the same opportunity to negotiate: a roaming boss and its escorts have their own combat rules. + +New Illager patrols and raids require Stage 3. Before then, Bad Omen does not proceed into a new raid. This start rule does not cancel a raid already in progress. During an active raid, ordinary structure-warning behavior gives way to raid activity. + +Gold armor, better armor, and a good reputation are **not implemented guarantees of admission**. Reputation-gated Nether bartering, hired Brutes, Piglin followers, and employer contracts remain future work. For the current build, respond to the guards you actually encounter rather than assuming an equipment-based safe-passage rule. + +## 9 Living with Villagers + +Villagers are hungry, peaceful residents with access to local supplies. A village is therefore more than a set of trading menus and freely available chests. Sharing food can support it, while taking its property can damage your standing with witnesses. + +### Communal food and useful storage + +Villagers eat carried Bread, Carrots, Potatoes, or Beetroot first. When personal food runs out, a hungry Villager can walk to an accessible village Chest or Barrel, withdraw real food, eat one item, and carry some for later. They remember discovered stores and share that knowledge locally, but a remembered chest still needs to exist, contain food, and remain accessible. + +Player placement does not make a Chest private. If you put food storage where Villagers can use it in their village, they may take supplies from it. Animal Feeders and machine inventories are outside this communal food system. A clearly reachable Chest or Barrel is the straightforward way to provide food. + +Farmers keep a personal reserve and deposit surplus crops or Bread. This can replenish communal supplies, but it is not unlimited production: access, actual crops, danger, daily routines, and room in storage matter. If Villagers seem hungry despite nearby food, check that it is one of their foods, in an appropriate container, and reachable from a supported adjacent position. + +### Livestock care + +Some professions use real communal supplies to tend hungry adult livestock: + +| Profession | Animals | Feed used for tending | +| --- | --- | --- | +| Shepherd | Sheep and Goats | Wheat | +| Leatherworker | Cows and Mooshrooms | Wheat | +| Butcher | Pigs and Rabbits | Carrots | +| Butcher | Chickens | Wheat Seeds | + +Tending relieves hunger rather than instantly causing a birth. The same five-minute satisfaction and safety conditions still control breeding. A Butcher near two Pigs does not bypass those rules, and missing or unreachable communal feed can prevent the task. + +Animals actually tended by the village can become village-owned. Two village-owned parents can pass that ownership to offspring. Player-associated unowned livestock has protection against being newly claimed, and that protection can pass through a parent to its offspring. Simply moving an animal inside village bounds is not sufficient to claim it. + +Interacting with an already village-owned animal does not turn it into your property. Keep this distinction in mind before killing livestock beside a village: apparent proximity is not the only ownership information the world remembers. + +### Taking supplies and damaging property + +Generated village supplies and items produced or deposited by Villagers can have village ownership. Player additions remain unowned, even when they merge into the same stack. When contents are withdrawn, the unowned portion is used first. This lets you retrieve remaining player contributions without treating every item in the chest as community property. + +For example, depositing Wheat into a village store does not mark your added quantity as stolen goods. Villagers can still consume or use it. If you later withdraw everything, your remaining contribution can be removed first, but the rest may belong to the village. The chest's appearance does not show an ordinary Survival ownership counter. + +Farmer-planted or replanted crops also carry ownership through growth. Taking a mature owned crop is minor theft; destroying an immature owned crop or trampling its farmland is stronger vandalism. Player planting has its own provenance rather than automatically becoming village-owned merely because of location. Ambiguous older-world property is not universally claimed after installing an update. + +Witnesses matter. A nearby village-context Villager who can see a Survival player commit an offense can react with unhappy or angry feedback and a disapproving sound. Theft, vandalism, breaking protected storage, or directly killing owned livestock can damage vanilla reputation, affect trade relationships, and eventually lead to Iron Golem hostility. Monsters and environmental deaths are not treated as the player committing the same offense. + +The operator command `/retold village status` can inspect nearby loaded standing and possible Golem hostility. Ordinary Survival does not provide a complete reputation meter over every Villager. Respond to their feedback and keep your own supplies distinct if you do not want them used communally. + +### Trades and daily stock + +Professional adult Villagers refresh the stock of their existing offers when the Overworld day advances. This restores availability rather than rerolling the whole trade list. Wandering Traders do not use this daily refresh rule. + +Recipe teaching is a separate service described in the crafting chapter. Neither a profession nor a refreshed inventory means every planned village economy feature has been completed. Villagers remain pacifists; their food, work, property, construction, and maintenance systems provide the current village loop. + +### Iron Golems and village lighting + +Village and structure Iron Golem spawning is blocked in Stage 1. From Stage 2 onward, an otherwise eligible village uses staged construction instead of an instant Golem appearance. Normal local conditions still matter, including the agreement of five Villagers and whether a recent Golem is already nearby. + +Clerics, Librarians, Armorers, Toolsmiths, and Weaponsmiths can build. The builder needs a suitable reachable work site and one real Emerald available through Villagers or accessible village storage. It supplies the frame magically, places the Iron Blocks and Pumpkin in stages, then uses the Emerald to animate it. The visible frame is protected from player breaking while construction is active. + +Hunger, danger, sleep, trading, and disabled mob terrain changes can pause or prevent work. If no Golem appears, first check village eligibility, builder profession, accessible Emerald supplies, and the work site. Construction is not a promise that every five Villagers immediately produce a defender on demand. + +Building your own Iron Golem uses a different payment. In Survival, completing a valid frame requires at least **five experience levels**, which are spent when animation succeeds. Creative is free. Failed frames, Snow Golems, and Copper Golems are outside that charge. A Golem built by Villagers is their construction, rather than your player-summoning advancement. + +Adult Villagers also maintain eligible dry extinguished village torches in every stage. Most use a brief magical cast; Nitwits physically approach and show a temporary Flint and Steel. They can interrupt this work for more urgent needs. Supply cover against weather and keep routes open rather than assuming a Villager can continuously relight exposed torches during ongoing precipitation. + +## 10 The three world stages + +Retold divides a world's progression into three **stages**. A stage is a saved condition shared by everyone on the server, across all dimensions. It is not a character level. If one player defeats the Ender Dragon or completes the last ritual offering, the resulting changes affect the whole world. + +Stage 1 begins when the world starts. Stage 2 begins after the Ender Dragon has been defeated. Stage 3 begins when the Dragon Egg has accepted all six required sacrifices. The dragon is therefore a turning point rather than the end of Retold's survival progression. + +Your recipe knowledge and enchantment knowledge remain personal. Joining an advanced world does not automatically teach you everything its other players have learned. + +### What changes at each stage + +| World rule | Stage 1 | Stage 2 | Stage 3 | +| --- | --- | --- | --- | +| Your main direction | Establish equipment, reach the Nether and End, defeat the dragon | Gather and sacrifice six artifacts | Explore the Aender and the changed world | +| Undead and sunlight | Ordinary sunlight vulnerability remains where applicable | Sunlight no longer burns them or drives them into shelter | Retold Undead are cleansed and their spawning is blocked | +| Undead cooperation | Shorter-range coordination | Wider coordination and increased pressure from selected natural-spawn entries | Cleansing replaces this threat | +| Enderman eye contact | Can provoke an attack | No longer provokes an attack | Still ignored; nearby Endermen can defend an attacked member | +| Living Piglins and Piglin Brutes | Normal natural and structure spawning blocked | Still blocked | Enabled; protected from zombification | +| Air Temples and Woodland Mansions | Their placement is delayed | Become available | Remain available | +| Pillager Outposts | Delayed | Still delayed in this development build | Become available | +| Wildfires | No natural Retold encounters | Roaming Nether encounters begin | Encounters remain possible | +| Earth Guardian | Indestructible dormant statue | Can awaken when approached | An undefeated guardian can still awaken | +| Pillager patrols and new raids | Blocked | Blocked | Enabled | +| Overworld End portals | Lead to the End | Still lead to the End | Lead to the Aender | + +The Outpost row describes current behavior. Earlier design notes put Outposts in Stage 2, so this build's timing differs from that documented intent. + +Stage 2 makes daylight less dependable. Zombies and Skeletons can remain active outside, cooperate over greater distances, and converge on trouble. The spawning adjustment increases the relative weight of selected existing Undead entries by about a quarter. It does not raise the monster cap or guarantee a quarter more monsters, and it adds no automatic health or damage bonus. Ordinary combat fire and lava still hurt creatures that are vulnerable to them. + +Stage 3 cleansing uses Retold's Undead classification, which includes creatures such as Ghasts and Zoglins as well as familiar Zombies and Skeletons. Claimed mounts have separate ownership rules. Creepers, Spiders, Illagers, hungry predators, and other threats remain, so completing the ritual does not make the Overworld peaceful. + +### Reaching the first dragon + +The route to the first Ender Dragon still uses a **stronghold**, an underground structure containing an End portal. Craft Eyes of Ender from Ender Pearls and Blaze Powder. Endermen provide Pearls; Blazes in Nether Fortresses provide Rods that craft into Blaze Powder. A thrown Eye travels toward a stronghold; recover it when possible and follow repeated throws. An Eye can break, so bring more than the number needed for the portal. + +Find the stronghold's portal room and put Eyes into its empty portal-frame sockets. There are twelve sockets altogether, although some may already contain Eyes. Filling the last empty socket opens the portal. There is no additional Retold requirement to defeat the Wither before this first End visit. + +Recommended preparations are dependable weapons, armor, food, blocks, a ranged weapon, and a valid Overworld respawn point. Beds are dangerous in the End. End Crystals on the Obsidian towers heal the dragon; destroying those crystals removes that support, but their explosions can hurt you. Fight the dragon while avoiding its attacks and the island's edges. Retold restricts the later outer-End exploration route, described in Chapter 13. + +Defeating the dragon advances the shared world to Stage 2. The transition has sound feedback. Collect the Dragon Egg for the next stage of progression and return to prepare for several different expeditions. When Stage 3 eventually begins, players still in the vanilla End are sent to their respawn destination. Administrative commands can still reach the old End, preserving access to existing builds. + +## 11 Completing the Dragon Egg ritual + +The ritual requires six **artifacts**: special items gathered through different challenges. Four represent Air, Water, Fire, and Earth. Life and Death are separate forces, represented by a Totem of Undying and Nether Star. + +You need one accepted offering for each force across the whole world. You do not need six artifacts per player, and you do not have to gather them in a particular order. Different players can complete different expeditions and contribute to the same saved progress. + +| Force | Artifact to sacrifice | Where to obtain it | +| --- | --- | --- | +| Water | Heart of the Sea | Defeat an Elder Guardian at an Ocean Monument | +| Air | Heavy Core | Defeat the Gale Core at an Air Temple | +| Fire | Nether Reactor Core | Defeat a Wildfire in the Nether | +| Earth | Lodestone | Defeat the Earth Guardian beneath a newly generated Jungle Pyramid | +| Life | Totem of Undying | Defeat an Evoker; a Woodland Mansion provides a route before raids unlock | +| Death | Nether Star | Defeat the Wither | + +### Collecting the egg + +The egg is a block, not an item you can simply mine. A normal click makes it teleport nearby. One collection method is to let it fall onto a Torch: after locating the teleported egg, carefully excavate below it, place the Torch two blocks beneath the egg with one supporting block still between them, then remove that supporting block. The falling egg drops as an item when it reaches the Torch. A Piston can also dislodge it. Keep its landing area safe. + +### Offering an artifact + +1. Make sure the world has reached Stage 2 by defeating the Ender Dragon. +2. Place the Dragon Egg as a block somewhere you can safely reach it. +3. Hold one of the six artifacts and right-click the egg with it. +4. Read the feedback. A successful offering is absorbed, and the egg's cracking appearance reflects progress. +5. Repeat with the other five distinct artifacts whenever you obtain them. + +You do not need an altar, a surrounding block pattern, or dropped items on the ground. Use the held artifact directly on the placed egg. In Survival, each successful offering consumes one item. An offering that has already been accepted is rejected without consuming another copy. Outside Stage 2, the egg does not respond to these offerings. + +For example, suppose your group returns from an Ocean Monument with a Heart of the Sea. You hold it and use it on the egg; one Heart disappears and Water is saved as completed. A friend later defeats a Gale Core and sacrifices its Heavy Core, completing Air. Another Heart is unnecessary: using one again reports that Water has already been absorbed. The remaining checklist is Fire, Earth, Life, and Death, regardless of which player finishes each task. + +Offering the sixth distinct artifact completes the ritual. The egg hatches and disappears, and the world enters Stage 3. Decide as a group when to make that final sacrifice: it changes mobs, raid availability, and normal End-portal travel for everyone. + +### What counts and what does not + +The egg recognizes the item's identity. It does not secretly track which particular boss produced that stack. Existing valid artifacts from an older world can still work. Older Retold Water Element and Air Element items also remain accepted for compatibility, although current encounters reward Heart of the Sea and Heavy Core instead. + +Several vanilla shortcuts have changed. New buried treasure no longer supplies a Heart of the Sea. The ordinary Lodestone recipe is removed, along with new Lodestones from Ruined Portal and Bastion Bridge chest loot. Trial Chambers are not newly generated, so their usual Heavy Core route is absent. Use the guardian paths described here instead of relying on those vanilla sources. + +Water, Life, and Death artifacts can be kept before Stage 2 if you obtain them earlier; the egg still waits for Stage 2 to accept them. The Air Temple, natural Wildfire encounters, and awakened Earth Guardian have later-stage access rules. An artifact can also have another useful purpose: a Totem can save your life and a Nether Star can become a Beacon. Keep a separate copy if you want that use as well as the sacrifice. + +Progress survives ordinary saving and restarting. Old Stage 2 worlds must supply any missing required sacrifices; worlds already in Stage 3 are not sent backward by this expanded checklist. Natural end-to-end progression and upgraded-world encounters remain experimental, so an older world can require travel into newly generated terrain for a missing artifact. + +## 12 Structures and guardian expeditions + +An expedition combines finding a site, reaching its important room, understanding its defense, and bringing the reward home. The following preparation suggestions are starting points, not guarantees of an easy fight. Difficulty, terrain, equipment, and other creatures affect each encounter. + +When comparing boss health, **two health points equal one heart**. Health numbers describe the creature's body; shields, armor, and other defenses can make the actual fight longer. + +### Water at an Ocean Monument + +An **Ocean Monument** is the large Prismarine structure found underwater. A Cartographer's ordinary Ocean Explorer Map or ocean exploration can help you locate one. Retold uses the monument's Elder Guardian as the Water challenge. Newly generated monuments keep one persistent Elder rather than the usual three; older saved monuments can retain their existing Elders. + +Bring equipment for working underwater as well as fighting. Food, breathing support, blocks, tools, and a way to manage water are useful preparations. Establish a recovery point outside the monument before carrying your best supplies into it. + +The decisive rule is that **the Elder Guardian cannot be damaged while it is in water**. Repeated underwater sword strikes or arrows will not overcome this defense. Blocked attacks produce water feedback, repel the attacker or projectile, and apply Mining Fatigue III, which slows mining. The intended practical problem is to drain or otherwise expose the Elder so it is no longer in water. + +Ordinary Guardians complicate that work. They defend the monument and can call nearby allies when attacked. Mining important monument blocks increases defensive pressure. Guardians with an active, unobstructed attack on you can interrupt your mining, so a tunnel straight through the building is not always a reliable shortcut. Breaking their line of sight or dealing with nearby guards gives you room to work; a wall helps only while it actually obstructs the beam. + +Once dry, the Elder becomes vulnerable and takes drying damage as well. Its ordinary health is 80 points, or forty hearts. Defeat it and recover the guaranteed Heart of the Sea, then keep that item for the egg. Finding another buried-treasure chest will not replace this expedition's reward in the current build. + +### Air at the Air Temple + +Air Temples become available in Stage 2 above **Frozen Peaks, Jagged Peaks, and Stony Peaks**. They are high Overworld structures, not a separate dimension. Expect floating islands, smaller surrounding islands, and a Copper-and-Tuff tower well above the ground. + +For the survival discovery route, level a Cartographer to **Journeyman or higher**, then interact with that villager after Stage 2 begins. It can gain an Air Temple Explorer Map with a base price of twelve Emeralds and one Compass. The map marks the temple with an X. Existing Cartographers can gain the offer without replacing their profession or rerolling their saved trades. An eligible destination still has to be found for the offer to appear. + +Pack for a climb and for falling. Building blocks, food, a ranged weapon, and fall protection are useful. Plan a route back down before reaching the tower top. Air Temple wind pushes exposed creatures, changes between cardinal directions about every twenty seconds, and affects the surrounding airspace as well as the floors. Breezes and the Gale Core ignore that wind. + +Nearby solid cover on the **upwind** side can shelter your whole body. Upwind means the direction the wind comes from. Watch the moving wind particles, then put shelter between yourself and that direction. Protection is local: a distant wall does not block wind everywhere behind it, and a low wall may leave part of your body exposed. + +The **Gale Core** waits near the tower top and activates for nearby Survival or Adventure visitors. It has 160 health, or eighty hearts. Its first phase resembles a grounded Breeze fight. At half health it permanently changes to aerial movement, keeping its distance and using higher positions. Normal Breeze projectile deflection applies before this transition; the aerial phase removes that deflection, creating a different opportunity for ranged attacks. + +Its wind charges do not directly remove your health, but displacement, falls, and collapsing footing remain dangerous. The charges can crack nearby eligible blocks during flight and on impact, eventually breaking them without useful mining drops. Cracking is a cue to move away from that cover or floor. Containers, fluids, unbreakable blocks, and very hard blocks have exclusions; terrain changes also obey griefing and protection rules. + +If the boss or its target leaves the encounter's area, it drops pursuit and returns toward its tower home. That does not promise a full health reset or a fresh first phase. Defeat it, recover the Heavy Core, and descend carefully. The tower may have changed during the fight. Air encounter balance and presentation remain under development. + +### Fire from a roaming Wildfire + +There is no Fire temple to locate. From Stage 2 onward, **Wildfires** can appear in loaded Nether terrain near active players, accompanied by three to five Blazes. Explore the Nether and watch for the larger shielded leader. Its group can patrol in a line before spreading out for combat. + +Encounter spawning is separate from ordinary biome monster weights. It still obeys Peaceful mode, the mob-spawning rule, valid placement, and distance checks. The system makes periodic attempts, but unsuitable terrain or another nearby Wildfire can prevent success. Waiting thirty seconds does not guarantee that one will appear. + +Prepare for fire, flying enemies, and knockback near dangerous terrain. Fire Resistance can help against fire, but the close-range shockwave and being pushed into a drop remain separate problems. A route across solid ground gives you more options than a narrow ledge beside a deep lava pool. + +A Wildfire has 120 body health, or sixty hearts, armor, and **four shields**. Each shield absorbs damage before the body becomes vulnerable. Shield breaks have flame and sound feedback, and a short protected interval follows each break. Do not judge remaining progress only from the apparent size of a single hit: excess damage on one shield does not simply remove all the others. + +The leader fires stronger fireballs than an ordinary Blaze and uses a damaging shockwave against close enemies. The wave pushes nearby opponents away. Escorts remain an active threat while you concentrate on the leader, so maintain space and keep track of the whole group rather than rushing straight into melee. + +At half health, the Wildfire can retreat toward suitable deep lava. It clears combat, submerges fully, and restores both health and shields while its eyes remain under the lava. It resurfaces after a full recovery. Ordinary fire, Soul Fire, or shallow contact with lava does not provide the same recovery. A wounded leader moving down into a deep pool is therefore an important cue: allowing a long recovery can undo substantial fighting progress. + +Wildfires and their encounter escorts also fight Retold Undead, so you may find the group involved in Nether faction combat. That can change the immediate situation without making them friendly to you. Defeating the Wildfire guarantees one Nether Reactor Core for the Fire sacrifice. Retrieve it before loose items are lost in the surrounding terrain. + +### Earth beneath the Jungle Pyramid + +Every newly generated **Jungle Pyramid**, also called a Jungle Temple, includes an Earth Labyrinth below it. Existing vanilla pyramids are not retrofitted. If an old pyramid has no expanded passage, explore newly generated terrain rather than assuming a missed crafting or stage requirement. + +Solve the pyramid's familiar lever puzzle to reveal its secret room and the access route beneath it. The labyrinth is a large, seeded two-level cave maze with loops, level connections, dark branches, traps, and occasional treasure. Its layout differs between sites. Bring lighting, food, useful tools, and a way to mark your route. Feed ordinary survival needs before beginning a long search underground. + +Pressure plates can trigger dispensers containing real, finite arrow supplies. Treasure side rooms can contain metals, gems, and food. Darkness still permits ordinary natural mob spawning; these are not rooms that become safe merely because a special spawner was broken. Explore cautiously and keep the route to the pyramid identifiable. + +The **Earth Guardian** begins as an indestructible statue. In Stage 1 it cannot be defeated or moved. After Stage 2 begins, approaching its chamber as a Survival or Adventure player starts a short awakening and reveals the boss encounter. Do not waste weapons on the dormant statue. + +The awakened guardian has 250 health, or 125 hearts, and armor. It is **blind**: it investigates remembered vibration locations rather than acquiring ordinary sight of a player through walls. Walking, mining, placing blocks, using containers, projectiles, explosions, and damage can provide clues. Sneaking reduces movement noise; it does not make loud construction or mining silent. Hearing has a limited range, and it remembers a source for a time rather than tracking every player's location perfectly. + +Blindness does not remove its melee threat. When it reaches the player whose sound it remembers, it can strike at close range if there is a clear path to the hit. Its attack comes from the Iron Golem combat system, so treat it as a heavy, variable hit rather than a harmless touch. Fresh obstruction checks prevent ordinary strikes straight through a wall, but the guardian can excavate that wall. + +Watch for the environmental warnings. It can mark a remembered location and, after about 1.5 seconds, pull actual ceiling blocks down, replace a 3×3 ground patch with persistent lava, or collapse a 3×3 patch into a pit up to four blocks deep. Dust can identify threatened ceiling material; smoke and ground effects warn of hazards near the marked position. The position stops following you once selected. Move away promptly rather than remaining on the mark to finish an attack. + +The guardian can keep pursuing and striking during a warning. Its lava behaves like real lava, and pits remain after the initial fall. If there is no usable ceiling, a planned ceiling attack can become a lava attack instead. Do not rely on an open ceiling to disable the encounter's danger. + +**The guardian permanently reshapes loaded terrain.** It excavates routes and ramps and builds barriers behind itself. This can continue outside the labyrinth. Player blocks, containers, mechanisms, fluids, and even Bedrock are valid material; maze walls and the structure boundary do not contain it. Relocated containers retain their block state rather than their stored inventory data. Keep valuable storage and builds away from an active guardian. Server griefing and protection rules can limit these changes. + +Defeating the guardian permanently clears that labyrinth's encounter and yields one Lodestone. Older already-defeated encounters do not respawn merely because a later build added this reward, so an upgraded world may need another pyramid. Recover the drop carefully around persistent lava. Natural generation, pursuit, destruction, and balance still need broader playtesting. + +### Life from an Evoker + +An **Evoker** is an Illager spellcaster that drops a Totem of Undying. In Stage 2, a Woodland Mansion provides a route to one before raids become available. A Cartographer's Woodland Explorer Map can help locate a mansion. Its placement can have been delayed until this stage, so newly unlocked terrain and an older already-generated site may differ. + +Explore with a retreat route and expect other Illagers. Evokers summon hostile Vexes and use fang attacks. Give the spellcaster priority when practical rather than allowing repeated summons while fighting every nearby enemy. Retold's Vex and faction behavior can add to the pressure. + +Keep the Totem for the egg. If you want a spare for personal protection, obtain another: a Totem sacrificed in the ritual is consumed. This Life path currently uses the Evoker and Totem relationship; a separate custom Life boss or temple is not required. + +### Death from the Wither + +The **Wither** is a player-summoned boss. Obtain three Wither Skeleton Skulls from Wither Skeletons and four Soul Sand or Soul Soil blocks. Build a T shape from the four base blocks, with one central stem and three blocks across its top. Leave the spaces beside the stem empty. Put one skull on each top block, placing the final skull last. + +```text +Skull Skull Skull +Soul Soul Soul +air Soul air +``` + +This diagram is a front view. “Soul” means Soul Sand or Soul Soil. Summoning does not work in Peaceful mode. Choose the location before placing the last skull: the Wither charges up and then explodes, and its later attacks can damage the surrounding world. A site near valuable storage or village buildings is a poor place to learn the fight. + +Prepare armor, food, a reliable melee weapon, and a way to handle its flying opening. Its low-health armored phase resists ordinary arrows, making a close-range plan important. Defeating it yields the Nether Star used for Death. Retold does not currently require an earlier Wither kill to open the first End portal, so there is no need to spend a Star on an extra, invented progression gate. + +## 13 The Nether and the End + +The Nether and End are existing Minecraft dimensions with Retold changes. The Aender, covered next, is the new dimension. Air Temple and Earth Labyrinth expeditions stay in the Overworld. + +### Making your first Nether portal + +A standard Nether portal is an upright Obsidian rectangle with a **two-block-wide, three-block-high empty interior**. The complete outside rectangle is four blocks wide and five high. Its four corners may be omitted, leaving ten required Obsidian blocks. This differs from the flat Aender portal described later. + +Harvest Obsidian using a Diamond Pickaxe or another suitable later tool, then build the frame and ignite the inside with Flint and Steel. Stand in the resulting purple field to travel. Carry an igniter and record the portal's location on arrival so you can find and relight your return route if necessary. + +Choose its Overworld site carefully. Retold adds permanent environmental drain around an active Nether portal. A large portal beside your farm or wooden house can become an expensive mistake even before you visit the Nether often. + +### Understanding portal drain + +Two fronts advance through loaded surroundings. An outer front kills or withers eligible vegetation and living ground. An inner front follows behind it, converting selected materials toward Nether forms and evaporating water. A standard portal reaches an outer radius of sixteen blocks and an inner radius of eight. Larger interiors increase those radii, up to forty-eight outside; the inner radius is half, rounded down. + +Leaving the portal active permits slow background work. Successful travelers add pulses, and this includes more than players. Simply avoiding travel does not stop an active portal's background spread. Deactivating the portal stops that source; already changed terrain remains changed. + +Loaded **lava source blocks** within the affected sphere resist the spread. A source is a full originating lava block, rather than its flowing extensions. Six sources can stop further drain from a standard six-block interior after the system updates its count. Larger portals need sources equal to their interior block area. The lava is not consumed, and stopping the drain does not reverse it. + +A practical approach is to build a separate portal site away from gardens, water features, and valuable construction, then contain the required lava sources safely if you want it to remain active. Flowing lava alone is inadequate. Another option is to deactivate it between trips. Both choices need ordinary care around lava and relighting. + +Conversions follow selected material rules. Containers, protected valuable blocks, and the portal's Obsidian have exclusions, while unclassified modded blocks are not automatically converted. The system does not create lava or fire as a drain product. Do not interpret those exclusions as protection for an entire nearby building. + +### Exploring the changed Nether + +The Nether has darker classic-style lighting and dark-red fog. Crimson and Warped Forests remain biomes, but new terrain gives them scattered fungi and vegetation rather than their usual dense growth. Basalt Deltas and Soul Sand Valleys remain; the latter can also have rare solitary Wither Skeletons. Stage 2 adds Wildfires, and Stage 3 enables living Piglin populations while cleansing Undead. + +Nether fossils remain, but no longer naturally place Dried Ghasts. Crafting and existing Dried Ghasts still provide their separate hydration and growth route. New Ruined Portals retain their structures but omit their chest placement. + +### What you will not find through the usual route + +| Vanilla destination or source | Current Retold generation rule | +| --- | --- | +| Ancient Cities | No new ordinary generation | +| Trial Chambers | No new ordinary generation | +| End Cities | No new ordinary generation | +| Deep Dark | Removed from the normal fresh Overworld biome preset | +| Outer End islands and dragon gateways | Normal outer-End terrain and gateway progression suppressed | +| Warm Ocean Ruin archaeology | No normal Sniffer Egg reward | +| Villages very close to world spawn | New candidate sites within roughly 512 blocks are excluded | + +The End keeps its central dragon journey and a generated per-world sky. Normal End City Elytra and Shulker acquisition is unavailable in new-world progression, and the usual crystal arrangement does not respawn the dragon after Stage 1. After the six sacrifices, Overworld End portals take players to the Aender instead. + +These are generation and acquisition rules, not deletion of every related item or entity. Existing structures, equipment, custom datapacks, Creative, and commands can differ. Retold also delays certain structures and may place them later in eligible, unobserved areas; sufficiently edited sites can be skipped. Backups matter when updating an established world, and an old region is not a reliable demonstration of fresh generation. + +## 14 Your first Aender expedition + +The **Aender** is a bright realm of floating islands above a void. After the Dragon Egg ritual advances the world to Stage 3, enter an Overworld End portal to reach its central Obsidian landing platform. That entrance is separate from the horizontal return portals you will build inside the dimension. + +### Before you enter + +Recommended supplies include food, blocks for safe movement, dependable equipment, an Iron-or-better Pickaxe, and room for collected materials. Bring a Netherite Pickaxe if you want Aenderite Ore drops. Fall protection and a clear Overworld respawn plan are useful; they do not replace planning a return route. + +Expect permanent midday and no weather. Water flows faster and farther than in the Overworld. Emptying a lava bucket vaporizes its contents instead of placing lava. **Beds explode, and Respawn Anchors do not work**, so do not try to establish an ordinary respawn point here. + +Keep the initial landing area clear. Each entry through an Overworld End portal recreates its five-by-five Obsidian floor and clears three blocks of headroom. Storage or construction inside that footprint can be broken independently of the wider terrain's instability. + +### Gather material for a return portal + +Explore from the platform carefully and remember the route. Current fresh worlds contain Aender Plains and an experimental desert biome, with varied island heights, caves, lakes, vegetation, and hanging terrain. Older saves may use an earlier generator. Endermen and passive flying Aender Eyes inhabit the dimension. The Eyes observe from a distance and avoid close approach; they currently have no loot reward. + +Look for **Development Aender Portal Frame** deposits embedded in Aender Stone. These are clusters of material, not ready-built portals. Mine them with an Iron, Steel, Diamond, or Netherite Pickaxe; an inadequate tool can destroy the block without giving you the frame. Collect at least sixteen. + +Build your return portal on a safe supporting platform. Lay the frame flat, all at one height, with its corners included and a three-by-three air opening: + +```text +F F F F F +F . . . F +F . . . F +F . . . F +F F F F F +``` + +This is a view from above. `F` is a frame block; each dot is an empty interior position. Put a solid floor directly below the opening so you can remain inside the portal field. The field itself does not support your weight. Placing the last frame activates it automatically; no igniter is needed. Breaking the border invalidates it. + +Step into the field to travel to the Overworld. The system reuses a suitable nearby counterpart or creates one with support. Returning here through that Overworld counterpart requires a charge: entry into the Aender takes at least five seconds in Survival or Adventure and can wait longer while the arrival area is prepared. Stay in the field until travel completes. Larger horizontal portals may have rectangular interiors from three through twenty-one blocks on each side. + +### Understand where the portal leads + +Horizontal Aender portals connect only the Overworld and Aender, and their travel is unlocked in Stage 3. They do not send you back through the stronghold's End portal. + +Their coordinate rule is unusual: **Overworld X and Z multiply by eight on entry to the Aender; Aender X and Z divide by eight on return**. For example, Overworld X=100, Z=200 corresponds approximately to Aender X=800, Z=1600. A return portal at that Aender location searches around Overworld X=100, Z=200. Safe placement and world borders can adjust the exact exit. + +### Know what can disappear + +Unstable Aender terrain can regenerate when regions stop being watched or when the final player actually travels out of the dimension. Player construction, stored items, portal arrangements, and non-player creatures in unstable areas can be lost. Another player remaining somewhere else in the Aender does not preserve every region you explored. + +Saving, quitting, or restarting alone does not automatically reroll the dimension. Your edits are saved until the world's legitimate region or departure rules make that terrain change. Nevertheless, an ordinary survival base here is not a dependable permanent store. Bring valuables home and treat bridges and return arrangements as things that may need rebuilding on a later expedition. + +An **Aender Stabilizer** can preserve its own chunk and the eight surrounding chunks, forming a chunk-aligned 48×48 area through the full world height. A visible particle boundary marks protection; overlapping fields can preserve a larger area. Removing the last protection releases the area, although terrain still watched by players waits before replacement. + +The Stabilizer is currently a Creative or administrative development block without normal survival acquisition. Its existence does not mean you have missed a craftable solution. A complete earned survival building loop remains unfinished. + +### Materials to bring home + +Aender trees provide a renewable wood family: Logs, stripped forms, Planks, construction pieces, doors, signs, and boats. Natural leaves can decay and drop Saplings or Sticks; use Shears or Silk Touch to collect the leaves themselves. Saplings let you grow more trees, and logs can become Charcoal. Aender Grass spreads across Aender Soil and accepts Bonemeal. Ordinary grass-block harvesting yields Soil unless Silk Touch preserves the grass block. + +Desert islands add Aender Sand, Sandstone, and lavender Cacti. These Cacti grow to three blocks high without producing the Overworld Cactus Flower. + +Aenderite Ore favors lower portions of islands. Only a **Netherite Pickaxe** gives its proper ore drops. Silk Touch preserves the ore; otherwise it yields Raw Aenderite, with Fortune affecting the amount. Smelt or blast the raw material into an Aenderite Ingot. The material currently has no equipment or ingot crafting use, so collect it as an unfinished late-game resource rather than expecting an immediate armor upgrade. + +The Aender's terrain, return travel, multiplayer regeneration, and late-game rewards are still experimental. Discoveries here expand the current sandbox, but a separate internal teleport network, Aenderite equipment, and Nether or Aender dragon bosses are not completed progression steps. + +## 15 Other changes and experimental tools + +### Recognizing the changing world + +Endermen provide a visible stage clue as well as a behavioral one. Their eyes are purple in Stage 1, green in Stages 2 and 3, and their bodies become white with green particles in Stage 3. Eye-contact aggression stops after Stage 1, but harming them can still provoke retaliation. Color is a useful clue, not permission to attack safely. + +The Aender has bright, relatively flat lighting and green ambient particles. Its appearance does not prevent void falls or remove the instability rules. The Nether's darker presentation also does not mean every lighting rule has changed: ordinary block light, brightness settings, and vision effects still matter. + +The current boss models, Steel equipment artwork, and Aender artwork are development presentations. Animations and visual cues accompany the implemented mechanics, but final appearance and encounter readability are still being reviewed. + +### A distant figure + +Occasionally, a distant human-shaped figure can appear for a few seconds and disappear when approached or watched. It is an atmospheric effect shown to the individual player, not a creature to fight, tame, or farm. It has no combat reward. Its schedule uses game time; it is not a promise that someone else sees the same figure beside you. + +### Snowballs + +Snowballs can deal one health point in cases where an ordinary vanilla hit would be harmless. Their stronger three-point Blaze interaction remains. One health point is half a heart. This is a small combat change rather than a replacement for a dependable weapon, and ordinary target immunity rules can still matter. + +### Aender Stabilizers + +A Stabilizer protects its own chunk and the eight neighboring chunks in the Aender. That is a chunk-aligned 48×48 horizontal area through the full height, rather than a circle around its model. Particle boundaries show the protected region; the field is feedback for stability, not a physical wall that keeps enemies out. + +Overlapping fields can maintain protection when one block is removed. When the last protection disappears, watched terrain is retained until it becomes eligible to change, so removing a block does not require an immediate disappearance beneath a connected player. + +**The current build has no normal survival recipe or natural loot source for the Stabilizer.** It is available for Creative or administrative experiments. Do not plan a survival base around a recipe that the game does not yet supply. Chapter 14 explains why this matters before your first building project. + +### The Aender Chronolith + +Despite its name, the Chronolith currently works only in the **Overworld**. It is a development time-control block, with no survival recipe. Find it in Creative or obtain it administratively rather than treating it as a completed late-game reward. + +Right-click to start a channel while you have experience, remain within eight blocks, and let its beam and sound show that it is active. It ramps up its time advance, clears weather when activated, and drains experience **points**. Creative users do not pay. Only one channel can run at a time. + +Right-click again or sneak to stop. Leaving range, losing the player connection, dying or changing away from the valid situation, removing the block, running out of experience, or stopping the server also ends the channel. It advances world time; it is not a guarantee that every crop and creature receives additional simulated growth ticks. + +### Finding content in Creative + +Retold adds its items to the ordinary Creative categories beside related Minecraft objects. There is no separate Retold tab you must unlock. Search for the item's displayed name if you cannot find its category. The provisional portal frame also appears among operator utilities when the necessary permission is available. + +The old Water Element and Air Element items remain for save compatibility. Current guardian rewards are Heart of the Sea and Heavy Core. An item being present in Creative does not mean it has a current Survival recipe or natural acquisition route. + +## 16 Commands and server settings + +Commands are instructions typed into the chat or a server console. Open chat, enter the command beginning with `/`, and press Enter. Tab completion helps with names and arguments. In single player, cheats must be enabled for administrative commands; on a server, its owner decides who is an operator. + +Both Retold command roots require **operator permission level 2**. They are useful for diagnosis and experiments, but none is a required step in normal Survival progression. A new player can read the main handbook without learning the debugging controls. + +In the reference below, `` means a required value and `[value]` an optional one. Do not type the angle or square brackets. For example, `/retold stage set 2` is the real command, not `/retold stage set <2>`. + +### World and presentation commands + +| Command | What it does | +| --- | --- | +| `/retold stage get` | Show the shared world stage | +| `/retold stage set ` | Change the stage; allowed values are 1, 2, and 3 | +| `/retold village status` | Inspect nearby loaded village standing and possible Golem hostility; run as a player | +| `/retold sky get` | Show the saved vanilla End sky seed | +| `/retold sky randomize` | Randomize the vanilla End sky seed and update clients | +| `/retold testworld` | Build a content gallery above the player in the current Overworld save | +| `/retold testworld ` | Choose the gallery's minimum platform corner | + +The sky commands concern the vanilla End's generated sky, not weather or stability in the Aender. Village status is a nearby loaded-context diagnostic, not a worldwide reputation record. + +Stage changes invoke real transition behavior. Setting Stage 3 can remove Undead, change travel, and move players out of the End. Setting the stage backward does **not** rebuild terrain, resurrect removed creatures, or restore a complete previous progression state. Use a separate save for experiments. + +### Bed night skipping + +Retold's custom game rule defaults to false: + +```mcfunction +/gamerule retold:do_bed_night_skipping false +``` + +Allow ordinary night skipping with: + +```mcfunction +/gamerule retold:do_bed_night_skipping true +``` + +This setting changes the world's resting behavior. It does not implement the planned bed-healing system or make beds safe in dimensions where they explode. + +### Inspect a creature + +Most single-creature commands use the eligible mob you are looking at within approximately twenty-four blocks. Look directly at it rather than merely standing nearby. Commands that take a radius accept whole numbers from one through ninety-six. + +| Command | What it tells you | +| --- | --- | +| `/retoldbehavior toggle` | Toggle the looked-at-creature debug display | +| `/retoldbehavior toggle overlay` | Alternate form of the same toggle | +| `/retoldbehavior get` | Creature behavior identity and current state | +| `/retoldbehavior home` | Remembered home or range | +| `/retoldbehavior guardpost` | Guard-post information | +| `/retoldbehavior warning` | Territory and warning state | +| `/retoldbehavior pack` | Hunting-pack information | +| `/retoldbehavior showhomes [radius]` | Nearby home markers; default radius 32 | +| `/retoldbehavior nearby [radius]` | Nearby managed-creature summaries; default radius 24 | +| `/retoldbehavior targets [radius]` | Target candidates for the looked-at creature; default radius 18 | +| `/retoldbehavior count` | Active behavior-state and control counts | +| `/retoldbehavior perf` | AI work and cache counters | +| `/retoldbehavior perf reset` | Reset counters before another measurement | + +The debug values are not ordinary Survival HUD meters. A hunger value rising toward one hundred means the creature is hungrier; zero is well fed. Reading a state helps explain a particular animal, but it is not proof that every species uses that state in the same way. Some have no Retold metabolism. + +### Change a creature for an experiment + +| Command | Accepted value or effect | +| --- | --- | +| `/retoldbehavior sethunger ` | Set hunger from 0 to 100 | +| `/retoldbehavior addhunger ` | Adjust hunger by −100 through 100 | +| `/retoldbehavior setstress ` | Set stress from 0 to 100 | +| `/retoldbehavior addstress ` | Adjust stress by −100 through 100 | +| `/retoldbehavior setconfidence ` | Set confidence from 0 to 100 | +| `/retoldbehavior addconfidence ` | Adjust confidence by −100 through 100 | +| `/retoldbehavior setguardpost` | Set an eligible guard's post to its current position | +| `/retoldbehavior clearguardpost` | Remove its saved post | +| `/retoldbehavior clearhome` | Clear the remembered home | +| `/retoldbehavior clearcontrol` | Release its current Retold AI control | + +For example, look at an eligible Cow and run `/retoldbehavior sethunger 70` to examine hungry behavior, then inspect it with `get`. Setting a number does not add food, build a route to a feeder, or freeze that number against subsequent updates. These commands modify the test subject; do not confuse their effects with naturally occurring behavior. + +### Build a test gallery + +Create a disposable Creative world with cheats, enter the Overworld, and run `/retold testworld`. The command builds a lit aerial gallery near the world height limit and teleports you to its entrance. It builds **inside the current save** rather than creating a new save or dimension. + +The gallery uses the live catalog: currently 52 items, 37 block types, and six entity types, including boats. It supplies useful copies, workstations, equipment displays, a Dragon Egg, and ritual artifacts. Exhibit creatures are frozen, persistent, and invulnerable; they demonstrate content and rendering rather than natural AI. + +The default site is centered over your horizontal position. Explicit coordinates choose the minimum corner. At the current catalog size, reserve about **66×104×10 blocks of empty space** and keep the entire footprint loaded and ticking. Occupancy or protection failures reject construction without clearing terrain. If activation is incomplete, remain near the intended center and retry; low simulation distance can limit which sites are ready. + +The command initially preserves stage, game mode, and game rules. Interactive exhibits and supplies can still do real things: a portal can travel, a Chronolith can advance time, and using the six artifacts on the egg can advance progression. + +### Ordinary content commands + +Minecraft's `/give` and `/summon` accept Retold IDs where appropriate. Item and entity IDs are different kinds of identifiers; the complete custom catalog is in Appendix E. + +```mcfunction +/give @s retold:flint_multi_tool +/give @s retold:steel_pickaxe +/give @s retold:animal_feeder +/give @s retold:dev_aender_portal_frame 16 +/give @s retold:aender_stabilizer +/give @s retold:aender_chronolith +``` + +Here `@s` means the executing entity, so use these examples as a player. Spawn eggs and command-created bosses can behave differently from natural dormant or structure-bound encounters. Keep destructive Earth Guardians out of valuable worlds. + +### Server settings and other mods + +The ordinary Mob Griefing setting affects many Retold creature block changes: destructive forage, weak-fence breaches, Spider webs, guardian terrain attacks, and some village work. Dropped-food consumption and meals from an accessible feeder do not require destructive grazing. Disabling griefing can therefore also change how you must feed a farm. + +It is not a single switch that restores vanilla behavior or freezes all world systems. Nether portal drain and Aender regeneration have their own rules. A claim mod also needs an appropriate integration to enforce its claims through Retold's protection hooks; the hooks existing does not guarantee an adapter for every server plugin or mod. + +Datapacks can extend selected diets, factions, recipes, protected blocks, and teaching data. New recipes or loot can intentionally create alternative artifact sources. Another mod may run alongside Retold while changing its intended balance, so use the server's specific rules when they differ from this handbook. + +## 17 Current build limits and unfinished work + +This is a development-build handbook. Implemented means there is a current mechanic to explain; it does not mean every seed, natural encounter, visual effect, server, or old world has been fully verified. The most significant remaining checks concern full six-artifact progression, destructive Earth encounters, Aender travel and regeneration, upgraded saves, multiplayer, and long-term ecosystem balance. + +Some distinctions affect what you should try in Survival: + +- **Pillager Outposts currently wait for Stage 3.** Earlier design documents describe Stage 2. The handbook reports the build's behavior without treating that discrepancy as a new approved design. +- **Aender Stabilizers and Chronoliths have no ordinary survival acquisition route.** The portal frame does have a natural deposit source despite its provisional name. +- **Aenderite has ore, raw material, and Ingots, but no completed equipment or Ingot crafting uses.** +- **Certain configured Villager lessons use unavailable recipe references.** Appendix B separates them from available lessons. Direct Campfire/Smithing recipe discovery also needs further verification; successful processing is not a promise of a recipe-book unlock. +- **Turtles currently flee nearby visible eligible players**, despite the intended distinction between peaceful walking and threatening behavior. Armadillos do implement a peaceful-walking exception. Do not assume the same exception for Turtles in this build. +- **Existing or Creative content is broader than normal survival acquisition.** Supporting Sniffer, Endermite, Shulker, Warden, or Illusioner behavior does not restore their ordinary removed or unavailable generation routes. + +The following are future or incomplete systems, rather than hidden steps you are expected to discover: + +- Nether/Aender dragon bosses, a complete Aender teleport network, and finished late-game travel/building rewards. +- Piglin/Brute hiring, followers, employment contracts, and completed gold-armor/reputation admission rules. +- A complete village economy or every planned profession's society behavior beyond the present supply, property, tending, maintenance, trade, and construction loops. +- A broader sword-blocking/combat redesign, completed equipment balance, and a complete brewing overhaul. +- Hunger-paid bed healing, longer death-drop lifetimes, water/glowstone torches, and general offline crop growth. +- A special maximum-size Slime boss, natural Killer Bunny encounters, Iceologers, the proposed music-disc monster, smaller Bees, and a green Axolotl variant. + +If something differs from the handbook, first check the build version and the world's datapacks. A small reproducible report should name the dimension and stage, describe the actions and expected result, and include relevant server/client logs where available. State whether it happened in a fresh or old world and in single player or multiplayer. The support and issue links are listed at the end. + +## Appendix A Recipes and processing + +This atlas covers every added recipe file and the replaced Brick Furnace recipe, the Campfire rewritten by Retold, and selected ordinary recipes needed for the journey. It does not reproduce every unchanged Minecraft recipe. + +### Reading the diagrams + +Each letter or symbol occupies one ingredient slot. `·` means an empty slot. The legend gives the item and total quantity. Take the output to complete crafting. A shaped recipe needs the displayed arrangement; a shapeless recipe allows its ingredients in any positions. Ordinary mirrored shaped arrangements can also work. + +A recipe listing “any Planks” accepts the appropriate plank family, including Aender Planks where supported. A Log, Plank, Stick, Brick item, and Bricks block are different inputs. Recipes below use individual item counts, not stack counts. + +### Retold starter recipes + +#### Flint Multi-tool + +**Output:** 1 × Flint Multi-tool. + +**Station:** Inventory grid or Crafting Table. + +```text +F F +· S +``` + +`F` = Flint (2); `S` = Stick (1). + +#### Flint Spear + +**Output:** 1 × Flint Spear. + +**Station:** Crafting Table. + +```text +· · X +· # · +# · · +``` + +`#` = Stick (2); `X` = Flint (1). + +#### Campfire + +**Output:** 1 × Campfire. + +**Station:** Crafting Table. + +```text +· S · +S · S +L L L +``` + +`S` = Stick (3); `L` = any Log (3). + +#### Brick Furnace + +**Output:** 1 × Brick Furnace. + +**Station:** Crafting Table. + +```text +B B B +B · B +B B B +``` + +`B` = Brick (8). + +#### Animal Feeder + +**Output:** 1 × Animal Feeder. + +**Station:** Crafting Table. + +```text +P · P +P P P +``` + +`P` = any Planks (5). + +The Campfire is placed unlit. Bare Flint lights it and is consumed in Survival; it is not another crafting ingredient. Feeders are filled by interaction after placement. The Brick Furnace needs suitable fuel for processing. + +### Steel tools weapons and armor + +Use Steel Ingots in these patterns. Steel is produced in a Blast Furnace as listed in the processing table. These are the ten Steel equipment recipes; there is no Steel Horse, Nautilus, or Wolf Armor recipe. + +#### Steel Axe + +**Output:** 1 × Steel Axe. + +**Station:** Crafting Table. + +```text +X X +X # +· # +``` + +`#` = Stick (2); `X` = Steel Ingot (3). + +#### Steel Boots + +**Output:** 1 × Steel Boots. + +**Station:** Crafting Table. + +```text +X · X +X · X +``` + +`X` = Steel Ingot (4). + +#### Steel Chestplate + +**Output:** 1 × Steel Chestplate. + +**Station:** Crafting Table. + +```text +X · X +X X X +X X X +``` + +`X` = Steel Ingot (8). + +#### Steel Helmet + +**Output:** 1 × Steel Helmet. + +**Station:** Crafting Table. + +```text +X X X +X · X +``` + +`X` = Steel Ingot (5). + +#### Steel Hoe + +**Output:** 1 × Steel Hoe. + +**Station:** Crafting Table. + +```text +X X +· # +· # +``` + +`#` = Stick (2); `X` = Steel Ingot (2). + +#### Steel Leggings + +**Output:** 1 × Steel Leggings. + +**Station:** Crafting Table. + +```text +X X X +X · X +X · X +``` + +`X` = Steel Ingot (7). + +#### Steel Pickaxe + +**Output:** 1 × Steel Pickaxe. + +**Station:** Crafting Table. + +```text +X X X +· # · +· # · +``` + +`#` = Stick (2); `X` = Steel Ingot (3). + +#### Steel Shovel + +**Output:** 1 × Steel Shovel. + +**Station:** Crafting Table. + +```text +X +# +# +``` + +`#` = Stick (2); `X` = Steel Ingot (1). + +#### Steel Spear + +**Output:** 1 × Steel Spear. + +**Station:** Crafting Table. + +```text +· · X +· # · +# · · +``` + +`#` = Stick (2); `X` = Steel Ingot (1). + +#### Steel Sword + +**Output:** 1 × Steel Sword. + +**Station:** Crafting Table. + +```text +X +X +# +``` + +`#` = Stick (1); `X` = Steel Ingot (2). + +### Aender wood recipes + +Collect Aender wood from trees or grow Saplings. These are its complete custom crafting recipes. The wood can also participate in suitable ordinary generic wood recipes through its tags. Stripping a Log or Wood with an appropriate Axe is an interaction, not a crafting-grid recipe. + +#### Aender Boat + +**Output:** 1 × Aender Boat. + +**Station:** Crafting Table. + +```text +# · # +# # # +``` + +`#` = Aender Planks (5). + +#### Aender Button + +**Output:** 1 × Aender Button. + +**Station:** Inventory grid or Crafting Table. + +**Method:** combine 1 × Aender Planks in any grid positions. + +#### Aender Chest Boat + +**Output:** 1 × Aender Chest Boat. + +**Station:** Inventory grid or Crafting Table. + +**Method:** combine 1 × Chest + 1 × Aender Boat in any grid positions. + +#### Aender Door + +**Output:** 3 × Aender Door. + +**Station:** Crafting Table. + +```text +# # +# # +# # +``` + +`#` = Aender Planks (6). + +#### Aender Fence + +**Output:** 3 × Aender Fence. + +**Station:** Crafting Table. + +```text +W # W +W # W +``` + +`#` = Stick (2); `W` = Aender Planks (4). + +#### Aender Fence Gate + +**Output:** 1 × Aender Fence Gate. + +**Station:** Crafting Table. + +```text +# W # +# W # +``` + +`#` = Stick (4); `W` = Aender Planks (2). + +#### Aender Hanging Sign + +**Output:** 6 × Aender Hanging Sign. + +**Station:** Crafting Table. + +```text +X · X +# # # +# # # +``` + +`#` = Stripped Aender Log (6); `X` = Iron Chain (2). + +#### Aender Planks + +**Output:** 4 × Aender Planks. + +**Station:** Inventory grid or Crafting Table. + +**Method:** combine 1 × Aender Log or Wood, including stripped forms in any grid positions. + +#### Aender Pressure Plate + +**Output:** 1 × Aender Pressure Plate. + +**Station:** Inventory grid or Crafting Table. + +```text +# # +``` + +`#` = Aender Planks (2). + +#### Aender Sign + +**Output:** 3 × Aender Sign. + +**Station:** Crafting Table. + +```text +# # # +# # # +· X · +``` + +`#` = Aender Planks (6); `X` = Stick (1). + +#### Aender Slab + +**Output:** 6 × Aender Slab. + +**Station:** Crafting Table. + +```text +# # # +``` + +`#` = Aender Planks (3). + +#### Aender Stairs + +**Output:** 4 × Aender Stairs. + +**Station:** Crafting Table. + +```text +# · · +# # · +# # # +``` + +`#` = Aender Planks (6). + +#### Aender Trapdoor + +**Output:** 2 × Aender Trapdoor. + +**Station:** Crafting Table. + +```text +# # # +# # # +``` + +`#` = Aender Planks (6). + +#### Aender Wood + +**Output:** 3 × Aender Wood. + +**Station:** Inventory grid or Crafting Table. + +```text +# # +# # +``` + +`#` = Aender Log (4). + +#### Stripped Aender Wood + +**Output:** 3 × Stripped Aender Wood. + +**Station:** Inventory grid or Crafting Table. + +```text +# # +# # +``` + +`#` = Stripped Aender Log (4). + +### Retold processing recipes + +For furnace-style stations, put the listed input in the input slot and ordinary suitable fuel in the fuel slot. Fuel is consumed according to its burn time rather than a separate fixed recipe ratio. Campfire cooking uses a lit placed Campfire and its cooking positions. + +| Input | Station | Output | Time at normal tick speed | +| --- | --- | --- | --- | +| Raw Aenderite | Blast Furnace | 1 × Aenderite Ingot | 5 seconds | +| Raw Aenderite | Furnace | 1 × Aenderite Ingot | 10 seconds | +| Clay Ball | Lit Campfire | 1 × Brick | 30 seconds | +| burnable Log | Brick Furnace | 1 × Charcoal | 5 seconds | +| Copper Ore | Brick Furnace | 1 × Copper Ingot | 5 seconds | +| Deepslate Copper Ore | Brick Furnace | 1 × Copper Ingot | 5 seconds | +| Raw Copper | Brick Furnace | 1 × Copper Ingot | 5 seconds | +| Iron Ingot | Blast Furnace | 1 × Steel Ingot | 5 seconds | + +### Essential ordinary recipes + +These retained recipes help a newcomer follow the handbook. Wood and material variants can have their own equivalent recipes. The Oak Planks and White Bed examples below use their named materials; other wood colors and bed colors use their corresponding variants. Wooden and Stone tools remain removed despite ordinary Minecraft tutorials showing them. + +#### Oak Planks + +**Output:** 4 × Oak Planks. + +**Station:** Inventory grid or Crafting Table. + +**Method:** combine 1 × Oak Log or Oak Wood, including stripped forms in any grid positions. + +#### Stick + +**Output:** 4 × Stick. + +**Station:** Inventory grid or Crafting Table. + +```text +# +# +``` + +`#` = any Planks (2). + +#### Crafting Table + +**Output:** 1 × Crafting Table. + +**Station:** Inventory grid or Crafting Table. + +```text +# # +# # +``` + +`#` = any Planks (4). + +#### Chest + +**Output:** 1 × Chest. + +**Station:** Crafting Table. + +```text +# # # +# · # +# # # +``` + +`#` = any Planks (8). + +#### White Bed + +**Output:** 1 × White Bed. + +**Station:** Crafting Table. + +```text +# # # +X X X +``` + +`#` = White Wool (3); `X` = any Planks (3). + +#### Torch + +**Output:** 4 × Torch. + +**Station:** Inventory grid or Crafting Table. + +```text +X +# +``` + +`#` = Stick (1); `X` = Coal or Charcoal (1). + +#### Copper Pickaxe + +**Output:** 1 × Copper Pickaxe. + +**Station:** Crafting Table. + +```text +X X X +· # · +· # · +``` + +`#` = Stick (2); `X` = Copper Ingot (3). + +#### Furnace + +**Output:** 1 × Furnace. + +**Station:** Crafting Table. + +```text +# # # +# · # +# # # +``` + +`#` = Cobblestone, Blackstone, or Cobbled Deepslate (8). + +#### Blast Furnace + +**Output:** 1 × Blast Furnace. + +**Station:** Crafting Table. + +```text +I I I +I X I +# # # +``` + +`#` = Smooth Stone (3); `I` = Iron Ingot (5); `X` = Furnace (1). + +#### Iron Pickaxe + +**Output:** 1 × Iron Pickaxe. + +**Station:** Crafting Table. + +```text +X X X +· # · +· # · +``` + +`#` = Stick (2); `X` = Iron Ingot (3). + +#### Iron Sword + +**Output:** 1 × Iron Sword. + +**Station:** Crafting Table. + +```text +X +X +# +``` + +`#` = Stick (1); `X` = Iron Ingot (2). + +#### Bucket + +**Output:** 1 × Bucket. + +**Station:** Crafting Table. + +```text +# · # +· # · +``` + +`#` = Iron Ingot (3). + +#### Flint and Steel + +**Output:** 1 × Flint and Steel. + +**Station:** Inventory grid or Crafting Table. + +**Method:** combine 1 × Iron Ingot + 1 × Flint in any grid positions. + +#### Shield + +**Output:** 1 × Shield. + +**Station:** Crafting Table. + +```text +W o W +W W W +· W · +``` + +`W` = any Planks (6); `o` = Iron Ingot (1). + +#### Ladder + +**Output:** 3 × Ladder. + +**Station:** Crafting Table. + +```text +# · # +# # # +# · # +``` + +`#` = Stick (7). + +#### Bread + +**Output:** 1 × Bread. + +**Station:** Crafting Table. + +```text +# # # +``` + +`#` = Wheat (3). + +#### Bow + +**Output:** 1 × Bow. + +**Station:** Crafting Table. + +```text +· # X +# · X +· # X +``` + +`#` = Stick (3); `X` = String (3). + +#### Arrow + +**Output:** 4 × Arrow. + +**Station:** Crafting Table. + +```text +X +# +Y +``` + +`#` = Stick (1); `X` = Flint (1); `Y` = Feather (1). + +#### Paper + +**Output:** 3 × Paper. + +**Station:** Crafting Table. + +```text +# # # +``` + +`#` = Sugar Cane (3). + +#### Book + +**Output:** 1 × Book. + +**Station:** Inventory grid or Crafting Table. + +**Method:** combine 3 × Paper + 1 × Leather in any grid positions. + +#### Enchanting Table + +**Output:** 1 × Enchanting Table. + +**Station:** Crafting Table. + +```text +· B · +D # D +# # # +``` + +`#` = Obsidian (4); `B` = Book (1); `D` = Diamond (2). + +#### Anvil + +**Output:** 1 × Anvil. + +**Station:** Crafting Table. + +```text +I I I +· i · +i i i +``` + +`I` = Block of Iron (3); `i` = Iron Ingot (4). + +#### Block of Iron + +**Output:** 1 × Block of Iron. + +**Station:** Crafting Table. + +```text +# # # +# # # +# # # +``` + +`#` = Iron Ingot (9). + +#### Diamond Pickaxe + +**Output:** 1 × Diamond Pickaxe. + +**Station:** Crafting Table. + +```text +X X X +· # · +· # · +``` + +`#` = Stick (2); `X` = Diamond (3). + +#### Smithing Table + +**Output:** 1 × Smithing Table. + +**Station:** Crafting Table. + +```text +@ @ +# # +# # +``` + +`#` = any Planks (4); `@` = Iron Ingot (2). + +#### Netherite Ingot + +**Output:** 1 × Netherite Ingot. + +**Station:** Crafting Table. + +**Method:** combine 4 × Netherite Scrap + 4 × Gold Ingot in any grid positions. + +#### Netherite Upgrade Smithing Template + +**Output:** 2 × Netherite Upgrade Smithing Template. + +**Station:** Crafting Table. + +```text +# S # +# C # +# # # +``` + +`#` = Diamond (7); `C` = Netherrack (1); `S` = Netherite Upgrade Smithing Template (1). + +#### Blaze Powder + +**Output:** 2 × Blaze Powder. + +**Station:** Inventory grid or Crafting Table. + +**Method:** combine 1 × Blaze Rod in any grid positions. + +#### Eye of Ender + +**Output:** 1 × Eye of Ender. + +**Station:** Inventory grid or Crafting Table. + +**Method:** combine 1 × Ender Pearl + 1 × Blaze Powder in any grid positions. + +#### Ordinary processing needed for progression + +| Input | Station | Output and purpose | +| --- | --- | --- | +| Cobblestone | Furnace and fuel | Stone; smelt it again for Smooth Stone | +| Stone | Furnace and fuel | Smooth Stone for the Blast Furnace | +| Raw Iron | Furnace and fuel | Iron Ingot | +| Ancient Debris | Furnace or Blast Furnace and fuel | Netherite Scrap | +| Diamond Pickaxe + Netherite Ingot + Netherite Upgrade Smithing Template | Smithing Table | Netherite Pickaxe; the template and Ingot are consumed | + +The Smithing Template duplication recipe needs an existing template. It does not create your first template from Diamonds alone. Obtain the first through its ordinary acquisition route. Obsidian and portal frames are also collected or placed as blocks; the diagrams do not invent a craft for them. + +### Removed or absent recipes + +The six Wooden recipes and six Stone recipes for Axe, Hoe, Pickaxe, Shovel, Spear, and Sword are removed. The ordinary Lodestone recipe is removed. Existing items can still have uses; a removed recipe does not erase every existing stack. + +There is no current crafting recipe for an Aender Stabilizer, Aender Chronolith, Development Aender Portal Frame, Aender Sandstone, or Aenderite equipment. Frames have a natural deposit source; Stabilizer and Chronolith acquisition remains administrative/Creative. Aender Sand does not currently substitute for ordinary Sand/Red Sand in Glass smelting or TNT crafting. + +## Appendix B Villager lesson index + +Prices are Emeralds paid to learn instructions, not the price of buying the finished item. Supply the finished sample in the separate teaching slot and keep Emeralds in your inventory. The sample is returned. Profession levels that gate equipment trades do not add a corresponding mastery gate to these lessons. + +The tables below list lessons whose recipes exist in this build’s bundled defaults. Multiple cooking methods for the same output are grouped when their price matches; show the finished food. The teaching panel determines the available lesson in your world. These are source-based defaults, not a promise that another datapack preserves every entry. + +### Armorer + +| Finished sample | Emeralds | Recipe method | +| --- | --- | --- | +| Anvil | 8 | Crafting | +| Blast Furnace | 3 | Crafting | +| Diamond Boots | 10 | Crafting | +| Diamond Chestplate | 16 | Crafting | +| Diamond Helmet | 12 | Crafting | +| Diamond Leggings | 14 | Crafting | +| Golden Boots | 5 | Crafting | +| Golden Chestplate | 6 | Crafting | +| Golden Helmet | 5 | Crafting | +| Golden Leggings | 6 | Crafting | +| Iron Boots | 4 | Crafting | +| Iron Chestplate | 5 | Crafting | +| Iron Helmet | 4 | Crafting | +| Iron Leggings | 5 | Crafting | +| Shield | 4 | Crafting | +| Steel Boots | 7 | Crafting | +| Steel Chestplate | 9 | Crafting | +| Steel Helmet | 7 | Crafting | +| Steel Leggings | 9 | Crafting | + +### Butcher + +| Finished sample | Emeralds | Recipe method | +| --- | --- | --- | +| Brick Furnace | 2 | Crafting | +| Cooked Chicken | 1 | Brick Furnace, Campfire, Furnace | +| Cooked Mutton | 1 | Brick Furnace, Campfire, Furnace | +| Cooked Porkchop | 1 | Brick Furnace, Campfire, Furnace | +| Cooked Rabbit | 1 | Brick Furnace, Campfire, Furnace | +| Steak | 1 | Brick Furnace, Campfire, Furnace | + +### Cartographer + +| Finished sample | Emeralds | Recipe method | +| --- | --- | --- | +| Cartography Table | 2 | Crafting | +| Compass | 3 | Crafting | +| Empty Map | 3 | Crafting | +| Glow Item Frame | 3 | Crafting | +| Item Frame | 2 | Crafting | +| Paper | 2 | Crafting | + +### Cleric + +| Finished sample | Emeralds | Recipe method | +| --- | --- | --- | +| Blaze Powder | 3 | Crafting | +| Brewing Stand | 3 | Crafting | +| Enchanting Table | 12 | Crafting | +| Eye of Ender | 5 | Crafting | +| Fermented Spider Eye | 3 | Crafting | +| Glistering Melon Slice | 3 | Crafting | +| Golden Carrot | 3 | Crafting | +| Magma Cream | 3 | Crafting | +| Respawn Anchor | 8 | Crafting | + +### Farmer + +| Finished sample | Emeralds | Recipe method | +| --- | --- | --- | +| Beetroot Soup | 2 | Crafting | +| Bread | 1 | Crafting | +| Cake | 3 | Crafting | +| Composter | 1 | Crafting | +| Cookie | 1 | Crafting | +| Hay Bale | 1 | Crafting | +| Melon | 1 | Crafting | +| Melon Seeds | 1 | Crafting | +| Mushroom Stew | 2 | Crafting | +| Pumpkin Pie | 2 | Crafting | +| Pumpkin Seeds | 1 | Crafting | +| Wheat | 1 | Crafting | + +### Fisherman + +| Finished sample | Emeralds | Recipe method | +| --- | --- | --- | +| Barrel | 1 | Crafting | +| Campfire | 2 | Crafting | +| Cooked Cod | 1 | Brick Furnace, Campfire, Furnace | +| Cooked Salmon | 1 | Brick Furnace, Campfire, Furnace | +| Fishing Rod | 2 | Crafting | + +### Fletcher + +| Finished sample | Emeralds | Recipe method | +| --- | --- | --- | +| Arrow | 2 | Crafting | +| Bow | 3 | Crafting | +| Crossbow | 4 | Crafting | +| Dispenser | 4 | Crafting | +| Fletching Table | 2 | Crafting | +| Spectral Arrow | 3 | Crafting | +| Stick | 2 | Crafting | +| Target | 3 | Crafting | + +### Leatherworker + +| Finished sample | Emeralds | Recipe method | +| --- | --- | --- | +| Book | 2 | Crafting | +| Bundle | 3 | Crafting | +| Cauldron | 3 | Crafting | +| Glow Item Frame | 3 | Crafting | +| Item Frame | 2 | Crafting | +| Leather Boots | 2 | Crafting | +| Leather Cap | 2 | Crafting | +| Leather Pants | 2 | Crafting | +| Leather Tunic | 2 | Crafting | + +### Librarian + +| Finished sample | Emeralds | Recipe method | +| --- | --- | --- | +| Book | 3 | Crafting | +| Book and Quill | 3 | Crafting | +| Bookshelf | 3 | Crafting | +| Cartography Table | 2 | Crafting | +| Enchanting Table | 12 | Crafting | +| Lectern | 3 | Crafting | +| Paper | 1 | Crafting | + +### Mason + +| Finished sample | Emeralds | Recipe method | +| --- | --- | --- | +| Block of Quartz | 3 | Crafting | +| Brick Slab | 2 | Crafting | +| Brick Stairs | 2 | Crafting | +| Brick Wall | 2 | Crafting | +| Bricks | 2 | Crafting | +| Chiseled Stone Bricks | 3 | Crafting | +| Cut Red Sandstone | 2 | Crafting | +| Cut Sandstone | 2 | Crafting | +| Polished Andesite | 2 | Crafting | +| Polished Andesite Slab | 2 | Crafting | +| Polished Andesite Stairs | 2 | Crafting | +| Polished Diorite | 2 | Crafting | +| Polished Diorite Slab | 2 | Crafting | +| Polished Diorite Stairs | 2 | Crafting | +| Polished Granite | 2 | Crafting | +| Polished Granite Slab | 2 | Crafting | +| Polished Granite Stairs | 2 | Crafting | +| Smooth Quartz Block | 3 | Furnace | +| Stone Brick Slab | 2 | Crafting | +| Stone Brick Stairs | 2 | Crafting | +| Stone Brick Wall | 2 | Crafting | +| Stone Bricks | 2 | Crafting | +| Stonecutter | 3 | Crafting | + +### Shepherd + +| Finished sample | Emeralds | Recipe method | +| --- | --- | --- | +| Black Bed | 2 | Crafting | +| Black Carpet | 1 | Crafting | +| Blue Bed | 2 | Crafting | +| Blue Carpet | 1 | Crafting | +| Brown Bed | 2 | Crafting | +| Brown Carpet | 1 | Crafting | +| Cyan Bed | 2 | Crafting | +| Cyan Carpet | 1 | Crafting | +| Gray Bed | 2 | Crafting | +| Gray Carpet | 1 | Crafting | +| Green Bed | 2 | Crafting | +| Green Carpet | 1 | Crafting | +| Light Blue Bed | 2 | Crafting | +| Light Blue Carpet | 1 | Crafting | +| Light Gray Bed | 2 | Crafting | +| Light Gray Carpet | 1 | Crafting | +| Lime Bed | 2 | Crafting | +| Lime Carpet | 1 | Crafting | +| Loom | 2 | Crafting | +| Magenta Bed | 2 | Crafting | +| Magenta Carpet | 1 | Crafting | +| Orange Bed | 2 | Crafting | +| Orange Carpet | 1 | Crafting | +| Painting | 2 | Crafting | +| Pink Bed | 2 | Crafting | +| Pink Carpet | 1 | Crafting | +| Purple Bed | 2 | Crafting | +| Purple Carpet | 1 | Crafting | +| Red Bed | 2 | Crafting | +| Red Carpet | 1 | Crafting | +| White Bed | 2 | Crafting | +| White Carpet | 1 | Crafting | +| Yellow Bed | 2 | Crafting | +| Yellow Carpet | 1 | Crafting | + +### Toolsmith + +| Finished sample | Emeralds | Recipe method | +| --- | --- | --- | +| Copper Axe | 3 | Crafting | +| Copper Hoe | 3 | Crafting | +| Copper Pickaxe | 3 | Crafting | +| Copper Shovel | 3 | Crafting | +| Diamond Axe | 10 | Crafting | +| Diamond Hoe | 8 | Crafting | +| Diamond Pickaxe | 12 | Crafting | +| Diamond Shovel | 8 | Crafting | +| Flint Multi-tool | 3 | Crafting | +| Golden Axe | 4 | Crafting | +| Golden Hoe | 3 | Crafting | +| Golden Pickaxe | 4 | Crafting | +| Golden Shovel | 3 | Crafting | +| Grindstone | 2 | Crafting | +| Iron Axe | 4 | Crafting | +| Iron Hoe | 3 | Crafting | +| Iron Pickaxe | 4 | Crafting | +| Iron Shovel | 3 | Crafting | +| Smithing Table | 2 | Crafting | +| Steel Axe | 7 | Crafting | +| Steel Hoe | 5 | Crafting | +| Steel Pickaxe | 7 | Crafting | +| Steel Shovel | 5 | Crafting | + +### Weaponsmith + +| Finished sample | Emeralds | Recipe method | +| --- | --- | --- | +| Copper Axe | 4 | Crafting | +| Copper Spear | 4 | Crafting | +| Copper Sword | 4 | Crafting | +| Crossbow | 4 | Crafting | +| Diamond Axe | 12 | Crafting | +| Diamond Spear | 14 | Crafting | +| Diamond Sword | 14 | Crafting | +| Flint Spear | 3 | Crafting | +| Golden Axe | 5 | Crafting | +| Golden Spear | 5 | Crafting | +| Golden Sword | 5 | Crafting | +| Grindstone | 2 | Crafting | +| Iron Axe | 5 | Crafting | +| Iron Spear | 5 | Crafting | +| Iron Sword | 5 | Crafting | +| Shield | 3 | Crafting | +| Steel Axe | 8 | Crafting | +| Steel Spear | 8 | Crafting | +| Steel Sword | 8 | Crafting | + +### Configured lessons with unavailable default recipe references + +These entries remain in the teaching data but their referenced recipe is absent from the bundled defaults. They are listed here so that a missing lesson does not become a mystery or an instruction to find a different Villager. This does not mean the item itself is removed: it means this particular configured lesson has an unresolved reference. Prices shown are configured prices, not payable working offers. No gameplay reproduction is claimed for these source-level gaps. + +| Profession | Configured topic | Configured Emeralds | +| --- | --- | --- | +| Butcher | Rabbit Stew | 2 | +| Butcher | Suspicious Stew | 3 | +| Cartographer | Banner Pattern | 4 | +| Cartographer | Field Masoned Banner Pattern | 4 | +| Cartographer | Bordure Indented Banner Pattern | 4 | +| Farmer | Rabbit Stew | 3 | +| Mason | Polished Andesite Wall | 2 | +| Mason | Polished Diorite Wall | 2 | +| Mason | Polished Granite Wall | 2 | +| Shepherd | White Wool | 1 | +| Shepherd | Orange Wool | 1 | +| Shepherd | Magenta Wool | 1 | +| Shepherd | Light Blue Wool | 1 | +| Shepherd | Yellow Wool | 1 | +| Shepherd | Lime Wool | 1 | +| Shepherd | Pink Wool | 1 | +| Shepherd | Gray Wool | 1 | +| Shepherd | Light Gray Wool | 1 | +| Shepherd | Cyan Wool | 1 | +| Shepherd | Purple Wool | 1 | +| Shepherd | Blue Wool | 1 | +| Shepherd | Brown Wool | 1 | +| Shepherd | Green Wool | 1 | +| Shepherd | Red Wool | 1 | +| Shepherd | Black Wool | 1 | + +Direct Campfire and Smithing discovery also need further verification. A recipe appearing here for a lesson is not evidence that merely cooking or upgrading automatically teaches it. Refer to chapter 3 for the reliable crafting, furnace-output, and lesson workflows. + +## Appendix C Equipment and trade reference + +### Current Flint and Steel values + +These are current development values, not a final balance promise. Material mining speed is a base value, not a guaranteed time to break every block. Weapon attack attributes are not interchangeable with damage after armor, cooldown, movement, or other combat rules. + +| Equipment | Durability or defense | Important properties | +| --- | --- | --- | +| Flint Multi-tool and Flint Spear | 48 base durability | Repair material: Flint; Multi-tool base mining speed 2 | +| Steel tools and weapons | 750 base durability | Base mining speed 7 for the material; repair with Steel | +| Steel Helmet | 275 durability; 3 armor points | 1 armor toughness | +| Steel Chestplate | 400 durability; 7 armor points | 1 armor toughness | +| Steel Leggings | 375 durability; 6 armor points | 1 armor toughness | +| Steel Boots | 325 durability; 3 armor points | 1 armor toughness | +| Unenchanted Diamond tools/Spear | 64 maximum | Any enchantment restores ordinary Diamond maximum durability | +| Unenchanted Diamond player armor | Helmet 66; Chestplate 96; Leggings 90; Boots 78 | Existing damage remains when enchantments change | +| Diamond Horse/Nautilus Armor | 96 before enchanting; 528 after | Takes actual wear from hits | + +### Changed equipment trades + +These are possible offers, not a guarantee that every individual Villager displays the entire list. Smith trade levels are Novice I, Apprentice II, Journeyman III, Expert IV, and Master V. The retained common buying offers still matter for earning Emeralds and leveling the profession. + +The price column gives the configured base in Emeralds. Demand, reputation, and enchantment cost can affect the displayed price. Uses are the configured maximum trades per stock, not the number of items you can obtain forever. Professional Villagers refresh existing stock when the Overworld day advances; that refresh does not reroll their item selection. + +| Profession and minimum trade level | Possible equipment | Base Emeralds | Uses per stock | +| --- | --- | --- | --- | +| Toolsmith Apprentice; Weaponsmith Apprentice | Copper Axe | 10 | 6 | +| Armorer Apprentice | Copper Boots | 8 | 6 | +| Armorer Apprentice | Copper Chestplate | 12 | 6 | +| Armorer Apprentice | Copper Helmet | 9 | 6 | +| Toolsmith Apprentice | Copper Hoe | 8 | 6 | +| Armorer Apprentice | Copper Leggings | 11 | 6 | +| Toolsmith Apprentice | Copper Pickaxe | 12 | 6 | +| Toolsmith Apprentice | Copper Shovel | 8 | 6 | +| Weaponsmith Apprentice | Copper Spear | 12 | 6 | +| Weaponsmith Apprentice | Copper Sword | 10 | 6 | +| Toolsmith Master; Weaponsmith Master | Diamond Axe | 60 | 1 | +| Armorer Master | Diamond Boots | 48 | 1 | +| Armorer Master | Diamond Chestplate | 64 | 1 | +| Armorer Master | Diamond Helmet | 52 | 1 | +| Toolsmith Master | Diamond Hoe | 48 | 1 | +| Armorer Master | Diamond Leggings | 60 | 1 | +| Toolsmith Master | Diamond Pickaxe | 64 | 1 | +| Toolsmith Master | Diamond Shovel | 48 | 1 | +| Weaponsmith Master | Diamond Spear | 60 | 1 | +| Weaponsmith Master | Diamond Sword | 56 | 1 | +| Toolsmith Master | Enchanted Diamond Axe | 64 | 1 | +| Armorer Master | Enchanted Diamond Boots | 64 | 1 | +| Armorer Master | Enchanted Diamond Chestplate | 64 | 1 | +| Toolsmith Master | Enchanted Diamond Pickaxe | 64 | 1 | +| Weaponsmith Master | Enchanted Diamond Spear | 64 | 1 | +| Weaponsmith Master | Enchanted Diamond Sword | 64 | 1 | +| Toolsmith Expert; Weaponsmith Expert | Iron Axe | 30 | 3 | +| Armorer Expert | Iron Boots | 24 | 3 | +| Armorer Expert | Iron Chestplate | 32 | 3 | +| Armorer Expert | Iron Helmet | 26 | 3 | +| Toolsmith Expert | Iron Hoe | 24 | 3 | +| Armorer Expert | Iron Leggings | 30 | 3 | +| Toolsmith Expert | Iron Pickaxe | 32 | 3 | +| Toolsmith Expert | Iron Shovel | 24 | 3 | +| Weaponsmith Expert | Iron Spear | 30 | 3 | +| Weaponsmith Expert | Iron Sword | 28 | 3 | +| Wandering Trader; uncommon offer | Enchanted Iron Pickaxe | 36 | 1 | + +The Wandering Trader’s enchanted Iron Pickaxe has a configured base of 36 Emeralds before enchantment-related cost. It is a costly alternative, not a required first-day purchase. Steel is produced and crafted in the normal Retold progression; it is not inserted as another required smith trade tier. + +## Appendix D Enchantment catalog without spell solutions + +This index lists spell names, maximum levels, and table availability in the current defaults. It does not disclose the three-glyph words or translate their symbols. Knowing a name from this handbook does not make your character know its inscription. + +A “Yes” still requires compatible equipment, an appropriate level, no conflicting enchantment, sufficient payment, and a genuine improvement. A “No” means learning the spell through an Anvil does not make the default table reproduce it. Other acquisition routes can differ; Mending is specifically removed from new random loot and Librarian trades. + +| Enchantment | Maximum | Default table writable | +| --- | --- | --- | +| Aqua Affinity | 1 | Yes | +| Bane of Arthropods | 5 | Yes | +| Curse of Binding | 1 | No | +| Blast Protection | 4 | Yes | +| Breach | 4 | Yes | +| Channeling | 1 | Yes | +| Density | 5 | Yes | +| Depth Strider | 3 | Yes | +| Efficiency | 5 | Yes | +| Feather Falling | 4 | Yes | +| Fire Aspect | 2 | Yes | +| Fire Protection | 4 | Yes | +| Flame | 1 | Yes | +| Fortune | 3 | Yes | +| Frost Walker | 2 | No | +| Impaling | 5 | Yes | +| Infinity | 1 | Yes | +| Knockback | 2 | Yes | +| Looting | 3 | Yes | +| Loyalty | 3 | Yes | +| Luck of the Sea | 3 | Yes | +| Lunge | 3 | Yes | +| Lure | 3 | Yes | +| Mending | 1 | No | +| Multishot | 1 | Yes | +| Piercing | 4 | Yes | +| Power | 5 | Yes | +| Projectile Protection | 4 | Yes | +| Protection | 4 | Yes | +| Punch | 2 | Yes | +| Quick Charge | 3 | Yes | +| Respiration | 3 | Yes | +| Riptide | 3 | Yes | +| Sharpness | 5 | Yes | +| Silk Touch | 1 | Yes | +| Smite | 5 | Yes | +| Soul Speed | 3 | No | +| Sweeping Edge | 3 | Yes | +| Swift Sneak | 3 | No | +| Thorns | 3 | Yes | +| Unbreaking | 3 | Yes | +| Curse of Vanishing | 1 | No | +| Wind Burst | 3 | No | + +## Appendix E Complete custom content catalog + +### Items you can hold + +The catalog contains 52 Retold item types. Vanilla items with changed roles, such as Heart of the Sea, Heavy Core, Lodestone, and the Brick Furnace, keep their Minecraft identities and are described in the relevant chapters. IDs below are primarily useful for operators and modpack authors. + +| Name and item ID | Acquisition and role | +| --- | --- | +| Aender Boat — `retold:aender_boat` | Craft from Aender wood using Appendix A; follows its corresponding building/utility role. | +| Aender Button — `retold:aender_button` | Craft from Aender wood using Appendix A; follows its corresponding building/utility role. | +| Aender Cactus — `retold:aender_cactus` | Natural Aender desert plant; grows without the vanilla Cactus Flower output. | +| Aender Chest Boat — `retold:aender_chest_boat` | Craft from Aender wood using Appendix A; follows its corresponding building/utility role. | +| Aender Chronolith — `retold:aender_chronolith` | Creative/admin acquisition; Overworld experience-powered time control. | +| Aender Door — `retold:aender_door` | Craft from Aender wood using Appendix A; follows its corresponding building/utility role. | +| Aender Eye Spawn Egg — `retold:aender_eye_spawn_egg` | Creative or operator tools; creates the named creature. Not a survival recipe. | +| Aender Fence — `retold:aender_fence` | Craft from Aender wood using Appendix A; follows its corresponding building/utility role. | +| Aender Fence Gate — `retold:aender_fence_gate` | Craft from Aender wood using Appendix A; follows its corresponding building/utility role. | +| Aender Grass Block — `retold:aender_grass_block` | Natural Aender surface; Silk Touch keeps Grass, ordinary harvesting gives Soil. | +| Aender Hanging Sign — `retold:aender_hanging_sign` | Craft from Aender wood using Appendix A; follows its corresponding building/utility role. | +| Aender Leaves — `retold:aender_leaves` | Natural Aender trees; suitable Shears/Silk Touch collect Leaves; decay can supply Saplings. | +| Aender Log — `retold:aender_log` | Harvest Aender trees; craft Planks, grow more with Saplings. | +| Aender Planks — `retold:aender_planks` | Craft from Aender wood using Appendix A; follows its corresponding building/utility role. | +| Aender Pressure Plate — `retold:aender_pressure_plate` | Craft from Aender wood using Appendix A; follows its corresponding building/utility role. | +| Aender Sand — `retold:aender_sand` | Natural Aender terrain; harvest using suitable tools. | +| Aender Sandstone — `retold:aender_sandstone` | Natural Aender desert material; no current crafting recipe. | +| Aender Sapling — `retold:aender_sapling` | Aender Leaves drops; plant to grow renewable Aender trees. | +| Aender Sign — `retold:aender_sign` | Craft from Aender wood using Appendix A; follows its corresponding building/utility role. | +| Aender Slab — `retold:aender_slab` | Craft from Aender wood using Appendix A; follows its corresponding building/utility role. | +| Aender Soil — `retold:aender_soil` | Natural Aender terrain; harvest using suitable tools. | +| Aender Stabilizer — `retold:aender_stabilizer` | Creative/admin acquisition; experimental Aender 3×3-chunk stability field. | +| Aender Stairs — `retold:aender_stairs` | Craft from Aender wood using Appendix A; follows its corresponding building/utility role. | +| Aender Stone — `retold:aender_stone` | Natural Aender terrain; harvest using suitable tools. | +| Aender Trapdoor — `retold:aender_trapdoor` | Craft from Aender wood using Appendix A; follows its corresponding building/utility role. | +| Aender Wood — `retold:aender_wood` | Craft from Aender wood using Appendix A; follows its corresponding building/utility role. | +| Aenderite Ingot — `retold:aenderite_ingot` | Smelt/blast raw Aenderite; no current Ingot crafting uses. | +| Aenderite Ore — `retold:aenderite_ore` | Natural Aender islands; Netherite required for drops, Silk Touch to collect ore. | +| Air Element — `retold:air_element` | Legacy compatibility artifact; accepted by the egg, not the current guardian reward. | +| Animal Feeder — `retold:animal_feeder` | Craft five Planks; fill by interaction with suitable animal food. | +| Development Aender Portal Frame — `retold:dev_aender_portal_frame` | Mine embedded Aender deposits with Iron-tier or better correct Pickaxe; portal border. | +| Earth Guardian Spawn Egg — `retold:earth_guardian_spawn_egg` | Creative or operator tools; creates the named creature. Not a survival recipe. | +| Flint Multi-tool — `retold:flint_multi_tool` | Craft from Flint and a Stick; the opening harvesting tool. | +| Flint Spear — `retold:flint_spear` | Craft from Flint and two Sticks; an early Spear weapon. | +| Gale Core Spawn Egg — `retold:gale_core_spawn_egg` | Creative or operator tools; creates the named creature. Not a survival recipe. | +| Nether Reactor Core — `retold:nether_reactor_core` | Guaranteed Wildfire reward; Fire sacrifice. | +| Raw Aenderite — `retold:raw_aenderite` | Mine Aenderite Ore correctly; smelt/blast into an Ingot. | +| Steel Axe — `retold:steel_axe` | Blast Iron for the Ingot; craft Steel equipment using Appendix A. | +| Steel Boots — `retold:steel_boots` | Blast Iron for the Ingot; craft Steel equipment using Appendix A. | +| Steel Chestplate — `retold:steel_chestplate` | Blast Iron for the Ingot; craft Steel equipment using Appendix A. | +| Steel Helmet — `retold:steel_helmet` | Blast Iron for the Ingot; craft Steel equipment using Appendix A. | +| Steel Hoe — `retold:steel_hoe` | Blast Iron for the Ingot; craft Steel equipment using Appendix A. | +| Steel Ingot — `retold:steel_ingot` | Blast Iron for the Ingot; craft Steel equipment using Appendix A. | +| Steel Leggings — `retold:steel_leggings` | Blast Iron for the Ingot; craft Steel equipment using Appendix A. | +| Steel Pickaxe — `retold:steel_pickaxe` | Blast Iron for the Ingot; craft Steel equipment using Appendix A. | +| Steel Shovel — `retold:steel_shovel` | Blast Iron for the Ingot; craft Steel equipment using Appendix A. | +| Steel Spear — `retold:steel_spear` | Blast Iron for the Ingot; craft Steel equipment using Appendix A. | +| Steel Sword — `retold:steel_sword` | Blast Iron for the Ingot; craft Steel equipment using Appendix A. | +| Stripped Aender Log — `retold:stripped_aender_log` | Strip with an appropriate Axe; stripped Wood also has a recipe. | +| Stripped Aender Wood — `retold:stripped_aender_wood` | Strip with an appropriate Axe; stripped Wood also has a recipe. | +| Water Element — `retold:water_element` | Legacy compatibility artifact; accepted by the egg, not the current guardian reward. | +| Wildfire Spawn Egg — `retold:wildfire_spawn_egg` | Creative or operator tools; creates the named creature. Not a survival recipe. | + +### Placed states without separate custom items + +These account for the remaining registered blocks. A wall form is normally placed using its ordinary item, and an extinguished torch is created by weather rather than a separate Survival crafting recipe. + +| Block ID | Meaning | +| --- | --- | +| `retold:aender_portal` | Live noncolliding portal surface created by completing the horizontal border. | +| `retold:aender_wall_hanging_sign` | Wall-mounted Aender Sign or Hanging Sign state, placed using the corresponding sign item. | +| `retold:aender_wall_sign` | Wall-mounted Aender Sign or Hanging Sign state, placed using the corresponding sign item. | +| `retold:extinguished_copper_torch` | Unlit weather state of the corresponding normal, Soul, or Copper floor/wall torch. | +| `retold:extinguished_copper_wall_torch` | Unlit weather state of the corresponding normal, Soul, or Copper floor/wall torch. | +| `retold:extinguished_soul_torch` | Unlit weather state of the corresponding normal, Soul, or Copper floor/wall torch. | +| `retold:extinguished_soul_wall_torch` | Unlit weather state of the corresponding normal, Soul, or Copper floor/wall torch. | +| `retold:extinguished_torch` | Unlit weather state of the corresponding normal, Soul, or Copper floor/wall torch. | +| `retold:extinguished_wall_torch` | Unlit weather state of the corresponding normal, Soul, or Copper floor/wall torch. | + +### Custom entities + +| Entity ID | Role | +| --- | --- | +| `retold:aender_eye` | Passive watching/avoiding Aender flyer; no current loot reward | +| `retold:gale_core` | Air Temple boss; Heavy Core reward | +| `retold:wildfire` | Roaming Nether miniboss with Blaze escorts; Nether Reactor Core reward | +| `retold:earth_guardian` | Blind, terrain-changing labyrinth guardian; Lodestone reward | +| `retold:aender_boat` | Boat entity created by using the Aender Boat item | +| `retold:aender_chest_boat` | Chest Boat entity created by using the Aender Chest Boat item | + +The six entity registrations include two boats, not six new living species. Ordinary Minecraft creatures with Retold behavior remain their original entity types. + +## Appendix F Troubleshooting + +### I break trees but collect no Logs + +Use a correct harvesting tool such as the Flint Multi-tool. Punching can break a Log without giving its drops. Gather Flint and Sticks first, and check that the tool has not broken. + +### The Campfire will not cook + +Placed Campfires begin unlit. Use bare Flint or a suitable igniter, then put a valid input on the cooking surface. A waterlogged or otherwise invalid Campfire cannot simply be lit. Wait for the output and collect it when it pops out. + +### I have Bricks but the furnace recipe fails + +Use eight individual Brick items around an empty center, not eight Bricks blocks. This makes the Brick Furnace. A normal Furnace instead uses accepted stone material such as Cobblestone. + +### I mine deep ore and nothing useful drops + +Check the harvesting tier. Deepslate and Diamond Ore require Steel or an appropriate later tool. Steel still cannot collect Obsidian/Ancient Debris, and Aenderite Ore needs Netherite. Slow breaking does not prove a tool is correct for drops. + +### A Villager will not teach the item + +Show the finished item in the added teaching slot, choose a suitable profession, keep enough Emeralds in your inventory, and check whether you already know it. Some configured lessons have unresolved recipe references; Appendix B marks them. A normal trade slot and an ingredient sample ask different questions. + +### I own an enchanted book but the spell is unknown + +Ownership is not learning. Successfully transfer or improve the book’s compatible enchantment at an Anvil. Merely holding it, viewing it, or combining without a useful transfer does not teach the spell. + +### A known spell is missing from the table list + +Check the inserted item, existing enchantments, conflicts, maximum level, and table eligibility. A treasure spell can be known but unavailable at the table. Appendix D lists default table availability. + +### The table rejects an inscription without saying why + +That generic failure is intentional. Check the three filled slots, level, target compatibility, three Lapis, required experience levels, and whether the cast improves the item. Unknown words are not given a free validity preview. Failed casts preserve resources. + +### My animals ignore the food or feeder + +Check the species diet, the feeding route, physical access, and danger. A feeder can accept a food for one species while the animals beside it cannot eat it. Fish and several specialists do not use the ordinary land feeder. Hand-feeding items are not identical to the expanded dropped-food list. + +### My animals will not breed + +Supported adults need five calm, well-fed minutes and compatible ready partners nearby. Feeding once is not immediate love mode. Hunger, attacks, panic, age cooldowns, lack of a partner, or inaccessible food can interrupt progress. + +### An enclosure was emptied or a fence broke + +Animals can deplete forage and migrate; desperate eligible ground animals or hunting wild predators can break weak wooden barriers. Check food supply, predator access, and stronger barrier choices. A named pet also needs food while loaded. + +### The village is angry even though I only took food + +Village-produced or generated supplies can be owned property. Witnessed withdrawal, crop damage, or livestock killing can affect reputation. Your own deposited quantities are separate, but that does not make the village’s original stock yours. + +### A guarded structure attacked after I opened a chest + +Territory suspicion and village ownership are different rules. Opening listed containers can itself count as a territorial offense, even without taking an item. Prior suspicion persists, and direct harm can bypass warnings. Withdraw before escalation rather than expecting a fresh grace period. + +### The Elder Guardian takes no damage + +Check whether it is in water. Its Water-path defense blocks attacks while wet. Draining or exposing it and dealing with the ordinary Guardians is the challenge; repeated underwater hits are not the solution. + +### The egg ignores my artifact + +The world must be in Stage 2, the egg must be placed, and you must use the correct held artifact directly. Duplicates are unnecessary and rejected. Consult the six-item checklist; an altar pattern or throwing items on the ground does not replace interaction. + +### My Aender portal does not activate or I fall through it + +Use the Development Aender Portal Frame, complete the flat border including corners, and leave a valid interior. Put a solid floor under the noncolliding field. Remain in it for the travel charge; Aender entry can wait for destination preparation. Travel requires Stage 3. + +### My Aender construction disappeared + +Unstable regions can regenerate when no longer watched or after the last player travels out. The initial arrival platform is separately rebuilt and cleared on each redirected entry. Saving alone does not make every unstable building permanent, and another player elsewhere does not protect the whole dimension. + +### I cannot find an Outpost or a removed modern structure + +Outposts currently wait for Stage 3. Air Temples and Mansions become available in Stage 2. Fresh ordinary Ancient City, Trial Chamber, and End City generation is disabled; old terrain or datapacks can differ. A missing structure is not always bad luck. + +### The command is missing or rejected + +Check permission level, spelling, player-only requirements, and the current dimension. Most behavior commands also require an eligible looked-at creature. A gallery needs an empty, fully active footprint. Command output is more useful than repeatedly trying the same invalid situation. + +## Further reading and support + +Retold is independently developed by Xefensor. It is not an official Minecraft product, and its setting is independent fiction rather than official Minecraft lore. + +The handbook describes the current development source and bundled defaults. Different releases, older worlds, datapacks, or server settings can change the experience. Natural encounter balance, connected multiplayer, existing-world progression, and final visuals remain incompletely verified. No new gameplay tests are claimed by the preparation of this documentation. + +Project references: + +- [Installation and project overview](../README.md) +- [Dragon Egg ritual and Earth path](element-ritual.md) +- [Test gallery instructions](test-world.md) +- [Mod and datapack compatibility](compatibility.md) +- [Changelog](../CHANGELOG.md) and [public roadmap](../ROADMAP.md) +- [Detailed implementation status](internal/design_implementation_status.md) +- [Equipment progression](internal/tool_armor_ore_progression.md) +- [System reference](internal/retold_mod_system.md) and [mob behavior reference](internal/retold_mob_ai_system.md) + +Official downloads and support: [GitHub](https://github.com/xefensor/Retold), [Modrinth](https://modrinth.com/mod/retold), [CurseForge](https://www.curseforge.com/minecraft/mc-mods/retold), and [Discord](https://discord.gg/S3g98zEY8a). Report reproducible problems through the project's [issue tracker](https://github.com/xefensor/Retold/issues). + +This handbook was prepared with AI assistance and checked against the current source and resource catalogs. Source-level uncertainty is identified beside the affected feature; it is not a claim of a completed gameplay test. diff --git a/docs/test-world.md b/docs/test-world.md new file mode 100644 index 00000000..a4d43f2c --- /dev/null +++ b/docs/test-world.md @@ -0,0 +1,52 @@ +# Retold Test Gallery + +Create a new **Creative** world with **cheats enabled**, enter the Overworld, and run: + +```mcfunction +/retold testworld +``` + +The command builds a lit aerial gallery centered above you near the world height limit and teleports +you to its entrance after a successful build. +On a server, it requires operator permission level 2 and must be run by a player. It builds inside +the current save; it does not create a new save or dimension. + +The gallery contains: + +- every registered Retold item in a labeled frame, with usable copies in the entrance chests +- every registered Retold block, including wall torches, sign variants, complete doors, and a live horizontal Aender portal +- every registered Retold entity, plus adult and small armor stands wearing Steel equipment +- workshop stations, the six Dragon Egg sacrifices, an egg, and testing supplies + +Currently this covers **52 items, 37 blocks, and 6 entity types**. The catalog is read from the live +registries, including the legacy Water and Air Element tokens. It covers Retold content; natural +structures, complete progression paths, and the full vanilla catalog need their own tests. + +Mobs and boats are persistent, invulnerable, and frozen on the server so they stay in place without +attacking or disappearing on Peaceful. Client rendering still runs, but this is a visual inspection +gallery rather than a natural AI or encounter test. Use copies from the supply chests to try tools, +equipment, and placeable items. The portal can perform real dimension travel; the Chronolith can +be activated by interaction. + +To choose the platform's minimum corner yourself, supply block coordinates: + +```mcfunction +/retold testworld 0 300 0 +``` + +For an explicit origin, first move near the gallery's horizontal center: approximately `33, 52` +for the example above. Allow nearby chunks to become active before running the command. + +At the current catalog size, reserve **66 × 104 × 10 blocks of empty air**, starting at that corner +and extending east, south, and upward. The depth can grow as content is added. The command checks +the whole reserved space, build height, world border, loaded entity sections, entities, and Retold +world/portal protection before placing anything. An occupied or denied location is rejected. +If the area is "not fully active yet," stay near its center and retry shortly. The entire footprint +must be inside active entity-ticking chunks; very low simulation distances may need increasing. +Rejection places nothing and does not teleport you or queue a later build. Choose another empty +corner to create another gallery; running it again does not overwrite an existing one. + +The command preserves the player's game mode, world stage, and game rules. Use a disposable test +world for experiments involving the live portal, ritual, or other functional blocks. Subjective +in-game appearance, animation, shader/resource-pack comparisons, and final visual approval remain +the developer's responsibility. diff --git a/gradle.properties b/gradle.properties index b71667da..2df4f3bd 100644 --- a/gradle.properties +++ b/gradle.properties @@ -26,7 +26,7 @@ mod_name=Retold # The license summary shown by NeoForge. See LICENSE for the exact file boundary and terms. mod_license=MIT for code; All Rights Reserved for creative assets # The mod version. See https://semver.org/ -mod_version=0.4.0 +mod_version=0.5.0 # The group ID for the mod. It is only important when publishing as an artifact to a Maven repository. # This should match the base package used for the mod sources. # See https://maven.apache.org/guides/mini/guide-naming-conventions.html diff --git a/src/main/java/cz/xefensor/retold/aender/portal/RetoldAenderGameTests.java b/src/main/java/cz/xefensor/retold/aender/portal/RetoldAenderGameTests.java index 16c095b5..093f23cb 100644 --- a/src/main/java/cz/xefensor/retold/aender/portal/RetoldAenderGameTests.java +++ b/src/main/java/cz/xefensor/retold/aender/portal/RetoldAenderGameTests.java @@ -978,6 +978,12 @@ private static void contentUsesVanillaCreativeTabs(GameTestHelper helper) { Items.BREEZE_SPAWN_EGG, RetoldBlocks.GALE_CORE_SPAWN_EGG.get() ); + assertConsecutiveItems( + helper, + CreativeModeTabs.SPAWN_EGGS, + Items.IRON_GOLEM_SPAWN_EGG, + RetoldBlocks.EARTH_GUARDIAN_SPAWN_EGG.get() + ); assertConsecutiveItems( helper, CreativeModeTabs.SPAWN_EGGS, @@ -1010,6 +1016,13 @@ private static void contentUsesVanillaCreativeTabs(GameTestHelper helper) { ), "The Gale Core spawn egg must spawn Gale Cores" ); + helper.assertTrue( + SpawnEggItem.spawnsEntity( + new ItemStack(RetoldBlocks.EARTH_GUARDIAN_SPAWN_EGG.get()), + RetoldEntityTypes.EARTH_GUARDIAN.get() + ), + "The Earth Guardian spawn egg must spawn Earth Guardians" + ); helper.succeed(); } diff --git a/src/main/java/cz/xefensor/retold/behavior/control/RetoldAiControlOwner.java b/src/main/java/cz/xefensor/retold/behavior/control/RetoldAiControlOwner.java index 77cdf409..611efe42 100644 --- a/src/main/java/cz/xefensor/retold/behavior/control/RetoldAiControlOwner.java +++ b/src/main/java/cz/xefensor/retold/behavior/control/RetoldAiControlOwner.java @@ -20,6 +20,7 @@ public enum RetoldAiControlOwner { WILDFIRE_ESCORT_COMBAT, WILDFIRE_COMBAT, WILDFIRE_RECOVERY, + EARTH_GUARDIAN, UNDEAD_HORDE, UNDEAD_RANGED, UNDEAD_MOUNT, diff --git a/src/main/java/cz/xefensor/retold/behavior/performance/RetoldPerMobTpsGameTests.java b/src/main/java/cz/xefensor/retold/behavior/performance/RetoldPerMobTpsGameTests.java index b0c3d4ce..711914a3 100644 --- a/src/main/java/cz/xefensor/retold/behavior/performance/RetoldPerMobTpsGameTests.java +++ b/src/main/java/cz/xefensor/retold/behavior/performance/RetoldPerMobTpsGameTests.java @@ -11,6 +11,7 @@ import cz.xefensor.retold.stage.RetoldWorldData; import cz.xefensor.retold.stage.RetoldWorldStage; import cz.xefensor.retold.villager.RetoldVillagerCommunalSupply; +import cz.xefensor.retold.worldgen.earth.EarthGuardian; import net.minecraft.core.BlockPos; import net.minecraft.core.GlobalPos; @@ -122,6 +123,7 @@ public final class RetoldPerMobTpsGameTests { "dolphin", "donkey", "drowned", + "earth_guardian", "elder_guardian", "ender_dragon", "enderman", @@ -228,7 +230,7 @@ private static void runBenchmark( GameTestHelper helper, String mobPath ) { - Identifier entityId = mobPath.equals("wildfire") + Identifier entityId = mobPath.equals("wildfire") || mobPath.equals("earth_guardian") ? Identifier.fromNamespaceAndPath(Retold.MODID, mobPath) : Identifier.withDefaultNamespace(mobPath); @@ -332,6 +334,15 @@ private static void spawnSubjects( mob.setSilent(true); stabilizeDimensionSpecificMob(mob); + if (mob instanceof EarthGuardian earthGuardian) { + earthGuardian.finalizeSpawn( + level, + level.getCurrentDifficultyAt(earthGuardian.blockPosition()), + EntitySpawnReason.COMMAND, + null + ); + } + if (mob instanceof AbstractCubeMob cubeMob) { cubeMob.setSize(4, true); } diff --git a/src/main/java/cz/xefensor/retold/client/RetoldClientEvents.java b/src/main/java/cz/xefensor/retold/client/RetoldClientEvents.java index 2733403a..6b083564 100644 --- a/src/main/java/cz/xefensor/retold/client/RetoldClientEvents.java +++ b/src/main/java/cz/xefensor/retold/client/RetoldClientEvents.java @@ -7,6 +7,10 @@ import cz.xefensor.retold.client.enchanting.RetoldEnchantmentTooltip; import cz.xefensor.retold.client.recipe.RetoldClientRecipeKnowledge; import cz.xefensor.retold.client.render.GaleCoreRenderer; +import cz.xefensor.retold.client.render.GaleCoreModel; +import cz.xefensor.retold.client.render.GaleCoreArmorModel; +import cz.xefensor.retold.client.render.EarthGuardianModel; +import cz.xefensor.retold.client.render.EarthGuardianRenderer; import cz.xefensor.retold.client.render.WildfireRenderer; import cz.xefensor.retold.client.render.WildfireModel; import cz.xefensor.retold.client.render.RetoldAenderEyeRenderer; @@ -40,6 +44,15 @@ public final class RetoldClientEvents { Identifier.fromNamespaceAndPath(Retold.MODID, "wildfire"), "main" ); + public static final ModelLayerLocation EARTH_GUARDIAN_LAYER = new ModelLayerLocation( + Identifier.fromNamespaceAndPath(Retold.MODID, "earth_guardian"), "main" + ); + public static final ModelLayerLocation GALE_CORE_LAYER = new ModelLayerLocation( + Identifier.fromNamespaceAndPath(Retold.MODID, "gale_core"), "main" + ); + public static final ModelLayerLocation GALE_CORE_ARMOR_LAYER = new ModelLayerLocation( + Identifier.fromNamespaceAndPath(Retold.MODID, "gale_core"), "armor" + ); private static final ModelLayerLocation AENDER_BOAT_LAYER = new ModelLayerLocation( Identifier.fromNamespaceAndPath(Retold.MODID, "boat/aender"), "main" @@ -97,6 +110,10 @@ private static void registerEntityRenderers(EntityRenderersEvent.RegisterRendere RetoldEntityTypes.WILDFIRE.get(), WildfireRenderer::new ); + event.registerEntityRenderer( + RetoldEntityTypes.EARTH_GUARDIAN.get(), + EarthGuardianRenderer::new + ); event.registerEntityRenderer( RetoldEntityTypes.AENDER_BOAT.get(), context -> new BoatRenderer(context, AENDER_BOAT_LAYER) @@ -108,6 +125,9 @@ private static void registerEntityRenderers(EntityRenderersEvent.RegisterRendere } private static void registerLayerDefinitions(EntityRenderersEvent.RegisterLayerDefinitions event) { + event.registerLayerDefinition(EARTH_GUARDIAN_LAYER, EarthGuardianModel::createBodyLayer); + event.registerLayerDefinition(GALE_CORE_LAYER, GaleCoreModel::createBodyLayer); + event.registerLayerDefinition(GALE_CORE_ARMOR_LAYER, GaleCoreArmorModel::createBodyLayer); event.registerLayerDefinition(WILDFIRE_LAYER, WildfireModel::createBodyLayer); event.registerLayerDefinition(AENDER_BOAT_LAYER, BoatModel::createBoatModel); event.registerLayerDefinition(AENDER_CHEST_BOAT_LAYER, BoatModel::createChestBoatModel); diff --git a/src/main/java/cz/xefensor/retold/client/render/EarthGuardianModel.java b/src/main/java/cz/xefensor/retold/client/render/EarthGuardianModel.java new file mode 100644 index 00000000..32d7a8b2 --- /dev/null +++ b/src/main/java/cz/xefensor/retold/client/render/EarthGuardianModel.java @@ -0,0 +1,80 @@ +package cz.xefensor.retold.client.render; + +import cz.xefensor.retold.worldgen.earth.EarthGuardianLifecycle; +import net.minecraft.client.model.EntityModel; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; +import net.minecraft.util.Mth; + +/** Original stone statue geometry; poses consume existing encounter and melee synchronization. */ +public final class EarthGuardianModel extends EntityModel { + private final ModelPart head; + private final ModelPart body; + private final ModelPart rightArm; + private final ModelPart leftArm; + private final ModelPart rightLeg; + private final ModelPart leftLeg; + + public EarthGuardianModel(ModelPart root) { + super(root); + head = root.getChild("head"); + body = root.getChild("body"); + rightArm = root.getChild("right_arm"); + leftArm = root.getChild("left_arm"); + rightLeg = root.getChild("right_leg"); + leftLeg = root.getChild("left_leg"); + } + + public static LayerDefinition createBodyLayer() { + // 43 model pixels at the established 1.18 scale match the existing 3.2-block boss height. + MeshDefinition mesh = new MeshDefinition(); + PartDefinition root = mesh.getRoot(); + root.addOrReplaceChild("head", CubeListBuilder.create().texOffs(0, 0) + .addBox(-4.0F, -8.0F, -4.0F, 8.0F, 8.0F, 8.0F), PartPose.offset(0.0F, -11.0F, 0.0F)); + root.addOrReplaceChild("body", CubeListBuilder.create().texOffs(0, 16) + .addBox(-6.0F, 0.0F, -3.0F, 12.0F, 19.0F, 6.0F) + .texOffs(0, 40).addBox(-5.0F, 2.0F, -4.0F, 10.0F, 6.0F, 1.0F), + PartPose.offset(0.0F, -11.0F, 0.0F)); + for (int side = -1; side <= 1; side += 2) { + root.addOrReplaceChild(side < 0 ? "right_arm" : "left_arm", CubeListBuilder.create() + .texOffs(40, 0).addBox(-3.0F, -2.0F, -3.0F, 6.0F, 28.0F, 6.0F) + .texOffs(64, 0).addBox(-4.0F, -3.0F, -4.0F, 8.0F, 5.0F, 8.0F) + .texOffs(64, 16).addBox(-3.5F, 18.0F, -3.5F, 7.0F, 8.0F, 7.0F), + PartPose.offset(side * 8.5F, -9.0F, 0.0F)); + root.addOrReplaceChild(side < 0 ? "right_leg" : "left_leg", CubeListBuilder.create() + .texOffs(40, 32).addBox(-2.5F, 0.0F, -2.5F, 5.0F, 16.0F, 5.0F), + PartPose.offset(side * 3.5F, 8.0F, 0.0F)); + } + return LayerDefinition.create(mesh, 128, 64); + } + + @Override + public void setupAnim(EarthGuardianRenderState state) { + super.setupAnim(state); + float awake = switch (state.lifecycle) { + case DORMANT, DEFEATED -> 0.0F; + case AWAKENING -> Mth.clamp(state.awakeningProgress, 0.0F, 1.0F); + case ROAMING -> 1.0F; + }; + float eased = awake * awake * (3.0F - 2.0F * awake); + head.xRot = (1.0F - eased) * 0.35F + state.xRot * Mth.DEG_TO_RAD * eased; + head.yRot = state.yRot * Mth.DEG_TO_RAD * eased; + body.xRot = (1.0F - eased) * 0.08F; + rightArm.xRot = leftArm.xRot = (1.0F - eased) * -0.18F; + if (state.lifecycle == EarthGuardianLifecycle.ROAMING) { + float stride = Mth.cos(state.walkAnimationPos * 0.6662F) * state.walkAnimationSpeed; + rightLeg.xRot = stride * 0.9F; + leftLeg.xRot = -stride * 0.9F; + rightArm.xRot = -stride * 0.55F; + leftArm.xRot = stride * 0.55F; + if (state.attackTicksRemaining > 0.0F) { + float swing = Mth.triangleWave(state.attackTicksRemaining, 10.0F); + rightArm.xRot = leftArm.xRot = -1.7F + 1.5F * swing; + } + } + } +} diff --git a/src/main/java/cz/xefensor/retold/client/render/EarthGuardianRenderState.java b/src/main/java/cz/xefensor/retold/client/render/EarthGuardianRenderState.java new file mode 100644 index 00000000..798fdbc2 --- /dev/null +++ b/src/main/java/cz/xefensor/retold/client/render/EarthGuardianRenderState.java @@ -0,0 +1,10 @@ +package cz.xefensor.retold.client.render; + +import cz.xefensor.retold.worldgen.earth.EarthGuardianLifecycle; +import net.minecraft.client.renderer.entity.state.LivingEntityRenderState; + +public final class EarthGuardianRenderState extends LivingEntityRenderState { + public EarthGuardianLifecycle lifecycle = EarthGuardianLifecycle.DORMANT; + public float awakeningProgress; + public float attackTicksRemaining; +} diff --git a/src/main/java/cz/xefensor/retold/client/render/EarthGuardianRenderer.java b/src/main/java/cz/xefensor/retold/client/render/EarthGuardianRenderer.java new file mode 100644 index 00000000..fe677bbc --- /dev/null +++ b/src/main/java/cz/xefensor/retold/client/render/EarthGuardianRenderer.java @@ -0,0 +1,57 @@ +package cz.xefensor.retold.client.render; + +import com.mojang.blaze3d.vertex.PoseStack; +import cz.xefensor.retold.Retold; +import cz.xefensor.retold.client.RetoldClientEvents; +import cz.xefensor.retold.worldgen.earth.EarthGuardian; +import net.minecraft.client.renderer.entity.EntityRendererProvider; +import net.minecraft.client.renderer.entity.MobRenderer; +import net.minecraft.resources.Identifier; +import net.minecraft.world.phys.AABB; + +public final class EarthGuardianRenderer + extends MobRenderer { + private static final Identifier TEXTURE = Identifier.fromNamespaceAndPath(Retold.MODID, + "textures/entity/earth_guardian.png" + ); + + public EarthGuardianRenderer(EntityRendererProvider.Context context) { + super(context, new EarthGuardianModel(context.bakeLayer(RetoldClientEvents.EARTH_GUARDIAN_LAYER)), 0.9F); + } + + @Override + protected AABB getBoundingBoxForCulling(EarthGuardian entity) { + // Melee arms extend above and ahead of the body. Body yaw can turn their reach onto + // either world horizontal axis, so both margins must cover the full swept silhouette. + return super.getBoundingBoxForCulling(entity).inflate(1.5D, 1.25D, 1.5D); + } + + @Override + public Identifier getTextureLocation(EarthGuardianRenderState state) { + return TEXTURE; + } + + @Override + public EarthGuardianRenderState createRenderState() { + return new EarthGuardianRenderState(); + } + + @Override + public void extractRenderState( + EarthGuardian entity, + EarthGuardianRenderState state, + float partialTicks + ) { + super.extractRenderState(entity, state, partialTicks); + state.attackTicksRemaining = entity.getAttackAnimationTick() > 0.0F + ? entity.getAttackAnimationTick() - partialTicks + : 0.0F; + state.lifecycle = entity.lifecycle(); + state.awakeningProgress = entity.awakeningProgress(partialTicks); + } + + @Override + protected void scale(EarthGuardianRenderState state, PoseStack poseStack) { + poseStack.scale(1.18F, 1.18F, 1.18F); + } +} diff --git a/src/main/java/cz/xefensor/retold/client/render/GaleCoreArmorModel.java b/src/main/java/cz/xefensor/retold/client/render/GaleCoreArmorModel.java new file mode 100644 index 00000000..94f7a7d0 --- /dev/null +++ b/src/main/java/cz/xefensor/retold/client/render/GaleCoreArmorModel.java @@ -0,0 +1,74 @@ +package cz.xefensor.retold.client.render; + +import net.minecraft.client.model.EntityModel; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; +import net.minecraft.client.renderer.entity.state.BreezeRenderState; +import net.minecraft.util.Mth; + +/** Original low-detail commander accents, driven by the vanilla Breeze animation state. */ +public final class GaleCoreArmorModel extends EntityModel { + private final GaleCoreModel poseModel; + private final ModelPart body; + private final ModelPart head; + private final ModelPart core; + private final ModelPart[] guards = new ModelPart[4]; + + public GaleCoreArmorModel(ModelPart root, GaleCoreModel poseModel) { + super(root); + this.poseModel = poseModel; + body = root.getChild("body"); + head = body.getChild("head"); + core = body.getChild("core"); + for (int index = 0; index < guards.length; index++) { + guards[index] = core.getChild("guard_" + index); + } + } + + public static LayerDefinition createBodyLayer() { + MeshDefinition mesh = new MeshDefinition(); + PartDefinition body = mesh.getRoot().addOrReplaceChild("body", CubeListBuilder.create(), PartPose.ZERO); + PartDefinition head = body.addOrReplaceChild("head", CubeListBuilder.create(), PartPose.offset(0.0F, 4.0F, 0.0F)); + PartDefinition core = body.addOrReplaceChild("core", CubeListBuilder.create(), PartPose.offset(0.0F, 9.0F, 0.0F)); + for (int index = 0; index < 4; index++) { + // A shallow cool circlet leaves the Breeze's broad brows and face unobstructed. + head.addOrReplaceChild("crown_" + index, CubeListBuilder.create().texOffs(14, 0) + .addBox(-4.0F, -8.25F, -4.25F, 8.0F, 1.0F, 0.5F) + .addBox(-3.0F, -8.75F, -4.25F, 1.0F, 0.5F, 0.5F) + .addBox(2.0F, -8.75F, -4.25F, 1.0F, 0.5F, 0.5F), + PartPose.rotation(0.0F, index * Mth.HALF_PI, 0.0F)); + float angle = Mth.PI * 0.25F + index * Mth.HALF_PI; + // Thin diagonal plates preserve a frontal gap around the reward. + core.addOrReplaceChild("guard_" + index, CubeListBuilder.create().texOffs(0, 0) + .addBox(-2.5F, -4.0F, -0.5F, 5.0F, 8.0F, 1.0F), + PartPose.offsetAndRotation(Mth.sin(angle) * 7.0F, 0.0F, -Mth.cos(angle) * 7.0F, + 0.0F, -angle, 0.0F)); + } + return LayerDefinition.create(mesh, 32, 32); + } + + @Override + public void setupAnim(BreezeRenderState state) { + super.setupAnim(state); + // Independent posing avoids depending on deferred collector submission order. + poseModel.setupAnim(state); + body.loadPose(poseModel.body().storePose()); + head.loadPose(poseModel.head().storePose()); + core.loadPose(poseModel.heavyCoreAnchor().storePose()); + float breath = state.inhale.isStarted() ? 1.0F : 0.0F; + float shot = state.shoot.isStarted() + ? Mth.sin(Mth.clamp(state.shoot.getTimeInMillis(state.ageInTicks) / 500.0F, 0.0F, 1.0F) * Mth.PI) + : 0.0F; + for (int index = 0; index < guards.length; index++) { + float angle = Mth.PI * 0.25F + index * Mth.HALF_PI; + float radius = 7.0F - breath * 0.5F + shot * 0.5F; + guards[index].x = Mth.sin(angle) * radius; + guards[index].z = -Mth.cos(angle) * radius; + guards[index].y = Mth.sin(state.ageInTicks * 0.08F + index) * 0.25F; + } + } +} diff --git a/src/main/java/cz/xefensor/retold/client/render/GaleCoreDetailLayer.java b/src/main/java/cz/xefensor/retold/client/render/GaleCoreDetailLayer.java new file mode 100644 index 00000000..45ff4f70 --- /dev/null +++ b/src/main/java/cz/xefensor/retold/client/render/GaleCoreDetailLayer.java @@ -0,0 +1,48 @@ +package cz.xefensor.retold.client.render; + +import com.mojang.blaze3d.vertex.PoseStack; +import cz.xefensor.retold.Retold; +import cz.xefensor.retold.client.RetoldClientEvents; +import net.minecraft.client.model.geom.EntityModelSet; +import net.minecraft.client.model.geom.ModelLayers; +import net.minecraft.client.model.monster.breeze.BreezeModel; +import net.minecraft.client.renderer.SubmitNodeCollector; +import net.minecraft.client.renderer.entity.LivingEntityRenderer; +import net.minecraft.client.renderer.entity.RenderLayerParent; +import net.minecraft.client.renderer.entity.layers.RenderLayer; +import net.minecraft.client.renderer.rendertype.RenderTypes; +import net.minecraft.client.renderer.texture.OverlayTexture; +import net.minecraft.resources.Identifier; + +/** Installed Breeze wind and glowing face with a separate original commander armor material. */ +public final class GaleCoreDetailLayer extends RenderLayer { + private static final Identifier WIND = Identifier.withDefaultNamespace("textures/entity/breeze/breeze_wind.png"); + private static final Identifier EYES = Identifier.withDefaultNamespace("textures/entity/breeze/breeze_eyes.png"); + private static final Identifier ARMOR = Identifier.fromNamespaceAndPath(Retold.MODID, "textures/entity/gale_core.png"); + private final BreezeModel wind; + private final BreezeModel eyes; + private final GaleCoreArmorModel armor; + + public GaleCoreDetailLayer(RenderLayerParent renderer, EntityModelSet models) { + super(renderer); + wind = new BreezeModel(models.bakeLayer(ModelLayers.BREEZE_WIND)); + eyes = new BreezeModel(models.bakeLayer(ModelLayers.BREEZE_EYES)); + armor = new GaleCoreArmorModel(models.bakeLayer(RetoldClientEvents.GALE_CORE_ARMOR_LAYER), + new GaleCoreModel(models.bakeLayer(ModelLayers.BREEZE))); + } + + @Override + public void submit(PoseStack poseStack, SubmitNodeCollector collector, int lightCoords, + GaleCoreRenderState state, float yRot, float xRot) { + if (state.isInvisible) { + return; + } + collector.submitModel(armor, state, poseStack, RenderTypes.entityCutout(ARMOR), lightCoords, + LivingEntityRenderer.getOverlayCoords(state, 0.0F), state.outlineColor, null); + collector.order(1).submitModel(wind, state, poseStack, + RenderTypes.breezeWind(WIND, state.ageInTicks * 0.02F % 1.0F, 0.0F), + lightCoords, OverlayTexture.NO_OVERLAY, state.outlineColor, null); + collector.order(1).submitModel(eyes, state, poseStack, RenderTypes.breezeEyes(EYES), + lightCoords, OverlayTexture.NO_OVERLAY, state.outlineColor, null); + } +} diff --git a/src/main/java/cz/xefensor/retold/client/render/GaleCoreHeavyCoreLayer.java b/src/main/java/cz/xefensor/retold/client/render/GaleCoreHeavyCoreLayer.java new file mode 100644 index 00000000..c1b9678d --- /dev/null +++ b/src/main/java/cz/xefensor/retold/client/render/GaleCoreHeavyCoreLayer.java @@ -0,0 +1,36 @@ +package cz.xefensor.retold.client.render; + +import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.renderer.SubmitNodeCollector; +import net.minecraft.client.renderer.entity.LivingEntityRenderer; +import net.minecraft.client.renderer.entity.RenderLayerParent; +import net.minecraft.client.renderer.entity.layers.RenderLayer; + +/** Render the actual installed reward model, allowing resource packs to replace it normally. */ +public final class GaleCoreHeavyCoreLayer extends RenderLayer { + public GaleCoreHeavyCoreLayer(RenderLayerParent renderer) { + super(renderer); + } + + @Override + public void submit(PoseStack poseStack, SubmitNodeCollector collector, int lightCoords, + GaleCoreRenderState state, float yRot, float xRot) { + if (state.isInvisible || state.heavyCore.isEmpty()) { + return; + } + poseStack.pushPose(); + applyCorePose(poseStack, getParentModel().body(), getParentModel().heavyCoreAnchor()); + state.heavyCore.submitMultiLayer(poseStack, collector, lightCoords, + LivingEntityRenderer.getOverlayCoords(state, 0.0F), state.outlineColor); + poseStack.popPose(); + } + + static void applyCorePose(PoseStack poseStack, ModelPart body, ModelPart anchor) { + body.translateAndRotate(poseStack); + anchor.translateAndRotate(poseStack); + // Convert the living model's downward Y to block coordinates and center its half-block cube. + poseStack.scale(1.0F, -1.0F, -1.0F); + poseStack.translate(-0.5F, -0.25F, -0.5F); + } +} diff --git a/src/main/java/cz/xefensor/retold/client/render/GaleCoreModel.java b/src/main/java/cz/xefensor/retold/client/render/GaleCoreModel.java new file mode 100644 index 00000000..927f69cf --- /dev/null +++ b/src/main/java/cz/xefensor/retold/client/render/GaleCoreModel.java @@ -0,0 +1,44 @@ +package cz.xefensor.retold.client.render; + +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.monster.breeze.BreezeModel; +import net.minecraft.client.renderer.entity.state.BreezeRenderState; + +import java.util.List; +import java.util.Map; + +/** Installed Breeze silhouette and animations; floating armor replaces its rods. */ +public final class GaleCoreModel extends BreezeModel { + private final ModelPart body; + private final ModelPart core = new ModelPart(List.of(), Map.of()); + + public GaleCoreModel(ModelPart root) { + super(root); + body = root.getChild("body"); + core.setInitialPose(PartPose.offset(0.0F, 9.0F, 0.0F)); + core.resetPose(); + rods().visible = false; + } + + public ModelPart body() { + return body; + } + + public ModelPart heavyCoreAnchor() { + return core; + } + + public static LayerDefinition createBodyLayer() { + return BreezeModel.createBodyLayer(); + } + + @Override + public void setupAnim(BreezeRenderState state) { + super.setupAnim(state); + core.resetPose(); + // Follow vertical breathing motion without spinning the reward at rod speed. + core.y = rods().y + 1.0F; + } +} diff --git a/src/main/java/cz/xefensor/retold/client/render/GaleCoreRenderState.java b/src/main/java/cz/xefensor/retold/client/render/GaleCoreRenderState.java new file mode 100644 index 00000000..96e59b25 --- /dev/null +++ b/src/main/java/cz/xefensor/retold/client/render/GaleCoreRenderState.java @@ -0,0 +1,8 @@ +package cz.xefensor.retold.client.render; + +import net.minecraft.client.renderer.block.BlockModelRenderState; +import net.minecraft.client.renderer.entity.state.BreezeRenderState; + +public final class GaleCoreRenderState extends BreezeRenderState { + public final BlockModelRenderState heavyCore = new BlockModelRenderState(); +} diff --git a/src/main/java/cz/xefensor/retold/client/render/GaleCoreRenderer.java b/src/main/java/cz/xefensor/retold/client/render/GaleCoreRenderer.java index 514ef2fb..b3e667c9 100644 --- a/src/main/java/cz/xefensor/retold/client/render/GaleCoreRenderer.java +++ b/src/main/java/cz/xefensor/retold/client/render/GaleCoreRenderer.java @@ -1,39 +1,49 @@ package cz.xefensor.retold.client.render; import com.mojang.blaze3d.vertex.PoseStack; +import cz.xefensor.retold.client.RetoldClientEvents; import cz.xefensor.retold.worldgen.air.GaleCore; -import net.minecraft.client.model.geom.ModelLayers; -import net.minecraft.client.model.monster.breeze.BreezeModel; import net.minecraft.client.renderer.entity.EntityRendererProvider; import net.minecraft.client.renderer.entity.MobRenderer; -import net.minecraft.client.renderer.entity.layers.BreezeEyesLayer; -import net.minecraft.client.renderer.entity.layers.BreezeWindLayer; -import net.minecraft.client.renderer.entity.state.BreezeRenderState; +import net.minecraft.client.renderer.block.BlockModelResolver; +import net.minecraft.client.renderer.block.model.BlockDisplayContext; import net.minecraft.resources.Identifier; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.phys.AABB; -public class GaleCoreRenderer extends MobRenderer { +public class GaleCoreRenderer extends MobRenderer { + private static final BlockDisplayContext CORE_DISPLAY_CONTEXT = BlockDisplayContext.create(); private static final Identifier TEXTURE_LOCATION = Identifier.withDefaultNamespace("textures/entity/breeze/breeze.png"); + private final BlockModelResolver blockModelResolver; public GaleCoreRenderer(EntityRendererProvider.Context context) { - super(context, new BreezeModel(context.bakeLayer(ModelLayers.BREEZE)), 1.35F); - this.addLayer(new BreezeWindLayer(this, context.getModelSet())); - this.addLayer(new BreezeEyesLayer(this, context.getModelSet())); + super(context, new GaleCoreModel(context.bakeLayer(RetoldClientEvents.GALE_CORE_LAYER)), 1.35F); + blockModelResolver = context.getBlockModelResolver(); + addLayer(new GaleCoreHeavyCoreLayer(this)); + addLayer(new GaleCoreDetailLayer(this, context.getModelSet())); } @Override - public Identifier getTextureLocation(BreezeRenderState state) { + protected AABB getBoundingBoxForCulling(GaleCore entity) { + // The enlarged Breeze wind and floating plates extend beyond its narrow collision box. + return super.getBoundingBoxForCulling(entity).inflate(0.75D); + } + + @Override + public Identifier getTextureLocation(GaleCoreRenderState state) { return TEXTURE_LOCATION; } @Override - public BreezeRenderState createRenderState() { - return new BreezeRenderState(); + public GaleCoreRenderState createRenderState() { + return new GaleCoreRenderState(); } @Override - public void extractRenderState(GaleCore entity, BreezeRenderState state, float partialTicks) { + public void extractRenderState(GaleCore entity, GaleCoreRenderState state, float partialTicks) { super.extractRenderState(entity, state, partialTicks); + blockModelResolver.update(state.heavyCore, Blocks.HEAVY_CORE.defaultBlockState(), CORE_DISPLAY_CONTEXT); state.idle.copyFrom(entity.idle); state.shoot.copyFrom(entity.shoot); state.slide.copyFrom(entity.slide); @@ -43,7 +53,7 @@ public void extractRenderState(GaleCore entity, BreezeRenderState state, float p } @Override - protected void scale(BreezeRenderState state, PoseStack poseStack) { + protected void scale(GaleCoreRenderState state, PoseStack poseStack) { poseStack.scale(2.25F, 2.25F, 2.25F); } } diff --git a/src/main/java/cz/xefensor/retold/command/RetoldCommands.java b/src/main/java/cz/xefensor/retold/command/RetoldCommands.java index 81d25895..91400a81 100644 --- a/src/main/java/cz/xefensor/retold/command/RetoldCommands.java +++ b/src/main/java/cz/xefensor/retold/command/RetoldCommands.java @@ -2,6 +2,7 @@ import com.mojang.brigadier.CommandDispatcher; import com.mojang.brigadier.arguments.IntegerArgumentType; +import cz.xefensor.retold.command.showcase.RetoldShowcaseWorld; import cz.xefensor.retold.network.RetoldEndSkySeedSyncPayload; import cz.xefensor.retold.sky.RetoldEndSkyData; import cz.xefensor.retold.stage.RetoldStageManager; @@ -10,6 +11,8 @@ import cz.xefensor.retold.villager.RetoldVillageReputationStatus; import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.Commands; +import net.minecraft.commands.arguments.coordinates.BlockPosArgument; +import net.minecraft.core.BlockPos; import net.minecraft.network.chat.Component; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; @@ -23,6 +26,12 @@ public static void register(CommandDispatcher dispatcher) { dispatcher.register( Commands.literal("retold") .requires(Commands.hasPermission(Commands.LEVEL_GAMEMASTERS)) + .then(Commands.literal("testworld") + .executes(context -> createTestWorld(context.getSource(), null)) + .then(Commands.argument("origin", BlockPosArgument.blockPos()) + .executes(context -> createTestWorld(context.getSource(), + BlockPosArgument.getBlockPos(context, "origin")))) + ) .then(Commands.literal("stage") .then(Commands.literal("get") .executes(context -> getStage(context.getSource())) @@ -54,6 +63,32 @@ public static void register(CommandDispatcher dispatcher) { ); } + private static int createTestWorld(CommandSourceStack source, BlockPos requestedOrigin) { + if (!(source.getEntity() instanceof ServerPlayer player)) { + source.sendFailure(Component.literal("Run this command as a player in an Overworld test world.")); + return 0; + } + ServerLevel level = source.getLevel(); + BlockPos origin = requestedOrigin; + if (origin == null) { + RetoldShowcaseWorld.Plan layout = RetoldShowcaseWorld.plan(BlockPos.ZERO); + origin = new BlockPos(player.getBlockX() - layout.width() / 2, level.getMaxY() - 18, + player.getBlockZ() - layout.depth() / 2); + } + RetoldShowcaseWorld.Plan plan = RetoldShowcaseWorld.plan(origin); + RetoldShowcaseWorld.BuildResult result = RetoldShowcaseWorld.build(level, plan); + if (!result.created()) { + source.sendFailure(Component.literal(result.message())); + return 0; + } + BlockPos entrance = origin.offset(plan.width() / 2, 1, 2); + player.teleportTo(level, entrance.getX() + 0.5D, entrance.getY(), entrance.getZ() + 0.5D, + java.util.Set.of(), 0.0F, 0.0F, true); + source.sendSuccess(() -> Component.literal(result.message() + " Entrance: " + entrance.toShortString() + + ". Exhibits are passive; world stage and game rules are unchanged."), false); + return 1; + } + private static int getStage(CommandSourceStack source) { ServerLevel level = source.getLevel(); diff --git a/src/main/java/cz/xefensor/retold/command/showcase/RetoldShowcaseEntities.java b/src/main/java/cz/xefensor/retold/command/showcase/RetoldShowcaseEntities.java new file mode 100644 index 00000000..fbdcbe0f --- /dev/null +++ b/src/main/java/cz/xefensor/retold/command/showcase/RetoldShowcaseEntities.java @@ -0,0 +1,95 @@ +package cz.xefensor.retold.command.showcase; + +import cz.xefensor.retold.registry.RetoldBlocks; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.chat.Component; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.util.ProblemReporter; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntitySpawnReason; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.EquipmentSlot; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.Mob; +import net.minecraft.world.entity.decoration.ArmorStand; +import net.minecraft.world.level.storage.TagValueInput; +import net.minecraft.world.phys.Vec3; + +/** Server-owned, persistent exhibits for the developer content gallery. */ +public final class RetoldShowcaseEntities { + public static final String EXHIBIT_TAG = "retold.showcase"; + private static final int DISABLED_ARMOR_SLOTS = 0x7FFFFF; + + private RetoldShowcaseEntities() { + } + + public static Entity spawn( + ServerLevel level, + EntityType type, + Vec3 position, + String groupTag + ) { + // Deliberately skip finalizeSpawn: exhibits must not create boss escorts or encounters. + Entity entity = type.create(level, EntitySpawnReason.COMMAND); + if (entity == null) { + throw new IllegalStateException("Cannot create showcase entity " + BuiltInRegistries.ENTITY_TYPE.getKey(type)); + } + + prepare(entity, position, groupTag); + entity.setCustomName(Component.literal(BuiltInRegistries.ENTITY_TYPE.getKey(type).toString())); + add(level, entity); + return entity; + } + + public static ArmorStand spawnSteelArmor( + ServerLevel level, + Vec3 position, + boolean baby, + String groupTag + ) { + ArmorStand stand = new ArmorStand(level, position.x, position.y, position.z); + CompoundTag settings = new CompoundTag(); + settings.putBoolean("Small", baby); + settings.putBoolean("ShowArms", true); + settings.putInt("DisabledSlots", DISABLED_ARMOR_SLOTS); + // The vanilla Small setter is private; its persisted flag also drives isBaby/armor rendering. + stand.load(TagValueInput.create(ProblemReporter.DISCARDING, level.registryAccess(), settings)); + prepare(stand, position, groupTag); + stand.setCustomName(Component.literal(baby ? "Steel armor (baby)" : "Steel armor (adult)")); + stand.setItemSlot(EquipmentSlot.HEAD, RetoldBlocks.STEEL_HELMET.get().getDefaultInstance()); + stand.setItemSlot(EquipmentSlot.CHEST, RetoldBlocks.STEEL_CHESTPLATE.get().getDefaultInstance()); + stand.setItemSlot(EquipmentSlot.LEGS, RetoldBlocks.STEEL_LEGGINGS.get().getDefaultInstance()); + stand.setItemSlot(EquipmentSlot.FEET, RetoldBlocks.STEEL_BOOTS.get().getDefaultInstance()); + stand.setItemSlot(EquipmentSlot.MAINHAND, RetoldBlocks.STEEL_SWORD.get().getDefaultInstance()); + add(level, stand); + return stand; + } + + private static void prepare(Entity entity, Vec3 position, String groupTag) { + entity.snapTo(position, 180.0F, 0.0F); + entity.setNoGravity(true); + entity.setInvulnerable(true); + entity.setSilent(true); + entity.setCustomNameVisible(true); + entity.setDeltaMovement(Vec3.ZERO); + entity.addTag(EXHIBIT_TAG); + entity.addTag(groupTag); + + if (entity instanceof LivingEntity living) { + living.setHealth(living.getMaxHealth()); + living.setYBodyRot(180.0F); + living.setYHeadRot(180.0F); + } + if (entity instanceof Mob mob) { + mob.setNoAi(true); + mob.setPersistenceRequired(); + } + } + + private static void add(ServerLevel level, Entity entity) { + if (!level.addFreshEntity(entity)) { + throw new IllegalStateException("Cannot add showcase entity " + entity.getType()); + } + } +} diff --git a/src/main/java/cz/xefensor/retold/command/showcase/RetoldShowcaseGameTests.java b/src/main/java/cz/xefensor/retold/command/showcase/RetoldShowcaseGameTests.java new file mode 100644 index 00000000..b88fb41c --- /dev/null +++ b/src/main/java/cz/xefensor/retold/command/showcase/RetoldShowcaseGameTests.java @@ -0,0 +1,438 @@ +package cz.xefensor.retold.command.showcase; + +import cz.xefensor.retold.Retold; +import cz.xefensor.retold.api.world.RetoldWorldProtection; +import cz.xefensor.retold.event.RetoldCommandEvents; +import cz.xefensor.retold.registry.RetoldBlocks; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Holder; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.gametest.framework.BuiltinTestFunctions; +import net.minecraft.gametest.framework.FunctionGameTestInstance; +import net.minecraft.gametest.framework.GameTestHelper; +import net.minecraft.gametest.framework.GameTestInfo; +import net.minecraft.gametest.framework.GameTestListener; +import net.minecraft.gametest.framework.GameTestRunner; +import net.minecraft.gametest.framework.TestData; +import net.minecraft.gametest.framework.TestEnvironmentDefinition; +import net.minecraft.resources.Identifier; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.util.ProblemReporter; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntityTypes; +import net.minecraft.world.entity.EquipmentSlot; +import net.minecraft.world.entity.Mob; +import net.minecraft.world.entity.decoration.ArmorStand; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.ChunkPos; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.entity.ChestBlockEntity; +import net.minecraft.world.level.block.entity.SignBlockEntity; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.levelgen.structure.BoundingBox; +import net.minecraft.world.level.storage.TagValueInput; +import net.minecraft.world.level.storage.TagValueOutput; +import net.minecraft.world.phys.AABB; +import net.minecraft.world.phys.Vec3; +import net.neoforged.neoforge.event.RegisterGameTestsEvent; +import net.neoforged.neoforge.event.entity.living.MobDespawnEvent; +import net.neoforged.neoforge.event.tick.EntityTickEvent; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.function.Consumer; + +public final class RetoldShowcaseGameTests { + private static final Identifier EMPTY_STRUCTURE = Identifier.withDefaultNamespace("empty"); + + private RetoldShowcaseGameTests() { + } + + public static void register( + RegisterGameTestsEvent event, + Holder> environment + ) { + register(event, environment, "showcase_contains_live_registry_and_stable_exhibits", 120, + RetoldShowcaseGameTests::containsLiveRegistryAndStableExhibits); + register(event, environment, "showcase_rejects_occupied_and_protected_volume_without_edits", 120, + RetoldShowcaseGameTests::rejectsOccupiedAndProtectedVolumeWithoutEdits); + } + + private static void containsLiveRegistryAndStableExhibits(GameTestHelper helper) { + RetoldShowcaseWorld.Plan plan = RetoldShowcaseWorld.plan(helper.absolutePos(new BlockPos(4, 64, 4))); + TestArea area = new TestArea(helper, plan); + helper.startSequence() + .thenWaitUntil(() -> area.assertReady(helper)) + .thenExecute(() -> buildAndObserve(helper, plan, area)); + } + + private static void buildAndObserve( + GameTestHelper helper, + RetoldShowcaseWorld.Plan plan, + TestArea area + ) { + ServerLevel level = helper.getLevel(); + RetoldShowcaseWorld.BuildResult result = RetoldShowcaseWorld.build(level, plan); + helper.assertTrue(result.created(), "The empty loaded sky volume must accept a showcase: " + result.message()); + assertCatalog(helper, plan); + + List exhibits = area.entities().stream() + .filter(entity -> entity.entityTags().contains(RetoldShowcaseEntities.EXHIBIT_TAG)) + .toList(); + Map positions = new HashMap<>(); + Map ticks = new HashMap<>(); + for (Entity entity : exhibits) { + positions.put(entity, entity.position()); + ticks.put(entity, entity.tickCount); + helper.assertTrue(entity.isNoGravity(), "Exhibits must not fall when their tick is suppressed"); + EntityTickEvent.Pre exhibitTick = new EntityTickEvent.Pre(entity); + RetoldCommandEvents.onShowcaseEntityTickPre(exhibitTick); + helper.assertTrue(exhibitTick.isCanceled(), "Every tagged exhibit must suppress custom entity ticks"); + if (isRetold(BuiltInRegistries.ENTITY_TYPE.getKey(entity.getType())) || entity instanceof ArmorStand) { + assertSavedFreezePolicy(helper, entity, plan.groupTag()); + } + if (entity instanceof Mob mob) { + MobDespawnEvent despawn = new MobDespawnEvent(mob, level); + RetoldCommandEvents.onShowcaseMobDespawn(despawn); + helper.assertTrue(despawn.getResult() == MobDespawnEvent.Result.DENY, + "Tagged bosses must be protected from pre-tick despawning, including Peaceful"); + } + } + + Mob ordinaryMob = EntityTypes.COW.create(level, net.minecraft.world.entity.EntitySpawnReason.COMMAND); + helper.assertTrue(ordinaryMob != null, "An ordinary control mob must be creatable"); + ordinaryMob.snapTo(Vec3.atBottomCenterOf(plan.origin().offset(2, 1, 2)), 0.0F, 0.0F); + ordinaryMob.setNoAi(true); + level.addFreshEntity(ordinaryMob); + EntityTickEvent.Pre controlTick = new EntityTickEvent.Pre(ordinaryMob); + RetoldCommandEvents.onShowcaseEntityTickPre(controlTick); + helper.assertFalse(controlTick.isCanceled(), "The showcase freeze must leave ordinary mobs ticking"); + MobDespawnEvent controlDespawn = new MobDespawnEvent(ordinaryMob, level); + RetoldCommandEvents.onShowcaseMobDespawn(controlDespawn); + helper.assertTrue(controlDespawn.getResult() == MobDespawnEvent.Result.DEFAULT, + "The showcase must leave ordinary mob despawning unchanged"); + + helper.runAfterDelay(30, () -> { + helper.assertTrue(ordinaryMob.tickCount > 0, "The fixture must advance real loaded entity ticks"); + for (Entity entity : exhibits) { + helper.assertFalse(entity.isRemoved(), "Every exhibit must remain present after real server ticks"); + helper.assertValueEqual(entity.position(), positions.get(entity), + "Boss flight, gravity, and custom encounter ticks must not move an exhibit"); + // ServerLevel advances tickCount before the cancellable tick hook. + helper.assertTrue(entity.tickCount > ticks.get(entity), + "Every exhibit chunk must advance real server ticks during the observation"); + } + assertCatalog(helper, plan); + ordinaryMob.discard(); + helper.succeed(); + }); + } + + private static void assertSavedFreezePolicy(GameTestHelper helper, Entity entity, String groupTag) { + ServerLevel level = helper.getLevel(); + TagValueOutput output = TagValueOutput.createWithContext(ProblemReporter.DISCARDING, level.registryAccess()); + entity.saveWithoutId(output); + Entity restored = entity.getType().create(level, net.minecraft.world.entity.EntitySpawnReason.LOAD); + helper.assertTrue(restored != null, "A saved exhibit type must be restorable"); + restored.load(TagValueInput.create(ProblemReporter.DISCARDING, level.registryAccess(), output.buildResult())); + helper.assertTrue(restored.entityTags().contains(groupTag) + && restored.entityTags().contains(RetoldShowcaseEntities.EXHIBIT_TAG), + "Exhibit identity and freezing must survive vanilla entity serialization"); + helper.assertTrue(restored.isNoGravity(), "Restored exhibits must retain their gravity policy"); + EntityTickEvent.Pre restoredTick = new EntityTickEvent.Pre(restored); + RetoldCommandEvents.onShowcaseEntityTickPre(restoredTick); + helper.assertTrue(restoredTick.isCanceled(), "Restored exhibit tags must activate the real freeze hook"); + } + + private static void assertCatalog(GameTestHelper helper, RetoldShowcaseWorld.Plan plan) { + ServerLevel level = helper.getLevel(); + Set blockIds = new HashSet<>(); + Set itemIds = new HashSet<>(); + int namedAccessibleChests = 0; + int labels = 0; + for (BlockPos pos : positions(plan.bounds())) { + BlockState state = level.getBlockState(pos); + Identifier blockId = BuiltInRegistries.BLOCK.getKey(state.getBlock()); + if (isRetold(blockId)) { + blockIds.add(blockId); + helper.assertTrue(state.canSurvive(level, pos), + "The block exhibit needs valid support: " + blockId + " at " + pos); + } + if (level.getBlockEntity(pos) instanceof ChestBlockEntity chest) { + if (chest.getCustomName() != null && !chest.getCustomName().getString().isBlank()) { + helper.assertTrue(state.getMenuProvider(level, pos) != null, + "Supply chests must remain accessible from the gallery"); + namedAccessibleChests++; + } + for (int slot = 0; slot < chest.getContainerSize(); slot++) { + ItemStack stack = chest.getItem(slot); + if (!stack.isEmpty() && isRetold(BuiltInRegistries.ITEM.getKey(stack.getItem()))) { + itemIds.add(BuiltInRegistries.ITEM.getKey(stack.getItem())); + } + } + } + if (level.getBlockEntity(pos) instanceof SignBlockEntity sign) { + for (int row = 0; row < 4; row++) { + if (!sign.getFrontText().getMessage(row, false).getString().isBlank()) { + labels++; + break; + } + } + } + } + + Set expectedBlocks = new HashSet<>(); + BuiltInRegistries.BLOCK.keySet().stream().filter(RetoldShowcaseGameTests::isRetold).forEach(expectedBlocks::add); + Set expectedItems = new HashSet<>(); + BuiltInRegistries.ITEM.keySet().stream().filter(RetoldShowcaseGameTests::isRetold).forEach(expectedItems::add); + helper.assertValueEqual(blockIds, expectedBlocks, "Every currently registered Retold block must have a supported exhibit"); + helper.assertValueEqual(itemIds, expectedItems, "Supply chests must contain every currently registered Retold item"); + helper.assertTrue(namedAccessibleChests > 0, "The catalog needs named, usable supply chests"); + helper.assertTrue(labels >= expectedBlocks.size(), "Block exhibits must have readable sign labels"); + + Set entityIds = new HashSet<>(); + int adultArmor = 0; + int smallArmor = 0; + for (Entity entity : level.getEntitiesOfClass(Entity.class, AABB.of(plan.bounds()), + candidate -> candidate.entityTags().contains(plan.groupTag()))) { + Identifier entityId = BuiltInRegistries.ENTITY_TYPE.getKey(entity.getType()); + if (isRetold(entityId)) { + entityIds.add(entityId); + helper.assertTrue(entity.hasCustomName(), "Entity labels must identify the registry entry"); + helper.assertTrue(entity.entityTags().contains(RetoldShowcaseEntities.EXHIBIT_TAG), + "All Retold entities must use the isolated frozen-exhibit policy"); + } + if (entity instanceof ArmorStand stand) { + helper.assertTrue(stand.getItemBySlot(EquipmentSlot.HEAD).is(RetoldBlocks.STEEL_HELMET.get()) + && stand.getItemBySlot(EquipmentSlot.CHEST).is(RetoldBlocks.STEEL_CHESTPLATE.get()) + && stand.getItemBySlot(EquipmentSlot.LEGS).is(RetoldBlocks.STEEL_LEGGINGS.get()) + && stand.getItemBySlot(EquipmentSlot.FEET).is(RetoldBlocks.STEEL_BOOTS.get()), + "Both armor exhibits must wear the full Steel set"); + if (stand.isBaby()) { + smallArmor++; + } else { + adultArmor++; + } + } + } + Set expectedEntities = new HashSet<>(); + BuiltInRegistries.ENTITY_TYPE.keySet().stream().filter(RetoldShowcaseGameTests::isRetold).forEach(expectedEntities::add); + helper.assertValueEqual(entityIds, expectedEntities, "Every currently registered Retold entity must be exhibited"); + helper.assertTrue(adultArmor == 1 && smallArmor == 1, "Steel needs one adult and one baby armor exhibit"); + } + + private static void rejectsOccupiedAndProtectedVolumeWithoutEdits(GameTestHelper helper) { + RetoldShowcaseWorld.Plan plan = RetoldShowcaseWorld.plan(helper.absolutePos(new BlockPos(4, 64, 4))); + TestArea area = new TestArea(helper, plan); + helper.startSequence() + .thenWaitUntil(() -> area.assertReady(helper)) + .thenExecute(() -> assertPlacementDenials(helper, plan, area)) + .thenExecute(() -> assertUnreadyRejection(helper, plan.origin().offset(1024, 0, 1024))) + .thenSucceed(); + } + + private static void assertPlacementDenials( + GameTestHelper helper, + RetoldShowcaseWorld.Plan plan, + TestArea area + ) { + ServerLevel level = helper.getLevel(); + BlockPos occupied = new BlockPos(plan.bounds().maxX(), plan.bounds().maxY(), plan.bounds().maxZ()); + level.setBlock(occupied, Blocks.GOLD_BLOCK.defaultBlockState(), Block.UPDATE_CLIENTS); + RetoldShowcaseWorld.BuildResult occupiedResult = RetoldShowcaseWorld.build(level, plan); + helper.assertFalse(occupiedResult.created(), "One occupied cell must reject the whole planned volume"); + helper.assertTrue(occupiedResult.message().contains("space is occupied"), + "The loaded fixture must reach the occupied-block check"); + assertUnchangedExcept(helper, plan, occupied); + helper.assertTrue(area.entities().isEmpty(), "Occupied-volume rejection must not leave any entity exhibits"); + level.setBlock(occupied, Blocks.AIR.defaultBlockState(), Block.UPDATE_CLIENTS); + + RetoldWorldProtection.Registration protection = RetoldWorldProtection.register( + Identifier.fromNamespaceAndPath(Retold.MODID, "showcase_test_protection"), + context -> context.level() != level || !context.pos().equals(occupied) + ); + try { + RetoldShowcaseWorld.BuildResult protectedResult = RetoldShowcaseWorld.build(level, plan); + helper.assertFalse(protectedResult.created(), "One protected cell must reject the whole planned volume"); + helper.assertTrue(protectedResult.message().contains("protection denied"), + "The loaded fixture must reach the world-protection check"); + assertUnchangedExcept(helper, plan, null); + helper.assertTrue(area.entities().isEmpty(), "Protection rejection must not leave any entity exhibits"); + } finally { + protection.close(); + } + + Mob cow = EntityTypes.COW.create(level, net.minecraft.world.entity.EntitySpawnReason.COMMAND); + helper.assertTrue(cow != null, "An occupied-volume control mob must be creatable"); + cow.snapTo(Vec3.atBottomCenterOf(plan.origin().offset(2, 1, 2)), 0.0F, 0.0F); + cow.setNoAi(true); + cow.setNoGravity(true); + helper.assertTrue(level.addFreshEntity(cow), "The ordinary Cow must join the loaded fixture"); + RetoldShowcaseWorld.BuildResult entityResult = RetoldShowcaseWorld.build(level, plan); + helper.assertFalse(entityResult.created(), "An existing ordinary entity must reject the planned volume"); + helper.assertTrue(entityResult.message().contains("contains entities"), + "The loaded fixture must reach the occupied-entity check"); + assertUnchangedExcept(helper, plan, null); + helper.assertFalse(cow.isRemoved(), "Entity-occupied rejection must preserve the original Cow"); + List remaining = area.entities(); + helper.assertTrue(remaining.size() == 1 && remaining.contains(cow), + "Entity-occupied rejection must leave only the original Cow and no partial exhibits"); + cow.discard(); + } + + private static void assertUnreadyRejection(GameTestHelper helper, BlockPos origin) { + RetoldShowcaseWorld.Plan plan = RetoldShowcaseWorld.plan(origin); + TestArea area = new TestArea(helper, plan, false); + boolean unready = false; + for (int x = plan.bounds().minX() >> 4; x <= plan.bounds().maxX() >> 4; x++) { + for (int z = plan.bounds().minZ() >> 4; z <= plan.bounds().maxZ() >> 4; z++) { + unready |= !helper.getLevel().areEntitiesActuallyLoadedAndTicking(new ChunkPos(x, z)); + } + } + helper.assertTrue(unready, "The remote fixture must have real unticketed entity sections"); + RetoldShowcaseWorld.BuildResult result = RetoldShowcaseWorld.build(helper.getLevel(), plan); + helper.assertFalse(result.created(), "A volume with unpublished or non-ticking entities must be rejected"); + helper.assertTrue(result.message().contains("retry /retold testworld"), + "Unready sections must explain how to retry after the area loads"); + assertUnchangedExcept(helper, plan, null); + helper.assertTrue(area.entities().isEmpty(), "Unready-volume rejection must not create partial exhibits"); + } + + private static void assertUnchangedExcept( + GameTestHelper helper, + RetoldShowcaseWorld.Plan plan, + BlockPos occupied + ) { + for (BlockPos pos : positions(plan.bounds())) { + boolean isMarker = pos.equals(occupied); + helper.assertTrue(helper.getLevel().getBlockState(pos).is(isMarker ? Blocks.GOLD_BLOCK : Blocks.AIR), + "Rejected construction must leave every planned cell unchanged at " + pos); + } + } + + private static Iterable positions(BoundingBox bounds) { + return BlockPos.betweenClosed(bounds.minX(), bounds.minY(), bounds.minZ(), + bounds.maxX(), bounds.maxY(), bounds.maxZ()); + } + + private static boolean isRetold(Identifier identifier) { + return Retold.MODID.equals(identifier.getNamespace()); + } + + private static void register( + RegisterGameTestsEvent event, + Holder> environment, + String name, + int ticks, + Consumer test + ) { + event.registerTest(Identifier.fromNamespaceAndPath(Retold.MODID, name), + new InlineGameTest(new TestData<>(environment, EMPTY_STRUCTURE, ticks, 0, true), test)); + } + + /** The catalog is larger than an empty fixture, so release its chunks and edits on either outcome. */ + private static final class TestArea implements GameTestListener { + private final ServerLevel level; + private final RetoldShowcaseWorld.Plan plan; + private final List addedForcedChunks = new ArrayList<>(); + private boolean ownsVolume; + private boolean cleaned; + + private TestArea(GameTestHelper helper, RetoldShowcaseWorld.Plan plan) { + this(helper, plan, true); + } + + private TestArea(GameTestHelper helper, RetoldShowcaseWorld.Plan plan, boolean forceChunks) { + this.level = helper.getLevel(); + this.plan = plan; + helper.testInfo.addListener(this); + if (forceChunks) { + for (int x = plan.bounds().minX() >> 4; x <= plan.bounds().maxX() >> 4; x++) { + for (int z = plan.bounds().minZ() >> 4; z <= plan.bounds().maxZ() >> 4; z++) { + if (!level.getForceLoadedChunks().contains(ChunkPos.pack(x, z))) { + level.setChunkForced(x, z, true); + addedForcedChunks.add(new ChunkPos(x, z)); + } + } + } + } + for (BlockPos pos : positions(plan.bounds())) { + helper.assertTrue(level.getBlockState(pos).isAir(), "The high test volume must start empty at " + pos); + } + ownsVolume = true; + } + + private List entities() { + return level.getEntitiesOfClass(Entity.class, AABB.of(plan.bounds()), entity -> true); + } + + private void assertReady(GameTestHelper helper) { + for (int x = plan.bounds().minX() >> 4; x <= plan.bounds().maxX() >> 4; x++) { + for (int z = plan.bounds().minZ() >> 4; z <= plan.bounds().maxZ() >> 4; z++) { + ChunkPos chunk = new ChunkPos(x, z); + // setChunkForced loads terrain synchronously; entity-section visibility follows later. + helper.assertTrue(level.areEntitiesActuallyLoadedAndTicking(chunk), + "The fixture must publish entity visibility and ticking before building chunk " + chunk); + } + } + } + + private void cleanup() { + if (cleaned) { + return; + } + cleaned = true; + if (ownsVolume) { + entities().forEach(Entity::discard); + for (BlockPos pos : positions(plan.bounds())) { + level.setBlock(pos, Blocks.AIR.defaultBlockState(), Block.UPDATE_CLIENTS); + } + // Container removal can create fresh item drops after the original entities were removed. + entities().forEach(Entity::discard); + } + for (ChunkPos chunk : addedForcedChunks) { + level.setChunkForced(chunk.x(), chunk.z(), false); + } + } + + @Override + public void testStructureLoaded(GameTestInfo testInfo) { + } + + @Override + public void testPassed(GameTestInfo testInfo, GameTestRunner runner) { + cleanup(); + } + + @Override + public void testFailed(GameTestInfo testInfo, GameTestRunner runner) { + cleanup(); + } + + @Override + public void testAddedForRerun(GameTestInfo original, GameTestInfo copy, GameTestRunner runner) { + } + } + + private static final class InlineGameTest extends FunctionGameTestInstance { + private final Consumer test; + + private InlineGameTest( + TestData>> testData, + Consumer test + ) { + super(BuiltinTestFunctions.ALWAYS_PASS, testData); + this.test = test; + } + + @Override + public void run(GameTestHelper helper) { + test.accept(helper); + } + } +} diff --git a/src/main/java/cz/xefensor/retold/command/showcase/RetoldShowcaseWorld.java b/src/main/java/cz/xefensor/retold/command/showcase/RetoldShowcaseWorld.java new file mode 100644 index 00000000..e251072a --- /dev/null +++ b/src/main/java/cz/xefensor/retold/command/showcase/RetoldShowcaseWorld.java @@ -0,0 +1,337 @@ +package cz.xefensor.retold.command.showcase; + +import cz.xefensor.retold.Retold; +import cz.xefensor.retold.api.world.RetoldWorldProtection; +import cz.xefensor.retold.registry.RetoldBlocks; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.core.component.DataComponents; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.network.chat.Component; +import net.minecraft.resources.Identifier; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.decoration.ItemFrame; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.ChunkPos; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.ButtonBlock; +import net.minecraft.world.level.block.CeilingHangingSignBlock; +import net.minecraft.world.level.block.DoorBlock; +import net.minecraft.world.level.block.SaplingBlock; +import net.minecraft.world.level.block.WallHangingSignBlock; +import net.minecraft.world.level.block.WallSignBlock; +import net.minecraft.world.level.block.WallTorchBlock; +import net.minecraft.world.level.block.entity.ChestBlockEntity; +import net.minecraft.world.level.block.entity.SignBlockEntity; +import net.minecraft.world.level.block.entity.SignText; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.properties.AttachFace; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.DoubleBlockHalf; +import net.minecraft.world.level.levelgen.structure.BoundingBox; +import net.minecraft.world.phys.AABB; +import net.minecraft.world.phys.Vec3; + +import java.util.Comparator; +import java.util.List; + +/** One-shot developer gallery. All space and permissions are checked before the first edit. */ +public final class RetoldShowcaseWorld { + private static final Identifier SUBJECT = Identifier.fromNamespaceAndPath(Retold.MODID, "showcase"); + private static final int WIDTH = 66; + private static final int HEIGHT = 10; + private static final int ITEM_COLUMNS = 12; + private static final int BLOCK_COLUMNS = 8; + private static final int ENTITY_COLUMNS = 6; + + private RetoldShowcaseWorld() { + } + + public static Plan plan(BlockPos origin) { + List items = BuiltInRegistries.ITEM.stream() + .filter(item -> BuiltInRegistries.ITEM.getKey(item).getNamespace().equals(Retold.MODID)) + .sorted(Comparator.comparing(item -> BuiltInRegistries.ITEM.getKey(item).toString())) + .toList(); + List blocks = BuiltInRegistries.BLOCK.stream() + .filter(block -> BuiltInRegistries.BLOCK.getKey(block).getNamespace().equals(Retold.MODID)) + .sorted(Comparator.comparing(block -> BuiltInRegistries.BLOCK.getKey(block).toString())) + .toList(); + List> entities = BuiltInRegistries.ENTITY_TYPE.stream() + .filter(type -> BuiltInRegistries.ENTITY_TYPE.getKey(type).getNamespace().equals(Retold.MODID)) + .sorted(Comparator.comparing(type -> BuiltInRegistries.ENTITY_TYPE.getKey(type).toString())) + .toList(); + int blockStart = 8 + Math.ceilDiv(items.size(), ITEM_COLUMNS) * 4 + 4; + int entityStart = blockStart + Math.ceilDiv(blocks.size(), BLOCK_COLUMNS) * 7 + 6; + int extras = entityStart + Math.ceilDiv(entities.size(), ENTITY_COLUMNS) * 12 + 4; + return new Plan(origin.immutable(), items, blocks, entities, WIDTH, extras + 15, + blockStart, entityStart, extras); + } + + public static BuildResult build(ServerLevel level, Plan plan) { + String rejection = validateSpace(level, plan); + if (rejection != null) { + return new BuildResult(false, rejection); + } + + buildPlatform(level, plan); + supplyChests(level, plan); + for (int index = 0; index < plan.items().size(); index++) { + itemExhibit(level, plan, index); + } + for (int index = 0; index < plan.blocks().size(); index++) { + blockExhibit(level, plan, index); + } + for (int index = 0; index < plan.entities().size(); index++) { + BlockPos pos = plan.entityPosition(index); + put(level, pos.below(), Blocks.POLISHED_ANDESITE.defaultBlockState()); + label(level, pos.north(3).below(), "ENTITY", BuiltInRegistries.ENTITY_TYPE.getKey(plan.entities().get(index))); + RetoldShowcaseEntities.spawn(level, plan.entities().get(index), Vec3.atBottomCenterOf(pos), plan.groupTag()); + } + workshop(level, plan); + return new BuildResult(true, "Created Retold test gallery: " + plan.items().size() + " items, " + + plan.blocks().size() + " blocks, " + plan.entities().size() + " entity types, Steel armor and workstations."); + } + + private static String validateSpace(ServerLevel level, Plan plan) { + if (!level.dimension().equals(Level.OVERWORLD)) { + return "Create the gallery in an Overworld test world; Aender terrain can regenerate."; + } + BoundingBox box = plan.bounds(); + if (plan.depth() > 256 || box.minY() < level.getMinY() || box.maxY() >= level.getMaxY()) { + return "The gallery does not fit inside the world build height or supported footprint."; + } + if (!level.getWorldBorder().isWithinBounds(new BlockPos(box.minX(), box.minY(), box.minZ())) + || !level.getWorldBorder().isWithinBounds(new BlockPos(box.maxX(), box.maxY(), box.maxZ()))) { + return "The gallery would cross the world border."; + } + // Loading is bounded to this explicit command's footprint; no persistent tickets or jobs. + for (int chunkX = box.minX() >> 4; chunkX <= box.maxX() >> 4; chunkX++) { + for (int chunkZ = box.minZ() >> 4; chunkZ <= box.maxZ() >> 4; chunkZ++) { + level.getChunk(chunkX, chunkZ); + } + } + for (BlockPos pos : BlockPos.betweenClosed(box.minX(), box.minY(), box.minZ(), + box.maxX(), box.maxY(), box.maxZ())) { + if (!level.getBlockState(pos).isAir()) { + return "Gallery space is occupied at " + pos.toShortString() + ". Choose an empty location."; + } + if (!RetoldWorldProtection.canWorldModify(level, pos, SUBJECT)) { + return "World protection denied the gallery at " + pos.toShortString() + "."; + } + } + for (int chunkX = box.minX() >> 4; chunkX <= box.maxX() >> 4; chunkX++) { + for (int chunkZ = box.minZ() >> 4; chunkZ <= box.maxZ() >> 4; chunkZ++) { + // Terrain loading can finish before saved entity sections. Never treat a hidden + // section as empty or add displays which could overlap its returning entities. + if (!level.areEntitiesActuallyLoadedAndTicking(new ChunkPos(chunkX, chunkZ))) { + return "The gallery area is not fully active yet. Stay near its center and retry /retold testworld shortly."; + } + } + } + if (!level.getEntities((Entity) null, new AABB(box.minX(), box.minY(), box.minZ(), + box.maxX() + 1, box.maxY() + 1, box.maxZ() + 1), entity -> true).isEmpty()) { + return "Gallery space contains entities. Choose an empty location."; + } + // The live portal has its own permission category in addition to ordinary world edits. + int portalIndex = plan.blocks().indexOf(RetoldBlocks.AENDER_PORTAL.get()); + if (portalIndex >= 0) { + BlockPos center = plan.blockPosition(portalIndex); + for (BlockPos pos : BlockPos.betweenClosed(center.offset(-2, 0, -2), center.offset(2, 0, 2))) { + if (!RetoldWorldProtection.canCreatePortal(level, pos)) { + return "World protection denied the gallery's Aender portal."; + } + } + } + return null; + } + + private static void buildPlatform(ServerLevel level, Plan plan) { + BlockPos origin = plan.origin(); + for (int x = 0; x < plan.width(); x++) { + for (int z = 0; z < plan.depth(); z++) { + boolean edge = x == 0 || z == 0 || x == plan.width() - 1 || z == plan.depth() - 1; + Block floor = edge ? Blocks.POLISHED_DEEPSLATE : Blocks.SMOOTH_STONE; + if (x % 8 == 3 && z % 8 == 3) { + floor = Blocks.SEA_LANTERN; + } + put(level, origin.offset(x, 0, z), floor.defaultBlockState()); + if (edge) { + put(level, origin.offset(x, 1, z), Blocks.GLASS.defaultBlockState()); + } + } + } + label(level, origin.offset(plan.width() / 2, 1, 4), "RETOLD TEST WORLD", null); + label(level, origin.offset(3, 1, 6), "ITEMS / TAKE COPIES", null); + label(level, origin.offset(3, 1, plan.blockStartZ() - 1), "BLOCKS", null); + label(level, origin.offset(3, 1, plan.entityStartZ() - 1), "PASSIVE ENTITIES", null); + } + + private static void supplyChests(ServerLevel level, Plan plan) { + for (int index = 0; index < plan.items().size(); index += 27) { + BlockPos pos = plan.supplyPosition(index / 27); + put(level, pos, Blocks.CHEST.defaultBlockState().setValue(BlockStateProperties.HORIZONTAL_FACING, Direction.NORTH)); + if (level.getBlockEntity(pos) instanceof ChestBlockEntity chest) { + nameChest(chest, "Retold items " + (index / 27 + 1)); + for (int slot = 0; slot < 27 && index + slot < plan.items().size(); slot++) { + ItemStack stack = plan.items().get(index + slot).getDefaultInstance(); + stack.setCount(stack.getMaxStackSize()); + chest.setItem(slot, stack); + } + } + label(level, pos.north(), "SUPPLIES " + (index / 27 + 1), null); + } + } + + private static void itemExhibit(ServerLevel level, Plan plan, int index) { + Item item = plan.items().get(index); + BlockPos pos = plan.origin().offset(4 + index % ITEM_COLUMNS * 5, 2, 9 + index / ITEM_COLUMNS * 4); + put(level, pos.below(), Blocks.QUARTZ_BLOCK.defaultBlockState()); + put(level, pos, Blocks.QUARTZ_BLOCK.defaultBlockState()); + ItemFrame frame = new ItemFrame(level, pos.north(), Direction.NORTH); + frame.setItem(item.getDefaultInstance()); + frame.setInvulnerable(true); + frame.setNoGravity(true); + frame.setSilent(true); + frame.addTag(plan.groupTag()); + frame.addTag(RetoldShowcaseEntities.EXHIBIT_TAG); + level.addFreshEntity(frame); + label(level, pos.north(2).below(), "ITEM", BuiltInRegistries.ITEM.getKey(item)); + } + + private static void blockExhibit(ServerLevel level, Plan plan, int index) { + Block block = plan.blocks().get(index); + BlockPos pos = plan.blockPosition(index); + BlockState state = block.defaultBlockState(); + put(level, pos.below(), Blocks.QUARTZ_BLOCK.defaultBlockState()); + if (block == RetoldBlocks.AENDER_PORTAL.get()) { + portal(level, pos); + } else { + if (block instanceof SaplingBlock) { + put(level, pos.below(), RetoldBlocks.AENDER_SOIL.get().defaultBlockState()); + put(level, pos.above(2), Blocks.BARRIER.defaultBlockState()); + } else if (block == RetoldBlocks.AENDER_CACTUS.get()) { + put(level, pos.below(), RetoldBlocks.AENDER_SAND.get().defaultBlockState()); + } else if (block instanceof WallTorchBlock || block instanceof WallSignBlock) { + state = state.setValue(BlockStateProperties.HORIZONTAL_FACING, Direction.NORTH); + put(level, pos.south(), Blocks.QUARTZ_BLOCK.defaultBlockState()); + } else if (block instanceof WallHangingSignBlock) { + state = state.setValue(BlockStateProperties.HORIZONTAL_FACING, Direction.NORTH); + put(level, pos.east(), Blocks.QUARTZ_BLOCK.defaultBlockState()); + put(level, pos.west(), Blocks.QUARTZ_BLOCK.defaultBlockState()); + } else if (block instanceof CeilingHangingSignBlock) { + put(level, pos.above(), Blocks.QUARTZ_BLOCK.defaultBlockState()); + } else if (block instanceof ButtonBlock) { + state = state.setValue(BlockStateProperties.ATTACH_FACE, AttachFace.FLOOR); + } + put(level, pos, state); + if (block instanceof DoorBlock) { + put(level, pos.above(), state.setValue(BlockStateProperties.DOUBLE_BLOCK_HALF, DoubleBlockHalf.UPPER)); + } + } + label(level, pos.north(3).below(), block == RetoldBlocks.AENDER_PORTAL.get() ? "LIVE PORTAL" : "BLOCK", + BuiltInRegistries.BLOCK.getKey(block)); + } + + private static void portal(ServerLevel level, BlockPos center) { + for (int x = -2; x <= 2; x++) { + for (int z = -2; z <= 2; z++) { + if (Math.abs(x) == 2 || Math.abs(z) == 2) { + put(level, center.offset(x, 0, z), RetoldBlocks.DEV_AENDER_PORTAL_FRAME.get().defaultBlockState()); + } + } + } + } + + private static void workshop(ServerLevel level, Plan plan) { + BlockPos base = plan.origin().offset(4, 1, plan.extrasZ()); + label(level, base.north(2), "WORKSHOP / ARMOR", null); + List stations = List.of(Blocks.CRAFTING_TABLE, Blocks.CAMPFIRE, Blocks.SMOKER, + Blocks.FURNACE, Blocks.BLAST_FURNACE, Blocks.ENCHANTING_TABLE, Blocks.ANVIL); + for (int index = 0; index < stations.size(); index++) { + Block block = stations.get(index); + BlockState state = block.defaultBlockState(); + if (block == Blocks.CAMPFIRE) { + state = state.setValue(BlockStateProperties.LIT, false); + } + put(level, base.offset(index * 5, 0, 2), state); + label(level, base.offset(index * 5, 0, 1), "STATION", BuiltInRegistries.BLOCK.getKey(block)); + } + RetoldShowcaseEntities.spawnSteelArmor(level, Vec3.atBottomCenterOf(base.offset(40, 0, 3)), false, plan.groupTag()); + RetoldShowcaseEntities.spawnSteelArmor(level, Vec3.atBottomCenterOf(base.offset(48, 0, 3)), true, plan.groupTag()); + BlockPos chestPos = base.offset(0, 0, 8); + put(level, chestPos, Blocks.CHEST.defaultBlockState()); + if (level.getBlockEntity(chestPos) instanceof ChestBlockEntity chest) { + nameChest(chest, "Ritual and workshop supplies"); + List supplies = List.of(Items.DRAGON_EGG, Items.HEART_OF_THE_SEA, Items.HEAVY_CORE, + RetoldBlocks.NETHER_REACTOR_CORE.get(), Items.LODESTONE, Items.TOTEM_OF_UNDYING, + Items.NETHER_STAR, Items.LAPIS_LAZULI, Items.BOOK, Items.EMERALD, Items.FLINT, + Items.FLINT_AND_STEEL, Items.CLAY_BALL, Items.BRICK, Items.IRON_INGOT); + for (int index = 0; index < supplies.size(); index++) { + chest.setItem(index, supplies.get(index).getDefaultInstance()); + } + } + label(level, chestPos.north(), "RITUAL / WORKSHOP", null); + } + + private static void nameChest(ChestBlockEntity chest, String name) { + ItemStack namedChest = new ItemStack(Items.CHEST); + namedChest.set(DataComponents.CUSTOM_NAME, Component.literal(name)); + chest.applyComponentsFromItemStack(namedChest); + chest.setChanged(); + } + + private static void label(ServerLevel level, BlockPos pos, String title, Identifier id) { + put(level, pos, Blocks.OAK_SIGN.defaultBlockState()); + if (level.getBlockEntity(pos) instanceof SignBlockEntity sign) { + SignText text = new SignText().setMessage(0, Component.literal(title)); + if (id != null) { + text = text.setMessage(1, Component.literal(id.getNamespace() + ":")); + String path = id.getPath(); + text = text.setMessage(2, Component.literal(path.substring(0, Math.min(15, path.length())))); + if (path.length() > 15) { + text = text.setMessage(3, Component.literal(path.substring(15))); + } + } + sign.setText(text, true); + sign.setText(text, false); + sign.setWaxed(true); + } + } + + private static void put(ServerLevel level, BlockPos pos, BlockState state) { + level.setBlock(pos, state, Block.UPDATE_ALL); + } + + public record BuildResult(boolean created, String message) { + } + + public record Plan(BlockPos origin, List items, List blocks, List> entities, + int width, int depth, int blockStartZ, int entityStartZ, int extrasZ) { + public BoundingBox bounds() { + return new BoundingBox(origin.getX(), origin.getY(), origin.getZ(), + origin.getX() + width - 1, origin.getY() + HEIGHT - 1, origin.getZ() + depth - 1); + } + + public String groupTag() { + return "retold.showcase." + origin.getX() + "." + origin.getY() + "." + origin.getZ(); + } + + public BlockPos blockPosition(int index) { + return origin.offset(5 + index % BLOCK_COLUMNS * 8, 2, blockStartZ + 3 + index / BLOCK_COLUMNS * 7); + } + + public BlockPos entityPosition(int index) { + return origin.offset(6 + index % ENTITY_COLUMNS * 10, 2, entityStartZ + 4 + index / ENTITY_COLUMNS * 12); + } + + public BlockPos supplyPosition(int index) { + return origin.offset(3 + index * 3, 1, 3); + } + } +} diff --git a/src/main/java/cz/xefensor/retold/event/RetoldCommandEvents.java b/src/main/java/cz/xefensor/retold/event/RetoldCommandEvents.java index ef0474a7..dec567fa 100644 --- a/src/main/java/cz/xefensor/retold/event/RetoldCommandEvents.java +++ b/src/main/java/cz/xefensor/retold/event/RetoldCommandEvents.java @@ -1,8 +1,14 @@ package cz.xefensor.retold.event; import cz.xefensor.retold.command.RetoldCommands; +import cz.xefensor.retold.command.showcase.RetoldShowcaseEntities; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.phys.Vec3; import net.neoforged.bus.api.SubscribeEvent; import net.neoforged.neoforge.event.RegisterCommandsEvent; +import net.neoforged.neoforge.event.entity.living.MobDespawnEvent; +import net.neoforged.neoforge.event.tick.EntityTickEvent; public final class RetoldCommandEvents { private RetoldCommandEvents() { @@ -12,4 +18,24 @@ private RetoldCommandEvents() { public static void registerCommands(RegisterCommandsEvent event) { RetoldCommands.register(event.getDispatcher()); } -} \ No newline at end of file + + @SubscribeEvent + public static void onShowcaseEntityTickPre(EntityTickEvent.Pre event) { + Entity entity = event.getEntity(); + if (entity.level() instanceof ServerLevel + && entity.entityTags().contains(RetoldShowcaseEntities.EXHIBIT_TAG)) { + // NoAI does not stop Gale's direct flight, Guardian encounter ticks, or Retold Post + // dispatchers. Only these explicit developer exhibits skip their server tick and Post. + entity.setDeltaMovement(Vec3.ZERO); + event.setCanceled(true); + } + } + + @SubscribeEvent + public static void onShowcaseMobDespawn(MobDespawnEvent event) { + if (event.getEntity().entityTags().contains(RetoldShowcaseEntities.EXHIBIT_TAG)) { + // checkDespawn runs before Pre, including the Peaceful-mode hostile removal. + event.setResult(MobDespawnEvent.Result.DENY); + } + } +} diff --git a/src/main/java/cz/xefensor/retold/event/RetoldEndProgressionEvents.java b/src/main/java/cz/xefensor/retold/event/RetoldEndProgressionEvents.java index cada2786..54aff4e2 100644 --- a/src/main/java/cz/xefensor/retold/event/RetoldEndProgressionEvents.java +++ b/src/main/java/cz/xefensor/retold/event/RetoldEndProgressionEvents.java @@ -8,6 +8,7 @@ import cz.xefensor.retold.stage.RetoldWorldStage; import net.minecraft.core.BlockPos; import net.minecraft.network.chat.Component; +import net.minecraft.resources.Identifier; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.InteractionHand; @@ -21,6 +22,7 @@ import net.minecraft.world.level.dimension.end.EnderDragonFight; import net.minecraft.world.phys.AABB; import net.neoforged.bus.api.SubscribeEvent; +import net.neoforged.neoforge.event.ModifyRecipeJsonsEvent; import net.neoforged.neoforge.event.entity.player.PlayerInteractEvent; import net.neoforged.neoforge.event.tick.ServerTickEvent; @@ -31,6 +33,13 @@ public final class RetoldEndProgressionEvents { private RetoldEndProgressionEvents() { } + @SubscribeEvent + public static void onModifyRecipeJsons(ModifyRecipeJsonsEvent event) { + // A false-conditioned override falls through to the lower-priority vanilla recipe in 26.2. + // Remove the vanilla identity after resource layering; other datapack recipes remain opt-in. + event.getRecipeJsons().remove(Identifier.withDefaultNamespace("lodestone")); + } + @SubscribeEvent public static void onServerTickPost(ServerTickEvent.Post event) { ServerLevel endLevel = event.getServer().getLevel(Level.END); @@ -153,6 +162,10 @@ private static void sendOverlayMessage(Player player, Component message) { } private static RetoldRitualOffering getOfferingForStack(ItemStack stack) { + if (stack.is(Items.LODESTONE)) { + return RetoldRitualOffering.EARTH; + } + if (stack.is(Items.HEART_OF_THE_SEA) || stack.is(RetoldBlocks.WATER_ELEMENT)) { return RetoldRitualOffering.WATER; diff --git a/src/main/java/cz/xefensor/retold/gametest/RetoldGameTests.java b/src/main/java/cz/xefensor/retold/gametest/RetoldGameTests.java index b06d1a4d..24aca786 100644 --- a/src/main/java/cz/xefensor/retold/gametest/RetoldGameTests.java +++ b/src/main/java/cz/xefensor/retold/gametest/RetoldGameTests.java @@ -56,6 +56,7 @@ import cz.xefensor.retold.combat.RetoldTargetSource; import cz.xefensor.retold.combat.RetoldTargetRangeGameTests; import cz.xefensor.retold.combat.RetoldThreatRetargetGameTests; +import cz.xefensor.retold.command.showcase.RetoldShowcaseGameTests; import cz.xefensor.retold.compatibility.RetoldWorldProtectionGameTests; import cz.xefensor.retold.enderman.RetoldEndermanDefense; import cz.xefensor.retold.enchanting.RetoldEnchantingGameTests; @@ -94,6 +95,7 @@ import cz.xefensor.retold.worldgen.RetoldStructureRemovalGameTests; import cz.xefensor.retold.worldgen.air.RetoldAirTempleDiscoveryGameTests; import cz.xefensor.retold.worldgen.air.RetoldGaleCoreGameTests; +import cz.xefensor.retold.worldgen.earth.RetoldEarthLabyrinthGameTests; import cz.xefensor.retold.worldgen.fire.RetoldWildfireGameTests; import cz.xefensor.retold.worldgen.portal.RetoldNetherPortalDrainGameTests; import net.minecraft.core.BlockPos; @@ -373,6 +375,7 @@ public static void register(RegisterGameTestsEvent event) { RetoldSnowballGameTests.register(event, environment); RetoldEnchantingGameTests.register(event, environment); RetoldToolProgressionGameTests.register(event, environment); + RetoldShowcaseGameTests.register(event, environment); RetoldProgressionAcquisitionGameTests.register(event, environment); RetoldRecipeCompatibilityGameTests.register(event, environment); RetoldTerritoryGameTests.register(event, environment); @@ -386,6 +389,7 @@ public static void register(RegisterGameTestsEvent event) { RetoldVillagerTeachingGameTests.register(event, environment); RetoldAirTempleDiscoveryGameTests.register(event, environment); RetoldGaleCoreGameTests.register(event, environment); + RetoldEarthLabyrinthGameTests.register(event, environment); RetoldWildfireGameTests.register(event, environment); RetoldRuinedPortalGameTests.register(event, environment); RetoldStructureRemovalGameTests.register(event, environment); @@ -566,17 +570,17 @@ private static void worldDataTracksRitualProgress(GameTestHelper helper) { ); helper.assertValueEqual( data.offeredRequiredOfferingCount(), - 2, - "Life and Death must count toward the temporary hatch threshold" + 4, + "Every distinct offering must count toward hatching" ); helper.assertValueEqual( data.requiredOfferingCount(), - 4, - "The temporary hatch threshold must require four offerings" + 6, + "The completed acquisition paths must require all six offerings" ); helper.assertFalse( data.hasAllRequiredOfferings(), - "Life and Death alone must not complete the current ritual" + "Four offerings must not complete the ritual" ); data.offer(RetoldRitualOffering.AIR); @@ -587,7 +591,7 @@ private static void worldDataTracksRitualProgress(GameTestHelper helper) { data.offer(RetoldRitualOffering.WATER); helper.assertTrue( data.hasAllRequiredOfferings(), - "Water, Air, Life, and Death must complete the current ritual" + "All six offerings must complete the ritual" ); helper.assertValueEqual( data.offeredRequiredOfferingCount(), @@ -602,6 +606,17 @@ private static void worldDataTracksRitualProgress(GameTestHelper helper) { BlockPos.MutableBlockPos mutableEggPos = new BlockPos.MutableBlockPos(3, 5, 7); + for (RetoldRitualOffering missing : RetoldRitualOffering.values()) { + data.clearOfferings(); + for (RetoldRitualOffering offering : RetoldRitualOffering.values()) { + if (offering != missing) { + data.offer(offering); + } + } + helper.assertFalse(data.hasAllRequiredOfferings(), "Every artifact must gate hatching: " + missing); + data.offer(missing); + helper.assertTrue(data.hasAllRequiredOfferings(), "Any element may finish the ritual: " + missing); + } data.setDragonEggPos(mutableEggPos); mutableEggPos.set(9, 9, 9); helper.assertValueEqual( @@ -687,6 +702,13 @@ private static void dragonEggAcceptsFinalAndLegacyOfferings( data.clearOfferings(); data.clearDragonEggPos(); ItemStack heart = new ItemStack(Items.HEART_OF_THE_SEA); + ItemStack earlyEarth = new ItemStack(Items.LODESTONE, 2); + RetoldEndProgressionEvents.onDragonEggRightClick(useOnEgg(player, earlyEarth, eggPos)); + PlayerInteractEvent.RightClickBlock duplicateEarth = useOnEgg(player, earlyEarth, eggPos); + RetoldEndProgressionEvents.onDragonEggRightClick(duplicateEarth); + helper.assertTrue(earlyEarth.getCount() == 1 + && duplicateEarth.getCancellationResult() == InteractionResult.FAIL, + "Earth may be offered first, but duplicate Lodestone must not be consumed"); PlayerInteractEvent.RightClickBlock heartUse = useOnEgg( player, heart, @@ -768,8 +790,18 @@ private static void dragonEggAcceptsFinalAndLegacyOfferings( helper.assertTrue( data.getStage() == RetoldWorldStage.STAGE_2 && level.getBlockState(eggPos).is(Blocks.DRAGON_EGG), - "Fire must remain outside the hatch threshold until Earth exists" - ); + "Three offerings must not hatch the egg" + ); + RetoldEndProgressionEvents.onDragonEggRightClick(useOnEgg(player, new ItemStack(Items.HEAVY_CORE), eggPos)); + RetoldEndProgressionEvents.onDragonEggRightClick(useOnEgg(player, new ItemStack(Items.HEART_OF_THE_SEA), eggPos)); + helper.assertTrue(data.getStage() == RetoldWorldStage.STAGE_2 + && level.getBlockState(eggPos).is(Blocks.DRAGON_EGG), "Five offerings must leave the egg intact"); + ItemStack lodestone = new ItemStack(Items.LODESTONE, 2); + RetoldEndProgressionEvents.onDragonEggRightClick(useOnEgg(player, lodestone, eggPos)); + helper.assertTrue(lodestone.getCount() == 1 && data.hasOffering(RetoldRitualOffering.EARTH), + "Exactly one Lodestone must be sacrificed for Earth"); + helper.assertTrue(data.getStage() == RetoldWorldStage.STAGE_3 + && level.getBlockState(eggPos).isAir(), "The sixth offering must hatch the egg into Stage 3"); helper.succeed(); } finally { player.discard(); @@ -783,7 +815,7 @@ private static void dragonEggAcceptsFinalAndLegacyOfferings( } else { data.setDragonEggPos(originalEggPos); } - data.setStage(originalStage); + RetoldStageManager.setStage(level, originalStage); } } diff --git a/src/main/java/cz/xefensor/retold/module/RetoldWorldgenModule.java b/src/main/java/cz/xefensor/retold/module/RetoldWorldgenModule.java index 5fb2947b..72b27e61 100644 --- a/src/main/java/cz/xefensor/retold/module/RetoldWorldgenModule.java +++ b/src/main/java/cz/xefensor/retold/module/RetoldWorldgenModule.java @@ -5,6 +5,7 @@ import cz.xefensor.retold.worldgen.air.AirTempleDiscoveryEvents; import cz.xefensor.retold.worldgen.air.GaleCoreAttackEvents; import cz.xefensor.retold.worldgen.air.wind.AirTempleWindEvents; +import cz.xefensor.retold.worldgen.earth.EarthGuardianEvents; import cz.xefensor.retold.worldgen.fire.RetoldRemnantFireDamage; import cz.xefensor.retold.worldgen.fire.WildfireSpawnEvents; import cz.xefensor.retold.worldgen.portal.RetoldNetherPortalDrainEvents; @@ -29,6 +30,7 @@ public static void registerGameBus(IEventBus gameEventBus) { gameEventBus.register(RetoldWorldSpawnCache.class); gameEventBus.register(AirTempleDiscoveryEvents.class); gameEventBus.register(AirTempleWindEvents.class); + gameEventBus.register(EarthGuardianEvents.class); gameEventBus.register(GaleCoreAttackEvents.class); gameEventBus.register(RetoldRemnantFireDamage.class); gameEventBus.register(WildfireSpawnEvents.class); diff --git a/src/main/java/cz/xefensor/retold/progression/RetoldLootModifiers.java b/src/main/java/cz/xefensor/retold/progression/RetoldLootModifiers.java index 115ef78b..c0bfad73 100644 --- a/src/main/java/cz/xefensor/retold/progression/RetoldLootModifiers.java +++ b/src/main/java/cz/xefensor/retold/progression/RetoldLootModifiers.java @@ -31,6 +31,13 @@ public final class RetoldLootModifiers { () -> RetoldRemoveHeartOfTheSeaLootModifier.CODEC ); + public static final DeferredHolder< + MapCodec, + MapCodec + > REMOVE_LODESTONE = SERIALIZERS.register( + "remove_lodestone", () -> RetoldRemoveLodestoneLootModifier.CODEC + ); + private RetoldLootModifiers() { } diff --git a/src/main/java/cz/xefensor/retold/progression/RetoldProgressionAcquisitionGameTests.java b/src/main/java/cz/xefensor/retold/progression/RetoldProgressionAcquisitionGameTests.java index f3e7849a..ead7db25 100644 --- a/src/main/java/cz/xefensor/retold/progression/RetoldProgressionAcquisitionGameTests.java +++ b/src/main/java/cz/xefensor/retold/progression/RetoldProgressionAcquisitionGameTests.java @@ -72,6 +72,8 @@ public static void register( ) { TestData>> testData = new TestData<>(environment, EMPTY_STRUCTURE, 40, 0, true); + event.registerTest(retoldId("lodestone_is_exclusive_to_earth_guardian"), + new InlineGameTest(testData, RetoldProgressionAcquisitionGameTests::lodestoneAcquisition)); event.registerTest( retoldId("tool_progression_alternative_acquisition_respects_tiers"), new InlineGameTest( @@ -90,6 +92,35 @@ public static void register( ); } + private static void lodestoneAcquisition(GameTestHelper helper) { + helper.assertTrue(helper.getLevel().getServer().getRecipeManager().byKey( + ResourceKey.create(Registries.RECIPE, Identifier.withDefaultNamespace("lodestone"))).isEmpty(), + "The ordinary Lodestone crafting recipe must be disabled"); + for (String table : List.of("chests/ruined_portal", "chests/bastion_bridge")) { + for (long seed = 0; seed < 128; seed++) { + List loot = chestLoot(helper, table, seed); + helper.assertTrue(!loot.isEmpty(), "Non-artifact chest rewards must remain"); + helper.assertFalse(loot.stream().anyMatch(stack -> stack.is(Items.LODESTONE)), + "Vanilla chest loot must not bypass the Earth Guardian"); + } + } + var level = helper.getLevel(); + var boss = helper.spawn(cz.xefensor.retold.registry.RetoldEntityTypes.EARTH_GUARDIAN.get(), + 4.0D, 3.0D, 4.0D, net.minecraft.world.entity.EntitySpawnReason.COMMAND); + try { + boss.hurtServer(level, level.damageSources().genericKill(), Float.MAX_VALUE); + var drops = level.getEntitiesOfClass(net.minecraft.world.entity.item.ItemEntity.class, + boss.getBoundingBox().inflate(2.0D)); + helper.assertValueEqual(drops.stream().filter(drop -> drop.getItem().is(Items.LODESTONE)) + .mapToInt(drop -> drop.getItem().getCount()).sum(), 1, + "An actual guardian death must drop exactly one Lodestone"); + drops.forEach(net.minecraft.world.entity.Entity::discard); + } finally { + boss.discard(); + } + helper.succeed(); + } + private static void buriedTreasureExcludesHeartOfTheSea( GameTestHelper helper ) { diff --git a/src/main/java/cz/xefensor/retold/progression/RetoldRemoveLodestoneLootModifier.java b/src/main/java/cz/xefensor/retold/progression/RetoldRemoveLodestoneLootModifier.java new file mode 100644 index 00000000..daaf62c9 --- /dev/null +++ b/src/main/java/cz/xefensor/retold/progression/RetoldRemoveLodestoneLootModifier.java @@ -0,0 +1,34 @@ +package cz.xefensor.retold.progression; + +import com.mojang.serialization.MapCodec; +import com.mojang.serialization.codecs.RecordCodecBuilder; +import it.unimi.dsi.fastutil.objects.ObjectArrayList; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; +import net.minecraft.world.level.storage.loot.LootContext; +import net.minecraft.world.level.storage.loot.predicates.LootItemCondition; +import net.neoforged.neoforge.common.loot.IGlobalLootModifier; +import net.neoforged.neoforge.common.loot.LootModifier; + +/** Removes alternative Earth artifact loot only from the tables selected by datapack conditions. */ +public final class RetoldRemoveLodestoneLootModifier extends LootModifier { + public static final MapCodec CODEC = + RecordCodecBuilder.mapCodec(instance -> codecStart(instance).apply( + instance, RetoldRemoveLodestoneLootModifier::new + )); + + public RetoldRemoveLodestoneLootModifier(LootItemCondition[] conditions, int priority) { + super(conditions, priority); + } + + @Override + protected ObjectArrayList doApply(ObjectArrayList generatedLoot, LootContext context) { + generatedLoot.removeIf(stack -> stack.is(Items.LODESTONE)); + return generatedLoot; + } + + @Override + public MapCodec codec() { + return RetoldLootModifiers.REMOVE_LODESTONE.get(); + } +} diff --git a/src/main/java/cz/xefensor/retold/progression/RetoldToolProgressionGameTests.java b/src/main/java/cz/xefensor/retold/progression/RetoldToolProgressionGameTests.java index 7e692714..a6efecfb 100644 --- a/src/main/java/cz/xefensor/retold/progression/RetoldToolProgressionGameTests.java +++ b/src/main/java/cz/xefensor/retold/progression/RetoldToolProgressionGameTests.java @@ -1,6 +1,7 @@ package cz.xefensor.retold.progression; import cz.xefensor.retold.registry.RetoldBlocks; +import cz.xefensor.retold.registry.RetoldEquipmentAssets; import cz.xefensor.retold.registry.RetoldTags; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; @@ -794,6 +795,17 @@ private static void harvestRulesEnforceMaterialLadder( "Steel armor must support normal armor systems and trims" ); + for (Item armor : List.of( + RetoldBlocks.STEEL_HELMET.get(), RetoldBlocks.STEEL_CHESTPLATE.get(), + RetoldBlocks.STEEL_LEGGINGS.get(), RetoldBlocks.STEEL_BOOTS.get() + )) { + var equippable = armor.getDefaultInstance().get(DataComponents.EQUIPPABLE); + helper.assertTrue( + equippable != null && equippable.assetId().filter(RetoldEquipmentAssets.STEEL::equals).isPresent(), + "Every Steel armor slot must use Retold's equipment asset" + ); + } + var enchantments = helper.getLevel() .registryAccess() .lookupOrThrow(Registries.ENCHANTMENT); diff --git a/src/main/java/cz/xefensor/retold/registry/RetoldBlocks.java b/src/main/java/cz/xefensor/retold/registry/RetoldBlocks.java index 043c40fa..62fa513b 100644 --- a/src/main/java/cz/xefensor/retold/registry/RetoldBlocks.java +++ b/src/main/java/cz/xefensor/retold/registry/RetoldBlocks.java @@ -27,7 +27,6 @@ import net.minecraft.world.item.ToolMaterial; import net.minecraft.world.item.equipment.ArmorMaterial; import net.minecraft.world.item.equipment.ArmorType; -import net.minecraft.world.item.equipment.EquipmentAssets; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.ColoredFallingBlock; @@ -80,7 +79,7 @@ public final class RetoldBlocks { 1.0F, 0.0F, RetoldTags.STEEL_REPAIR_MATERIALS, - EquipmentAssets.IRON + RetoldEquipmentAssets.STEEL ); public static final DeferredItem FLINT_MULTI_TOOL = ITEMS.registerItem( @@ -246,6 +245,13 @@ public final class RetoldBlocks { properties -> new SpawnEggItem(properties.spawnEgg(RetoldEntityTypes.WILDFIRE.get())) ); + public static final DeferredItem EARTH_GUARDIAN_SPAWN_EGG = ITEMS.registerItem( + "earth_guardian_spawn_egg", + properties -> new SpawnEggItem( + properties.spawnEgg(RetoldEntityTypes.EARTH_GUARDIAN.get()) + ) + ); + public static final DeferredBlock ANIMAL_FEEDER = BLOCKS.register( "animal_feeder", registryName -> new AnimalFeederBlock( diff --git a/src/main/java/cz/xefensor/retold/registry/RetoldCreativeModeTabs.java b/src/main/java/cz/xefensor/retold/registry/RetoldCreativeModeTabs.java index e3be6765..59fa2f91 100644 --- a/src/main/java/cz/xefensor/retold/registry/RetoldCreativeModeTabs.java +++ b/src/main/java/cz/xefensor/retold/registry/RetoldCreativeModeTabs.java @@ -141,6 +141,11 @@ private static void addIngredients(BuildCreativeModeTabContentsEvent event) { private static void addSpawnEggs(BuildCreativeModeTabContentsEvent event) { insertAfter(event, Items.BLAZE_SPAWN_EGG, RetoldBlocks.WILDFIRE_SPAWN_EGG.get()); insertAfter(event, Items.BREEZE_SPAWN_EGG, RetoldBlocks.GALE_CORE_SPAWN_EGG.get()); + insertAfter( + event, + Items.IRON_GOLEM_SPAWN_EGG, + RetoldBlocks.EARTH_GUARDIAN_SPAWN_EGG.get() + ); insertAfter(event, Items.ENDERMAN_SPAWN_EGG, RetoldBlocks.AENDER_EYE_SPAWN_EGG.get()); } diff --git a/src/main/java/cz/xefensor/retold/registry/RetoldEntityEvents.java b/src/main/java/cz/xefensor/retold/registry/RetoldEntityEvents.java index 2c7594c0..b49892cd 100644 --- a/src/main/java/cz/xefensor/retold/registry/RetoldEntityEvents.java +++ b/src/main/java/cz/xefensor/retold/registry/RetoldEntityEvents.java @@ -2,6 +2,7 @@ import cz.xefensor.retold.aender.entity.AenderEye; import cz.xefensor.retold.worldgen.air.GaleCore; +import cz.xefensor.retold.worldgen.earth.EarthGuardian; import cz.xefensor.retold.worldgen.fire.Wildfire; import net.minecraft.world.entity.SpawnPlacementTypes; import net.minecraft.world.level.levelgen.Heightmap; @@ -16,6 +17,10 @@ public static void registerAttributes(EntityAttributeCreationEvent event) { event.put(RetoldEntityTypes.AENDER_EYE.get(), AenderEye.createAttributes().build()); event.put(RetoldEntityTypes.GALE_CORE.get(), GaleCore.createAttributes().build()); event.put(RetoldEntityTypes.WILDFIRE.get(), Wildfire.createAttributes().build()); + event.put( + RetoldEntityTypes.EARTH_GUARDIAN.get(), + EarthGuardian.createAttributes().build() + ); } public static void registerSpawnPlacements(RegisterSpawnPlacementsEvent event) { diff --git a/src/main/java/cz/xefensor/retold/registry/RetoldEntityTypes.java b/src/main/java/cz/xefensor/retold/registry/RetoldEntityTypes.java index 48143c12..70a4daff 100644 --- a/src/main/java/cz/xefensor/retold/registry/RetoldEntityTypes.java +++ b/src/main/java/cz/xefensor/retold/registry/RetoldEntityTypes.java @@ -3,6 +3,7 @@ import cz.xefensor.retold.Retold; import cz.xefensor.retold.aender.entity.AenderEye; import cz.xefensor.retold.worldgen.air.GaleCore; +import cz.xefensor.retold.worldgen.earth.EarthGuardian; import cz.xefensor.retold.worldgen.fire.Wildfire; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.MobCategory; @@ -50,6 +51,17 @@ public final class RetoldEntityTypes { .updateInterval(3) ); + public static final DeferredHolder, EntityType> EARTH_GUARDIAN = + ENTITY_TYPES.registerEntityType( + "earth_guardian", + EarthGuardian::new, + MobCategory.MONSTER, + builder -> builder + .sized(1.6F, 3.2F) + .clientTrackingRange(10) + .updateInterval(3) + ); + public static final DeferredHolder, EntityType> AENDER_BOAT = ENTITY_TYPES.registerEntityType( "aender_boat", diff --git a/src/main/java/cz/xefensor/retold/registry/RetoldEquipmentAssets.java b/src/main/java/cz/xefensor/retold/registry/RetoldEquipmentAssets.java new file mode 100644 index 00000000..fcba70b8 --- /dev/null +++ b/src/main/java/cz/xefensor/retold/registry/RetoldEquipmentAssets.java @@ -0,0 +1,18 @@ +package cz.xefensor.retold.registry; + +import cz.xefensor.retold.Retold; +import net.minecraft.resources.Identifier; +import net.minecraft.resources.ResourceKey; +import net.minecraft.world.item.equipment.EquipmentAsset; +import net.minecraft.world.item.equipment.EquipmentAssets; + +/** Client equipment definitions use resource keys rather than a separate content registry. */ +public final class RetoldEquipmentAssets { + public static final ResourceKey STEEL = ResourceKey.create( + EquipmentAssets.ROOT_ID, + Identifier.fromNamespaceAndPath(Retold.MODID, "steel") + ); + + private RetoldEquipmentAssets() { + } +} diff --git a/src/main/java/cz/xefensor/retold/stage/RetoldWorldData.java b/src/main/java/cz/xefensor/retold/stage/RetoldWorldData.java index c0df363c..f02195fb 100644 --- a/src/main/java/cz/xefensor/retold/stage/RetoldWorldData.java +++ b/src/main/java/cz/xefensor/retold/stage/RetoldWorldData.java @@ -13,12 +13,11 @@ import java.util.Set; public class RetoldWorldData extends SavedData { - /* - * Keep the hatch threshold on the four implemented acquisition paths until - * Fire and Earth make the full six-offering ritual survival-obtainable. - */ + // All six acquisition paths now provide their artifacts; keep their saved bit positions stable. private static final Set CURRENT_REQUIRED_EGG_OFFERINGS = Set.of( RetoldRitualOffering.WATER, + RetoldRitualOffering.FIRE, + RetoldRitualOffering.EARTH, RetoldRitualOffering.AIR, RetoldRitualOffering.LIFE, RetoldRitualOffering.DEATH diff --git a/src/main/java/cz/xefensor/retold/worldgen/RetoldWorldgenRegistries.java b/src/main/java/cz/xefensor/retold/worldgen/RetoldWorldgenRegistries.java index f09229fe..80c1f0d9 100644 --- a/src/main/java/cz/xefensor/retold/worldgen/RetoldWorldgenRegistries.java +++ b/src/main/java/cz/xefensor/retold/worldgen/RetoldWorldgenRegistries.java @@ -4,6 +4,9 @@ import cz.xefensor.retold.Retold; import cz.xefensor.retold.worldgen.air.AirTemplePiece; import cz.xefensor.retold.worldgen.air.AirTempleStructure; +import cz.xefensor.retold.worldgen.earth.EarthJungleTemplePiece; +import cz.xefensor.retold.worldgen.earth.EarthJungleTempleStructure; +import cz.xefensor.retold.worldgen.earth.EarthLabyrinthPiece; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.world.level.levelgen.DensityFunction; import net.minecraft.world.level.levelgen.structure.StructureType; @@ -47,6 +50,33 @@ public final class RetoldWorldgenRegistries { () -> (StructurePieceType.ContextlessType) AirTemplePiece::new ); + public static final DeferredHolder< + StructureType, + StructureType + > EARTH_JUNGLE_TEMPLE_STRUCTURE = + STRUCTURE_TYPES.register( + "earth_jungle_temple", + () -> () -> EarthJungleTempleStructure.CODEC + ); + + public static final DeferredHolder< + StructurePieceType, + StructurePieceType + > EARTH_JUNGLE_TEMPLE_PIECE = + STRUCTURE_PIECE_TYPES.register( + "earth_jungle_temple", + () -> (StructurePieceType.ContextlessType) EarthJungleTemplePiece::new + ); + + public static final DeferredHolder< + StructurePieceType, + StructurePieceType + > EARTH_LABYRINTH_PIECE = + STRUCTURE_PIECE_TYPES.register( + "earth_labyrinth", + () -> (StructurePieceType.ContextlessType) EarthLabyrinthPiece::new + ); + private RetoldWorldgenRegistries() { } diff --git a/src/main/java/cz/xefensor/retold/worldgen/earth/EarthGuardian.java b/src/main/java/cz/xefensor/retold/worldgen/earth/EarthGuardian.java new file mode 100644 index 00000000..cda12af7 --- /dev/null +++ b/src/main/java/cz/xefensor/retold/worldgen/earth/EarthGuardian.java @@ -0,0 +1,1522 @@ +package cz.xefensor.retold.worldgen.earth; + +import cz.xefensor.retold.behavior.control.RetoldAiControl; +import cz.xefensor.retold.behavior.control.RetoldAiControlMode; +import cz.xefensor.retold.behavior.control.RetoldAiControlOwner; +import cz.xefensor.retold.behavior.control.RetoldAiPriorities; +import cz.xefensor.retold.behavior.core.RetoldMobGriefing; +import cz.xefensor.retold.behavior.core.RetoldBehaviorMovement; +import cz.xefensor.retold.stage.RetoldWorldData; +import cz.xefensor.retold.stage.RetoldWorldStage; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Holder; +import net.minecraft.core.Direction; +import net.minecraft.core.particles.ParticleOptions; +import net.minecraft.core.particles.ParticleTypes; +import net.minecraft.network.chat.Component; +import net.minecraft.network.syncher.EntityDataAccessor; +import net.minecraft.network.syncher.EntityDataSerializers; +import net.minecraft.network.syncher.SynchedEntityData; +import net.minecraft.server.level.ServerBossEvent; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.world.BossEvent; +import net.minecraft.world.damagesource.DamageSource; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntitySelector; +import net.minecraft.world.entity.EntitySpawnReason; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.Mob; +import net.minecraft.world.entity.SpawnGroupData; +import net.minecraft.world.entity.TraceableEntity; +import net.minecraft.world.entity.item.FallingBlockEntity; +import net.minecraft.world.entity.ai.attributes.AttributeSupplier; +import net.minecraft.world.entity.ai.attributes.Attributes; +import net.minecraft.world.entity.ai.goal.Goal; +import net.minecraft.world.entity.animal.golem.IronGolem; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.level.gameevent.DynamicGameEventListener; +import net.minecraft.world.level.gameevent.EntityPositionSource; +import net.minecraft.world.level.gameevent.GameEvent; +import net.minecraft.world.level.gameevent.PositionSource; +import net.minecraft.world.level.gameevent.vibrations.VibrationSystem; +import net.minecraft.tags.GameEventTags; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.ServerLevelAccessor; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.levelgen.structure.BoundingBox; +import net.minecraft.world.level.pathfinder.Path; +import net.minecraft.world.level.storage.ValueInput; +import net.minecraft.world.level.storage.ValueOutput; +import net.minecraft.world.phys.AABB; +import net.minecraft.world.phys.Vec3; +import org.jspecify.annotations.Nullable; + +import java.util.EnumSet; +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; +import java.util.function.BiConsumer; + +public final class EarthGuardian extends IronGolem implements VibrationSystem { + static final int AWAKENING_DURATION_TICKS = 60; + private static final int VIBRATION_LISTENER_RADIUS = 32; + private static final int VIBRATION_MEMORY_TICKS = 240; + private static final int INVESTIGATION_CONTROL_TICKS = 30; + private static final int PATROL_RETRY_TICKS = 100; + private static final int TERRAIN_EDIT_INTERVAL_TICKS = 10; + static final int TERRAIN_EDITS_PER_PULSE = 12; + private static final int WALL_INTERVAL_TICKS = 40; + // Covers the full 3-wide ramp work space plus the body-clear trailing space before backfill. + private static final int TERRAIN_RESERVE_LIMIT = 128; + private static final int ENVIRONMENTAL_ATTACK_COOLDOWN_TICKS = 80; + private static final int ENVIRONMENTAL_ATTACK_WINDUP_TICKS = 30; + private static final int ENVIRONMENTAL_TELEGRAPH_INTERVAL_TICKS = 5; + private static final int COLLAPSE_MAX_BLOCKS = 5; + private static final int COLLAPSE_MIN_HEIGHT = 3; + private static final int COLLAPSE_MAX_HEIGHT = 12; + private static final int[][] COLLAPSE_OFFSETS = { + {0, 0}, {1, 0}, {-1, 0}, {0, 1}, {0, -1} + }; + private static final double ENVIRONMENTAL_ATTACK_RANGE = 24.0D; + private static final double ENVIRONMENTAL_ATTACK_VERTICAL_RANGE = 6.0D; + private static final int LAVA_POOL_RADIUS = 1; + private static final int FLOOR_COLLAPSE_RADIUS = 1; + private static final int FLOOR_COLLAPSE_DEPTH = 4; + private static final float COLLAPSE_DAMAGE_PER_DISTANCE = 4.0F; + private static final int COLLAPSE_MAX_DAMAGE = 18; + private static final double INVESTIGATION_SPEED = 1.4D; + private static final double PATROL_SPEED = 0.8D; + private static final double ACTIVATION_HORIZONTAL_RANGE = 17.0D; + private static final double ACTIVATION_VERTICAL_RANGE = 12.0D; + private static final EntityDataAccessor LIFECYCLE = SynchedEntityData.defineId( + EarthGuardian.class, + EntityDataSerializers.INT + ); + private static final EntityDataAccessor AWAKENING_TICKS = SynchedEntityData.defineId( + EarthGuardian.class, + EntityDataSerializers.INT + ); + + private final ServerBossEvent bossEvent = new ServerBossEvent( + this.getUUID(), + Component.translatable("entity.retold.earth_guardian"), + BossEvent.BossBarColor.YELLOW, + BossEvent.BossBarOverlay.PROGRESS + ); + private final VibrationSystem.User vibrationUser = new GuardianVibrationUser(); + private VibrationSystem.Data vibrationData = new VibrationSystem.Data(); + private final DynamicGameEventListener vibrationListener = + new DynamicGameEventListener<>(new VibrationSystem.Listener(this)); + private BlockPos guardianPosition; + private BoundingBox labyrinthBounds; + private final List terrainReserve = new ArrayList<>(); + private final EarthGuardianRoute excavationRoute = new EarthGuardianRoute(this); + private final EarthGuardianMelee melee = new EarthGuardianMelee(this); + private long labyrinthKey; + private boolean structureBound; + private int awakeningTicks; + private BlockPos vibrationTarget; + private UUID vibrationSourcePlayer; + private int vibrationMemoryTicks; + private int vibrationStrength; + private int nextTerrainEditTick; + private int nextWallTick; + private int environmentalAttackCooldownTicks; + private int environmentalAttackWindupTicks; + private BlockPos environmentalAttackTarget; + private EnvironmentalAttackType environmentalAttackType; + private EnvironmentalAttackType nextEnvironmentalAttack = EnvironmentalAttackType.CEILING_COLLAPSE; + + public EarthGuardian(EntityType type, Level level) { + super(type, level); + this.setPersistenceRequired(); + this.xpReward = 0; + applyLifecycleState(); + } + + public static AttributeSupplier.Builder createAttributes() { + return Mob.createMobAttributes() + .add(Attributes.MAX_HEALTH, 250.0D) + .add(Attributes.MOVEMENT_SPEED, 0.23D) + .add(Attributes.FOLLOW_RANGE, 32.0D) + .add(Attributes.ATTACK_DAMAGE, 18.0D) + .add(Attributes.ATTACK_KNOCKBACK, 1.5D) + .add(Attributes.ARMOR, 12.0D) + .add(Attributes.KNOCKBACK_RESISTANCE, 1.0D) + .add(Attributes.STEP_HEIGHT, 1.0D); + } + + @Override + protected void registerGoals() { + // Sight-based vanilla Golem goals would contradict the confirmed blind guardian design. + this.goalSelector.addGoal(1, new InvestigateVibrationGoal(this)); + this.goalSelector.addGoal(2, new MazePatrolGoal(this)); + } + + @Override + protected void defineSynchedData(SynchedEntityData.Builder entityData) { + super.defineSynchedData(entityData); + entityData.define(LIFECYCLE, EarthGuardianLifecycle.DORMANT.ordinal()); + entityData.define(AWAKENING_TICKS, 0); + } + + @Override + public void tick() { + super.tick(); + this.bossEvent.setProgress(this.getHealth() / this.getMaxHealth()); + + if (this.level() instanceof ServerLevel serverLevel) { + tickGuardianState(serverLevel); + + if (lifecycle() == EarthGuardianLifecycle.ROAMING) { + VibrationSystem.Ticker.tick(serverLevel, vibrationData, vibrationUser); + tickVibrationMemory(); + tickEnvironmentalCombat(serverLevel); + melee.tick(serverLevel); + tickTerrainControl(serverLevel); + } + } + } + + void tickGuardianState(ServerLevel level) { + EarthGuardianLifecycle lifecycle = lifecycle(); + + if (structureBound + && (lifecycle == EarthGuardianLifecycle.DORMANT + || lifecycle == EarthGuardianLifecycle.AWAKENING)) { + keepAtGuardianPosition(); + } + + if (lifecycle == EarthGuardianLifecycle.DORMANT + && structureBound + && isStageTwo(level) + && hasActivatingPlayer(level)) { + transitionTo(level, EarthGuardianLifecycle.AWAKENING); + setAwakeningTicks(AWAKENING_DURATION_TICKS); + return; + } + + if (lifecycle == EarthGuardianLifecycle.AWAKENING) { + if (awakeningTicks > 0) { + setAwakeningTicks(awakeningTicks - 1); + } + + if (awakeningTicks == 0) { + transitionTo(level, EarthGuardianLifecycle.ROAMING); + } + } + } + + void configureForLabyrinth( + ServerLevel level, + EarthLabyrinthSource source, + EarthGuardianLifecycle lifecycle + ) { + boolean firstBinding = !this.structureBound || this.labyrinthKey != source.key(); + this.guardianPosition = source.guardianPosition(); + this.labyrinthBounds = copyBounds(source.structureBounds()); + this.labyrinthKey = source.key(); + this.structureBound = true; + + // The source scan repeats every 40 ticks, including after entity reload. Only initial + // placement and the stationary statue states may move the guardian to its chamber. + if (firstBinding + || lifecycle == EarthGuardianLifecycle.DORMANT + || lifecycle == EarthGuardianLifecycle.AWAKENING) { + keepAtGuardianPosition(); + } + + if (lifecycle() != lifecycle) { + setLifecycle(lifecycle); + } + + if (lifecycle == EarthGuardianLifecycle.AWAKENING && awakeningTicks <= 0) { + setAwakeningTicks(AWAKENING_DURATION_TICKS); + } + + EarthGuardianEncounterData.get(level).setLifecycle(labyrinthKey, lifecycle); + } + + private void transitionTo(ServerLevel level, EarthGuardianLifecycle lifecycle) { + setLifecycle(lifecycle); + + if (structureBound) { + EarthGuardianEncounterData.get(level).setLifecycle(labyrinthKey, lifecycle); + } + } + + private void setLifecycle(EarthGuardianLifecycle lifecycle) { + this.entityData.set(LIFECYCLE, lifecycle.ordinal()); + applyLifecycleState(); + } + + public EarthGuardianLifecycle lifecycle() { + return EarthGuardianLifecycle.bySerializedId(this.entityData.get(LIFECYCLE)); + } + + private void setAwakeningTicks(int ticks) { + awakeningTicks = ticks; + // Only this bounded transition sends updates. Tracking clients, including late joins, + // receive the saved encounter countdown instead of restarting a local animation clock. + this.entityData.set(AWAKENING_TICKS, ticks); + } + + public float awakeningProgress(float partialTick) { + float remaining = this.entityData.get(AWAKENING_TICKS) - partialTick; + return Math.clamp(1.0F - remaining / AWAKENING_DURATION_TICKS, 0.0F, 1.0F); + } + + public boolean isStructureBound() { + return structureBound; + } + + public long labyrinthKey() { + return labyrinthKey; + } + + public boolean isBossBarVisible() { + return this.bossEvent.isVisible(); + } + + private void applyLifecycleState() { + EarthGuardianLifecycle lifecycle = lifecycle(); + boolean dormant = lifecycle == EarthGuardianLifecycle.DORMANT; + boolean defeated = lifecycle == EarthGuardianLifecycle.DEFEATED; + boolean roaming = lifecycle == EarthGuardianLifecycle.ROAMING; + + this.setNoAi(!roaming); + this.setInvulnerable(!roaming && !defeated); + this.bossEvent.setVisible(!dormant && !defeated); + this.setTarget(null); + + if (!roaming) { + this.getNavigation().stop(); + // Client spawn constructs the entity before its network ID exists; AI ownership is server-only. + if (this.level() instanceof ServerLevel) { + RetoldAiControl.clearIfOwnedBy(this, RetoldAiControlOwner.EARTH_GUARDIAN); + } + this.setDeltaMovement(Vec3.ZERO); + clearPendingEnvironmentalAttack(); + } + } + + private void keepAtGuardianPosition() { + if (guardianPosition == null) { + return; + } + + double expectedX = guardianPosition.getX() + 0.5D; + double expectedY = guardianPosition.getY(); + double expectedZ = guardianPosition.getZ() + 0.5D; + + if (this.distanceToSqr(expectedX, expectedY, expectedZ) > 0.01D) { + this.setPos(expectedX, expectedY, expectedZ); + } + + this.setDeltaMovement(Vec3.ZERO); + } + + private boolean hasActivatingPlayer(ServerLevel level) { + if (guardianPosition == null) { + return false; + } + + AABB activationBounds = new AABB(guardianPosition).inflate( + ACTIVATION_HORIZONTAL_RANGE, + ACTIVATION_VERTICAL_RANGE, + ACTIVATION_HORIZONTAL_RANGE + ); + return level.players().stream().anyMatch(player -> + EntitySelector.NO_CREATIVE_OR_SPECTATOR.test(player) + && activationBounds.intersects(player.getBoundingBox()) + ); + } + + private static boolean isStageTwo(ServerLevel level) { + return RetoldWorldData.get(level).getStage().getId() + >= RetoldWorldStage.STAGE_2.getId(); + } + + @Override + public @Nullable SpawnGroupData finalizeSpawn( + ServerLevelAccessor level, + net.minecraft.world.DifficultyInstance difficulty, + EntitySpawnReason spawnReason, + @Nullable SpawnGroupData groupData + ) { + SpawnGroupData result = super.finalizeSpawn(level, difficulty, spawnReason, groupData); + + if (spawnReason == EntitySpawnReason.SPAWN_ITEM_USE + || spawnReason == EntitySpawnReason.COMMAND) { + this.structureBound = false; + setLifecycle(EarthGuardianLifecycle.ROAMING); + } + + return result; + } + + @Override + public boolean hurtServer(ServerLevel level, DamageSource source, float damage) { + if (structureBound) { + if (lifecycle() != EarthGuardianLifecycle.ROAMING) { + return false; + } + + if (source.getEntity() instanceof ServerPlayer player + && isValidVibrationPlayer(player)) { + rememberVibration( + player.blockPosition(), + GameEvent.ENTITY_DAMAGE, + player, + 0.0F + ); + } + } + + return super.hurtServer(level, source, damage); + } + + @Override + public boolean doHurtTarget(ServerLevel level, Entity target) { + if (!melee.canAttack(level, target)) { + return false; + } + melee.recordAttack(); + return super.doHurtTarget(level, target); + } + + @Override + public void die(DamageSource source) { + if (structureBound && this.level() instanceof ServerLevel level) { + transitionTo(level, EarthGuardianLifecycle.DEFEATED); + } + + super.die(source); + } + + @Override + public boolean isPushable() { + return !structureBound && super.isPushable(); + } + + @Override + protected void doPush(Entity entity) { + if (structureBound + && lifecycle() == EarthGuardianLifecycle.ROAMING + && entity instanceof ServerPlayer player + && isValidVibrationPlayer(player)) { + rememberVibration( + player.blockPosition(), + GameEvent.HIT_GROUND, + player, + 0.0F + ); + } else if (!structureBound) { + super.doPush(entity); + } + } + + @Override + public boolean canUsePortal(boolean ignorePassenger) { + return !structureBound && super.canUsePortal(ignorePassenger); + } + + @Override + public void startSeenByPlayer(ServerPlayer player) { + super.startSeenByPlayer(player); + this.bossEvent.addPlayer(player); + } + + @Override + public void stopSeenByPlayer(ServerPlayer player) { + super.stopSeenByPlayer(player); + this.bossEvent.removePlayer(player); + } + + @Override + public void remove(RemovalReason reason) { + super.remove(reason); + this.bossEvent.removeAllPlayers(); + RetoldAiControl.clear(this); + } + + @Override + public void updateDynamicGameEventListener( + BiConsumer, ServerLevel> consumer + ) { + if (this.level() instanceof ServerLevel serverLevel) { + consumer.accept(vibrationListener, serverLevel); + } + } + + @Override + public VibrationSystem.Data getVibrationData() { + return vibrationData; + } + + @Override + public VibrationSystem.User getVibrationUser() { + return vibrationUser; + } + + @Override + protected void addAdditionalSaveData(ValueOutput output) { + super.addAdditionalSaveData(output); + output.putInt("retold_lifecycle", lifecycle().ordinal()); + output.putBoolean("retold_structure_bound", structureBound); + output.putLong("retold_labyrinth_key", labyrinthKey); + output.putInt("retold_awakening_ticks", awakeningTicks); + output.putInt("retold_vibration_memory_ticks", vibrationMemoryTicks); + output.putInt("retold_vibration_strength", vibrationStrength); + output.putInt("retold_environmental_attack_cooldown", environmentalAttackCooldownTicks); + output.putInt("retold_environmental_attack_windup", environmentalAttackWindupTicks); + output.putInt("retold_next_environmental_attack", nextEnvironmentalAttack.ordinal()); + output.store("retold_vibration_listener", VibrationSystem.Data.CODEC, vibrationData); + ValueOutput.TypedOutputList reserve = output.list( + "retold_terrain_reserve", + BlockState.CODEC + ); + terrainReserve.forEach(reserve::add); + excavationRoute.save(output); + melee.save(output); + + if (guardianPosition != null) { + output.store("retold_guardian_position", BlockPos.CODEC, guardianPosition); + } + if (vibrationTarget != null) { + output.store("retold_vibration_target", BlockPos.CODEC, vibrationTarget); + } + if (vibrationSourcePlayer != null) { + output.putString("retold_vibration_source_player", vibrationSourcePlayer.toString()); + } + if (environmentalAttackTarget != null && environmentalAttackType != null) { + output.store( + "retold_environmental_attack_target", + BlockPos.CODEC, + environmentalAttackTarget + ); + output.putInt("retold_environmental_attack_type", environmentalAttackType.ordinal()); + } + if (labyrinthBounds != null) { + output.putInt("retold_labyrinth_min_x", labyrinthBounds.minX()); + output.putInt("retold_labyrinth_min_y", labyrinthBounds.minY()); + output.putInt("retold_labyrinth_min_z", labyrinthBounds.minZ()); + output.putInt("retold_labyrinth_max_x", labyrinthBounds.maxX()); + output.putInt("retold_labyrinth_max_y", labyrinthBounds.maxY()); + output.putInt("retold_labyrinth_max_z", labyrinthBounds.maxZ()); + output.putBoolean("retold_has_labyrinth_bounds", true); + } + } + + @Override + protected void readAdditionalSaveData(ValueInput input) { + super.readAdditionalSaveData(input); + melee.load(input); + this.structureBound = input.getBooleanOr("retold_structure_bound", false); + this.labyrinthKey = input.getLongOr("retold_labyrinth_key", 0L); + setAwakeningTicks(input.getIntOr("retold_awakening_ticks", 0)); + this.vibrationMemoryTicks = input.getIntOr("retold_vibration_memory_ticks", 0); + this.vibrationStrength = input.getIntOr("retold_vibration_strength", 0); + this.environmentalAttackCooldownTicks = Math.max( + 0, + input.getIntOr("retold_environmental_attack_cooldown", 0) + ); + this.environmentalAttackWindupTicks = Math.max( + 0, + input.getIntOr("retold_environmental_attack_windup", 0) + ); + // Preserve the next attack from saves made before the three-hazard rotation existed. + EnvironmentalAttackType restoredNext = EnvironmentalAttackType.bySerializedId(input.getIntOr( + "retold_next_environmental_attack", + input.getBooleanOr("retold_prefer_lava_attack", false) ? 1 : 0 + )); + this.nextEnvironmentalAttack = restoredNext == null + ? EnvironmentalAttackType.CEILING_COLLAPSE : restoredNext; + this.vibrationData = input.read( + "retold_vibration_listener", + VibrationSystem.Data.CODEC + ).orElseGet(VibrationSystem.Data::new); + this.guardianPosition = input.read("retold_guardian_position", BlockPos.CODEC) + .orElse(null); + this.vibrationTarget = input.read("retold_vibration_target", BlockPos.CODEC) + .orElse(null); + this.vibrationSourcePlayer = parseUuid( + input.getStringOr("retold_vibration_source_player", "") + ); + this.environmentalAttackTarget = input.read( + "retold_environmental_attack_target", + BlockPos.CODEC + ) + .orElse(null); + this.environmentalAttackType = EnvironmentalAttackType.bySerializedId( + input.getIntOr("retold_environmental_attack_type", -1) + ); + this.labyrinthBounds = input.getBooleanOr("retold_has_labyrinth_bounds", false) + ? new BoundingBox( + input.getIntOr("retold_labyrinth_min_x", 0), + input.getIntOr("retold_labyrinth_min_y", 0), + input.getIntOr("retold_labyrinth_min_z", 0), + input.getIntOr("retold_labyrinth_max_x", 0), + input.getIntOr("retold_labyrinth_max_y", 0), + input.getIntOr("retold_labyrinth_max_z", 0) + ) + : null; + this.terrainReserve.clear(); + excavationRoute.load(input); + input.listOrEmpty("retold_terrain_reserve", BlockState.CODEC).forEach(state -> { + if (terrainReserve.size() < TERRAIN_RESERVE_LIMIT && !state.isAir()) { + terrainReserve.add(state); + } + }); + setLifecycle(EarthGuardianLifecycle.bySerializedId( + input.getIntOr("retold_lifecycle", EarthGuardianLifecycle.DORMANT.ordinal()) + )); + + if (environmentalAttackTarget == null || environmentalAttackType == null) { + clearPendingEnvironmentalAttack(); + } + } + + @Nullable BlockPos vibrationTarget() { + return vibrationTarget; + } + + int vibrationStrength() { + return vibrationStrength; + } + + @Nullable UUID vibrationSourcePlayer() { + return vibrationSourcePlayer; + } + + private boolean hasReachedVibrationClue() { + return vibrationTarget != null + && this.position().distanceToSqr(Vec3.atBottomCenterOf(vibrationTarget)) <= 1.44D; + } + + private void tickVibrationMemory() { + if (vibrationMemoryTicks <= 0) { + clearVibrationMemory(); + return; + } + + vibrationMemoryTicks--; + } + + private void clearVibrationMemory() { + vibrationTarget = null; + vibrationSourcePlayer = null; + vibrationMemoryTicks = 0; + vibrationStrength = 0; + excavationRoute.clear(); + } + + void tickEnvironmentalCombat(ServerLevel level) { + if (environmentalAttackCooldownTicks > 0) { + environmentalAttackCooldownTicks--; + } + + if (isPreparingEnvironmentalAttack()) { + emitEnvironmentalTelegraph(level); + environmentalAttackWindupTicks--; + + if (environmentalAttackWindupTicks == 0) { + releaseEnvironmentalAttack(level); + } + return; + } + + tryStartEnvironmentalAttack(level); + } + + boolean isPreparingEnvironmentalAttack() { + return environmentalAttackTarget != null + && environmentalAttackType != null + && environmentalAttackWindupTicks > 0; + } + + private void tryStartEnvironmentalAttack(ServerLevel level) { + if (environmentalAttackCooldownTicks > 0 || vibrationTarget == null) { + return; + } + + BlockPos attackFloor = findAttackFloor(level, vibrationTarget); + + if (attackFloor == null + || horizontalDistanceSqr(this.position(), Vec3.atBottomCenterOf(attackFloor)) + > ENVIRONMENTAL_ATTACK_RANGE * ENVIRONMENTAL_ATTACK_RANGE + || Math.abs(attackFloor.getY() - this.getY()) + > ENVIRONMENTAL_ATTACK_VERTICAL_RANGE) { + return; + } + + EnvironmentalAttackType attackType = nextEnvironmentalAttack; + if (attackType == EnvironmentalAttackType.CEILING_COLLAPSE + && !hasCollapsibleCeilingBlock(level, attackFloor)) { + attackType = EnvironmentalAttackType.LAVA_ERUPTION; + } + + environmentalAttackTarget = attackFloor.immutable(); + environmentalAttackType = attackType; + environmentalAttackWindupTicks = ENVIRONMENTAL_ATTACK_WINDUP_TICKS; + environmentalAttackCooldownTicks = ENVIRONMENTAL_ATTACK_COOLDOWN_TICKS; + nextEnvironmentalAttack = switch (attackType) { + case CEILING_COLLAPSE -> EnvironmentalAttackType.LAVA_ERUPTION; + case LAVA_ERUPTION -> EnvironmentalAttackType.FLOOR_COLLAPSE; + case FLOOR_COLLAPSE -> EnvironmentalAttackType.CEILING_COLLAPSE; + }; + emitEnvironmentalTelegraph(level); + playCombatSound( + level, + attackType == EnvironmentalAttackType.LAVA_ERUPTION + ? SoundEvents.LAVA_AMBIENT + : SoundEvents.DRIPSTONE_BLOCK_FALL, + 1.4F, + attackType == EnvironmentalAttackType.CEILING_COLLAPSE ? 0.55F : 0.8F + ); + } + + private static @Nullable BlockPos findAttackFloor(ServerLevel level, BlockPos target) { + BlockPos.MutableBlockPos candidate = target.mutable(); + + for (int offset = 0; offset <= 4; offset++) { + candidate.set(target.getX(), target.getY() - offset, target.getZ()); + if (level.getBlockState(candidate).isAir() + && !level.getBlockState(candidate.below()).isAir()) { + return candidate.immutable(); + } + } + + return null; + } + + private void emitEnvironmentalTelegraph(ServerLevel level) { + if (environmentalAttackTarget == null + || environmentalAttackType == null + || environmentalAttackWindupTicks % ENVIRONMENTAL_TELEGRAPH_INTERVAL_TICKS != 0) { + return; + } + + Vec3 target = Vec3.atBottomCenterOf(environmentalAttackTarget); + boolean collapse = environmentalAttackType == EnvironmentalAttackType.CEILING_COLLAPSE; + boolean lava = environmentalAttackType == EnvironmentalAttackType.LAVA_ERUPTION; + sendParticlesToConnectedPlayers( + level, + lava ? ParticleTypes.SMOKE : ParticleTypes.DUST_PLUME, + target.x, + target.y + (collapse ? 0.15D : 0.4D), + target.z, + collapse ? 18 : 10, + collapse ? 1.5D : 0.8D, + collapse ? 0.15D : 0.35D, + collapse ? 1.5D : 0.8D, + collapse ? 0.04D : 0.02D + ); + if (collapse) { + emitCeilingWarning(level, environmentalAttackTarget); + } + } + + private void emitCeilingWarning(ServerLevel level, BlockPos target) { + for (int[] offset : COLLAPSE_OFFSETS) { + BlockPos ceiling = findCollapsibleCeilingBlock( + level, + target, + offset[0], + offset[1] + ); + if (ceiling == null) { + continue; + } + + Vec3 warning = Vec3.atCenterOf(ceiling).add(0.0D, -0.45D, 0.0D); + sendParticlesToConnectedPlayers( + level, + ParticleTypes.DUST_PLUME, + warning.x, + warning.y, + warning.z, + 3, + 0.2D, + 0.05D, + 0.2D, + 0.01D + ); + } + } + + private void releaseEnvironmentalAttack(ServerLevel level) { + if (environmentalAttackTarget == null || environmentalAttackType == null) { + clearPendingEnvironmentalAttack(); + return; + } + + switch (environmentalAttackType) { + case CEILING_COLLAPSE -> releaseCeilingCollapse(level, environmentalAttackTarget); + case LAVA_ERUPTION -> releaseLavaEruption(level, environmentalAttackTarget); + case FLOOR_COLLAPSE -> releaseFloorCollapse(level, environmentalAttackTarget); + } + clearPendingEnvironmentalAttack(); + } + + private void releaseCeilingCollapse(ServerLevel level, BlockPos target) { + int collapsedBlocks = 0; + + for (int[] offset : COLLAPSE_OFFSETS) { + BlockPos ceiling = findCollapsibleCeilingBlock( + level, + target, + offset[0], + offset[1] + ); + if (ceiling == null) { + continue; + } + + BlockState state = level.getBlockState(ceiling); + FallingBlockEntity fallingBlock = FallingBlockEntity.fall(level, ceiling, state); + fallingBlock.setHurtsEntities(COLLAPSE_DAMAGE_PER_DISTANCE, COLLAPSE_MAX_DAMAGE); + collapsedBlocks++; + + if (collapsedBlocks >= COLLAPSE_MAX_BLOCKS) { + break; + } + } + + if (collapsedBlocks == 0) { + releaseLavaEruption(level, target); + return; + } + + Vec3 center = Vec3.atCenterOf(target); + sendParticlesToConnectedPlayers( + level, + ParticleTypes.DUST_PLUME, + center.x, + center.y, + center.z, + 55, + 1.8D, + 0.25D, + 1.8D, + 0.1D + ); + playCombatSound(level, SoundEvents.DRIPSTONE_BLOCK_FALL, 1.8F, 0.45F); + } + + private boolean hasCollapsibleCeilingBlock(ServerLevel level, BlockPos target) { + for (int[] offset : COLLAPSE_OFFSETS) { + if (findCollapsibleCeilingBlock( + level, + target, + offset[0], + offset[1] + ) != null) { + return true; + } + } + + return false; + } + + private @Nullable BlockPos findCollapsibleCeilingBlock( + ServerLevel level, + BlockPos target, + int offsetX, + int offsetZ + ) { + for (int height = COLLAPSE_MIN_HEIGHT; height <= COLLAPSE_MAX_HEIGHT; height++) { + BlockPos candidate = target.offset(offsetX, height, offsetZ); + BlockState state = level.getBlockState(candidate); + + if (!state.isAir() + && state.getFluidState().isEmpty() + && hasClearFallPath(level, target, candidate, offsetX, offsetZ) + && RetoldMobGriefing.canBreakBlock(level, this, candidate)) { + return candidate; + } + } + + return null; + } + + private static boolean hasClearFallPath( + ServerLevel level, + BlockPos target, + BlockPos ceiling, + int offsetX, + int offsetZ + ) { + BlockPos landing = target.offset(offsetX, 0, offsetZ); + + for (int y = landing.getY(); y < ceiling.getY(); y++) { + if (!level.getBlockState(new BlockPos(landing.getX(), y, landing.getZ())).isAir()) { + return false; + } + } + + return true; + } + + private void releaseLavaEruption(ServerLevel level, BlockPos target) { + // Replace the supporting layer at the locked clue, then let vanilla lava own flow and damage. + // No palette/hardness restriction: the guardian's unrestricted earth control also applies here. + BlockState lava = Blocks.LAVA.defaultBlockState(); + for (int x = -LAVA_POOL_RADIUS; x <= LAVA_POOL_RADIUS; x++) { + for (int z = -LAVA_POOL_RADIUS; z <= LAVA_POOL_RADIUS; z++) { + BlockPos ground = target.offset(x, -1, z); + if (!canEditTerrain(level, ground)) { + continue; + } + + BlockState state = level.getBlockState(ground); + if (state.isAir() || state.equals(lava) + || !RetoldMobGriefing.canBreakBlock(level, this, ground) + || !RetoldMobGriefing.canPlaceBlock(level, this, ground)) { + continue; + } + + if (level.setBlock(ground, lava, Block.UPDATE_ALL)) { + level.gameEvent(this, GameEvent.BLOCK_CHANGE, ground); + } + } + } + } + + private void releaseFloorCollapse(ServerLevel level, BlockPos target) { + // Top-down removal opens a real pit; vanilla gravity and the landing surface decide damage. + // Stop a column at denied terrain so a protected floor is not hollowed out from underneath. + for (int x = -FLOOR_COLLAPSE_RADIUS; x <= FLOOR_COLLAPSE_RADIUS; x++) { + for (int z = -FLOOR_COLLAPSE_RADIUS; z <= FLOOR_COLLAPSE_RADIUS; z++) { + for (int depth = 1; depth <= FLOOR_COLLAPSE_DEPTH; depth++) { + BlockPos ground = target.offset(x, -depth, z); + if (!canEditTerrain(level, ground)) { + break; + } + if (level.getBlockState(ground).isAir()) { + continue; + } + if (!RetoldMobGriefing.canBreakBlock(level, this, ground) + || !level.destroyBlock(ground, false, this)) { + break; + } + } + } + } + } + + private static void sendParticlesToConnectedPlayers( + ServerLevel level, + T particles, + double x, + double y, + double z, + int count, + double offsetX, + double offsetY, + double offsetZ, + double speed + ) { + for (ServerPlayer player : level.players()) { + if (player.connection != null) { + level.sendParticles( + player, + particles, + false, + false, + x, + y, + z, + count, + offsetX, + offsetY, + offsetZ, + speed + ); + } + } + } + + private void playCombatSound( + ServerLevel level, + net.minecraft.sounds.SoundEvent sound, + float volume, + float pitch + ) { + // GameTest players deliberately have no connection; normal play never suppresses this path. + if (level.players().stream().allMatch(player -> player.connection != null)) { + this.playSound(sound, volume, pitch); + } + } + + private void clearPendingEnvironmentalAttack() { + environmentalAttackTarget = null; + environmentalAttackType = null; + environmentalAttackWindupTicks = 0; + } + + private static double horizontalDistanceSqr(Vec3 first, Vec3 second) { + double deltaX = first.x - second.x; + double deltaZ = first.z - second.z; + return deltaX * deltaX + deltaZ * deltaZ; + } + + void tickTerrainControl(ServerLevel level) { + if (vibrationTarget == null + || hasReachedVibrationClue() + || isPreparingEnvironmentalAttack() + || !canOwnMovement() + || tickCount < nextTerrainEditTick) { + return; + } + + nextTerrainEditTick = tickCount + TERRAIN_EDIT_INTERVAL_TICKS; + boolean needsRoute = excavationRoute.active() || this.getNavigation().isDone(); + Direction huntDirection = horizontalDirectionToward(vibrationTarget); + int edits = 0; + while (edits < TERRAIN_EDITS_PER_PULSE) { + int reserveBefore = terrainReserve.size(); + if (needsRoute) { + excavationRoute.tick(level, vibrationTarget); + } else if (huntDirection != null) { + if (isTerrainReserveFull()) { + placeBarrierBehind(level, huntDirection); + } else { + excavateToward(level, huntDirection); + } + } + // Each primitive either stores or consumes exactly one state. No progress means + // ready, denied, unloaded, or out of material: do not repeat a failed scan 12 times. + if (terrainReserve.size() == reserveBefore) { + break; + } + edits++; + } + if (tickCount >= nextWallTick && TERRAIN_EDITS_PER_PULSE - edits >= EarthGuardianWalls.WALL_BLOCKS + && (!needsRoute || excavationRoute.destination() != null)) { + Direction wallDirection = excavationRoute.active() ? excavationRoute.direction() : huntDirection; + if (wallDirection != null) { + nextWallTick = tickCount + WALL_INTERVAL_TICKS; + EarthGuardianWalls.buildBehind(level, this, wallDirection); + } + } + } + + private boolean excavateToward(ServerLevel level, Direction direction) { + Direction side = direction.getClockWise(); + BlockPos origin = this.blockPosition(); + int[] lateralOffsets = {0, -1, 1}; + + for (int distance = 1; distance <= 3; distance++) { + for (int height = 0; height < Math.ceil(getBbHeight()); height++) { + for (int lateral : lateralOffsets) { + BlockPos candidate = origin.relative(direction, distance) + .relative(side, lateral) + .above(height); + + if (tryExcavateBlock(level, candidate)) { + return true; + } + } + } + } + + return false; + } + + boolean placeBarrierBehind(ServerLevel level, Direction huntDirection) { + Direction behind = huntDirection.getOpposite(); + Direction side = huntDirection.getClockWise(); + BlockPos origin = this.blockPosition(); + int[] lateralOffsets = {-1, 1, 0, -2, 2}; + + for (int distance = 2; distance <= 8; distance++) { + // A ramp leaves air below our new feet as well as above the old head height. + // Reuse that full trailing corridor so a full reserve does not deadlock excavation. + for (int height = -2; height <= 12; height++) { + for (int lateral : lateralOffsets) { + BlockPos candidate = origin.relative(behind, distance) + .relative(side, lateral) + .above(height); + + if (!isActiveRoutePosition(candidate) && tryPlaceReservedBlock(level, candidate)) { + return true; + } + } + } + } + + return false; + } + + boolean tryExcavateBlock(ServerLevel level, BlockPos pos) { + if (!canEditTerrain(level, pos) + || terrainReserve.size() >= TERRAIN_RESERVE_LIMIT) { + return false; + } + + BlockState state = level.getBlockState(pos); + + if (state.isAir() + || !RetoldMobGriefing.canBreakBlock(level, this, pos)) { + return false; + } + + // Vanilla destruction leaves the contained fluid behind; destroying a lava source + // therefore does nothing. Relocate the entire state, including waterlogged contents, + // so the guardian can rebuild a walking surface across its own eruption pools. + boolean removed = state.getFluidState().isEmpty() + ? level.destroyBlock(pos, false, this) + : level.setBlock(pos, Blocks.AIR.defaultBlockState(), Block.UPDATE_ALL); + if (!removed) { + return false; + } + + terrainReserve.add(state); + level.gameEvent(this, GameEvent.BLOCK_DESTROY, pos); + return true; + } + + boolean tryPlaceReservedBlock(ServerLevel level, BlockPos pos) { + if (terrainReserve.isEmpty() + || !canEditTerrain(level, pos) + || !level.getBlockState(pos).isAir() + || !level.getEntities( + (Entity) null, + new AABB(pos), + Entity::isAlive + ).isEmpty() + || !RetoldMobGriefing.canPlaceBlock(level, this, pos)) { + return false; + } + + BlockState state = terrainReserve.getLast(); + + if (!level.setBlock(pos, state, Block.UPDATE_ALL)) { + return false; + } + + terrainReserve.removeLast(); + level.gameEvent(this, GameEvent.BLOCK_PLACE, pos); + return true; + } + + int terrainReserveSize() { + return terrainReserve.size(); + } + + boolean isActiveRoutePosition(BlockPos pos) { + return excavationRoute.reserves(pos); + } + + boolean isTerrainReserveFull() { + return terrainReserve.size() >= TERRAIN_RESERVE_LIMIT; + } + + String routeDescription() { + return excavationRoute.describe(); + } + + boolean tryPlaceRouteSupport(ServerLevel level, BlockPos pos) { + for (int index = terrainReserve.size() - 1; index >= 0; index--) { + BlockState state = terrainReserve.get(index); + if (!state.isCollisionShapeFullBlock(level, pos)) { + continue; + } + // Reuse the normal loaded/protection/occupancy transaction without losing other states. + int last = terrainReserve.size() - 1; + java.util.Collections.swap(terrainReserve, index, last); + if (tryPlaceReservedBlock(level, pos)) { + return true; + } + java.util.Collections.swap(terrainReserve, index, last); + return false; + } + return false; + } + + boolean hasRouteSupport(ServerLevel level, BlockPos pos) { + return terrainReserve.stream().anyMatch(state -> state.isCollisionShapeFullBlock(level, pos)); + } + + private boolean canEditTerrain(ServerLevel level, BlockPos pos) { + return lifecycle() == EarthGuardianLifecycle.ROAMING + && level == this.level() + && level.hasChunkAt(pos); + } + + @Nullable + private Direction horizontalDirectionToward(BlockPos target) { + int deltaX = target.getX() - this.blockPosition().getX(); + int deltaZ = target.getZ() - this.blockPosition().getZ(); + + if (deltaX == 0 && deltaZ == 0) { + return null; + } + + if (Math.abs(deltaX) >= Math.abs(deltaZ)) { + return deltaX >= 0 ? Direction.EAST : Direction.WEST; + } + + return deltaZ >= 0 ? Direction.SOUTH : Direction.NORTH; + } + + + private void rememberVibration( + BlockPos position, + Holder event, + @Nullable ServerPlayer player, + float distance + ) { + if (lifecycle() != EarthGuardianLifecycle.ROAMING) { + return; + } + + int score = Math.max(1, vibrationWeight(event) - (int) distance); + boolean sameSource = player != null + && player.getUUID().equals(vibrationSourcePlayer); + + if (vibrationTarget != null && !sameSource && score < vibrationStrength) { + return; + } + + vibrationTarget = position.immutable(); + vibrationSourcePlayer = player == null ? null : player.getUUID(); + vibrationMemoryTicks = VIBRATION_MEMORY_TICKS; + vibrationStrength = score; + } + + private static int vibrationWeight(Holder event) { + if (event.is(GameEvent.ENTITY_DAMAGE)) { + return 100; + } + if (event.is(GameEvent.EXPLODE) + || event.is(GameEvent.PROJECTILE_SHOOT) + || event.is(GameEvent.PROJECTILE_LAND)) { + return 85; + } + if (event.is(GameEvent.BLOCK_DESTROY) + || event.is(GameEvent.BLOCK_PLACE) + || event.is(GameEvent.BLOCK_CHANGE)) { + return 70; + } + if (event.is(GameEvent.CONTAINER_OPEN) + || event.is(GameEvent.CONTAINER_CLOSE) + || event.is(GameEvent.BLOCK_ACTIVATE) + || event.is(GameEvent.BLOCK_DEACTIVATE)) { + return 60; + } + if (event.is(GameEvent.HIT_GROUND)) { + return 55; + } + if (event.is(GameEvent.STEP) || event.is(GameEvent.SWIM)) { + return 25; + } + return 40; + } + + boolean canOwnMovement() { + return RetoldAiControl.isControlledBy(this, RetoldAiControlOwner.EARTH_GUARDIAN) + || RetoldAiControl.getPriority(this) <= RetoldAiPriorities.HUNT; + } + + private boolean claimMovement(RetoldAiControlMode mode, String reason) { + return RetoldAiControl.tryClaim( + this, + mode, + RetoldAiControlOwner.EARTH_GUARDIAN, + RetoldAiPriorities.HUNT, + reason, + this.level().getGameTime(), + INVESTIGATION_CONTROL_TICKS + ); + } + + private void releaseMovement() { + this.getNavigation().stop(); + RetoldAiControl.clearIfOwnedBy(this, RetoldAiControlOwner.EARTH_GUARDIAN); + } + + private boolean isValidVibrationPlayer(Player player) { + return player.level() == this.level() + && EntitySelector.NO_CREATIVE_OR_SPECTATOR.test(player) + && player.isAlive(); + } + + @Nullable + private ServerPlayer vibrationPlayer(@Nullable Entity source) { + Entity candidate = source instanceof TraceableEntity traceableEntity + ? traceableEntity.getOwner() + : source; + return candidate instanceof ServerPlayer player && isValidVibrationPlayer(player) + ? player + : null; + } + + private static BoundingBox copyBounds(BoundingBox bounds) { + return new BoundingBox( + bounds.minX(), + bounds.minY(), + bounds.minZ(), + bounds.maxX(), + bounds.maxY(), + bounds.maxZ() + ); + } + + @Nullable + private static UUID parseUuid(String value) { + try { + return value.isEmpty() ? null : UUID.fromString(value); + } catch (IllegalArgumentException ignored) { + return null; + } + } + + private enum EnvironmentalAttackType { + CEILING_COLLAPSE, + LAVA_ERUPTION, + FLOOR_COLLAPSE; + + private static @Nullable EnvironmentalAttackType bySerializedId(int id) { + return id >= 0 && id < values().length ? values()[id] : null; + } + } + + private final class GuardianVibrationUser implements VibrationSystem.User { + private final PositionSource positionSource = new EntityPositionSource( + EarthGuardian.this, + EarthGuardian.this.getEyeHeight() + ); + + @Override + public int getListenerRadius() { + return VIBRATION_LISTENER_RADIUS; + } + + @Override + public PositionSource getPositionSource() { + return positionSource; + } + + @Override + public net.minecraft.tags.TagKey getListenableEvents() { + return GameEventTags.WARDEN_CAN_LISTEN; + } + + @Override + public boolean canTriggerAvoidVibration() { + return true; + } + + @Override + public boolean canReceiveVibration( + ServerLevel level, + BlockPos position, + Holder event, + GameEvent.Context context + ) { + return lifecycle() == EarthGuardianLifecycle.ROAMING + && !isDeadOrDying() + && vibrationPlayer(context.sourceEntity()) != null; + } + + @Override + public void onReceiveVibration( + ServerLevel level, + BlockPos position, + Holder event, + @Nullable Entity source, + @Nullable Entity projectileOwner, + float distance + ) { + ServerPlayer player = vibrationPlayer( + projectileOwner == null ? source : projectileOwner + ); + + if (player != null) { + rememberVibration(position, event, player, distance); + } + } + } + + private static final class InvestigateVibrationGoal extends Goal { + private final EarthGuardian guardian; + private int nextPathTick; + + private InvestigateVibrationGoal(EarthGuardian guardian) { + this.guardian = guardian; + this.setFlags(EnumSet.of(Flag.MOVE)); + } + + @Override + public boolean canUse() { + return guardian.lifecycle() == EarthGuardianLifecycle.ROAMING + && guardian.vibrationTarget != null + && guardian.canOwnMovement(); + } + + @Override + public boolean canContinueToUse() { + return canUse() && guardian.vibrationMemoryTicks > 0; + } + + @Override + public void start() { + nextPathTick = 0; + followClue(); + } + + @Override + public boolean requiresUpdateEveryTick() { + return true; + } + + @Override + public void tick() { + if (!guardian.claimMovement(RetoldAiControlMode.HUNT, "earth_vibration")) { + return; + } + + BlockPos target = guardian.vibrationTarget; + + if (target == null) { + return; + } + + if (guardian.hasReachedVibrationClue()) { + // Keep the clue for contact combat until its normal expiry or a new sound. + guardian.getNavigation().stop(); + return; + } + + // A failed or finished route must still respect the retry interval. + if (guardian.tickCount >= nextPathTick) { + followClue(); + } + } + + @Override + public void stop() { + nextPathTick = 0; + guardian.releaseMovement(); + } + + private void followClue() { + BlockPos target = guardian.vibrationTarget; + + if (target == null + || !guardian.claimMovement(RetoldAiControlMode.HUNT, "earth_vibration")) { + return; + } + + if (guardian.excavationRoute.active()) { + target = guardian.excavationRoute.destination(); + if (target == null) { + guardian.getNavigation().stop(); + nextPathTick = guardian.tickCount + 20; + return; + } + } + + RetoldBehaviorMovement.throttledMoveToExact( + guardian, + target, + INVESTIGATION_SPEED, + guardian.level().getGameTime(), + 20, + 1.0D + ); + nextPathTick = guardian.tickCount + 20; + } + } + + private static final class MazePatrolGoal extends Goal { + private final EarthGuardian guardian; + private Path path; + private int nextAttemptTick; + + private MazePatrolGoal(EarthGuardian guardian) { + this.guardian = guardian; + this.setFlags(EnumSet.of(Flag.MOVE)); + } + + @Override + public boolean canUse() { + if (guardian.lifecycle() != EarthGuardianLifecycle.ROAMING + || guardian.vibrationTarget != null + || guardian.isPreparingEnvironmentalAttack() + || guardian.tickCount < nextAttemptTick + || !guardian.canOwnMovement()) { + return false; + } + + path = findPatrolPath(); + + if (path == null) { + nextAttemptTick = guardian.tickCount + PATROL_RETRY_TICKS; + return false; + } + + return true; + } + + @Override + public boolean canContinueToUse() { + return guardian.lifecycle() == EarthGuardianLifecycle.ROAMING + && guardian.vibrationTarget == null + && !guardian.isPreparingEnvironmentalAttack() + && path != null + && !guardian.getNavigation().isDone(); + } + + @Override + public void start() { + if (guardian.claimMovement(RetoldAiControlMode.SEARCH, "earth_patrol")) { + RetoldAiControl.withNavigationBypass( + () -> guardian.getNavigation().moveTo(path, PATROL_SPEED) + ); + } + } + + @Override + public void tick() { + guardian.claimMovement(RetoldAiControlMode.SEARCH, "earth_patrol"); + } + + @Override + public void stop() { + path = null; + nextAttemptTick = guardian.tickCount + PATROL_RETRY_TICKS; + guardian.releaseMovement(); + } + + @Nullable + private Path findPatrolPath() { + BoundingBox bounds = guardian.labyrinthBounds; + int minX = bounds == null ? guardian.blockPosition().getX() - 24 : bounds.minX() + 2; + int maxX = bounds == null ? guardian.blockPosition().getX() + 24 : bounds.maxX() - 2; + int minZ = bounds == null ? guardian.blockPosition().getZ() - 24 : bounds.minZ() + 2; + int maxZ = bounds == null ? guardian.blockPosition().getZ() + 24 : bounds.maxZ() - 2; + + for (int attempt = 0; attempt < 4; attempt++) { + BlockPos candidate = new BlockPos( + guardian.getRandom().nextIntBetweenInclusive(minX, maxX), + guardian.blockPosition().getY(), + guardian.getRandom().nextIntBetweenInclusive(minZ, maxZ) + ); + Path candidatePath = guardian.getNavigation().createPath(candidate, 2); + + if (candidatePath != null && candidatePath.canReach()) { + return candidatePath; + } + } + + return null; + } + } +} diff --git a/src/main/java/cz/xefensor/retold/worldgen/earth/EarthGuardianEncounterData.java b/src/main/java/cz/xefensor/retold/worldgen/earth/EarthGuardianEncounterData.java new file mode 100644 index 00000000..a9b016a0 --- /dev/null +++ b/src/main/java/cz/xefensor/retold/worldgen/earth/EarthGuardianEncounterData.java @@ -0,0 +1,67 @@ +package cz.xefensor.retold.worldgen.earth; + +import com.mojang.serialization.Codec; +import cz.xefensor.retold.Retold; +import net.minecraft.resources.Identifier; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.level.saveddata.SavedData; +import net.minecraft.world.level.saveddata.SavedDataType; + +import java.util.HashMap; +import java.util.Map; + +public final class EarthGuardianEncounterData extends SavedData { + public static final SavedDataType TYPE = + new SavedDataType<>( + Identifier.fromNamespaceAndPath(Retold.MODID, "earth_guardian_encounters"), + EarthGuardianEncounterData::new, + Codec.unboundedMap(Codec.STRING, Codec.INT) + .xmap( + EarthGuardianEncounterData::new, + EarthGuardianEncounterData::encodeLifecycles + ) + ); + + private final Map lifecycles = new HashMap<>(); + + public EarthGuardianEncounterData() { + } + + private EarthGuardianEncounterData(Map encoded) { + encoded.forEach((key, lifecycleId) -> { + try { + lifecycles.put( + Long.parseLong(key), + EarthGuardianLifecycle.bySerializedId(lifecycleId) + ); + } catch (NumberFormatException ignored) { + // Ignore a single malformed encounter key while retaining every valid entry. + } + }); + } + + public static EarthGuardianEncounterData get(ServerLevel level) { + return level.getServer().getDataStorage().computeIfAbsent(TYPE); + } + + public EarthGuardianLifecycle lifecycle(long labyrinthKey) { + return lifecycles.getOrDefault(labyrinthKey, EarthGuardianLifecycle.DORMANT); + } + + public void setLifecycle(long labyrinthKey, EarthGuardianLifecycle lifecycle) { + EarthGuardianLifecycle previous = lifecycles.put(labyrinthKey, lifecycle); + + if (previous != lifecycle) { + setDirty(); + } + } + + private Map encodeLifecycles() { + Map encoded = new HashMap<>(); + lifecycles.forEach((key, lifecycle) -> encoded.put( + Long.toString(key), + lifecycle.ordinal() + )); + return encoded; + } +} diff --git a/src/main/java/cz/xefensor/retold/worldgen/earth/EarthGuardianEvents.java b/src/main/java/cz/xefensor/retold/worldgen/earth/EarthGuardianEvents.java new file mode 100644 index 00000000..fd32110d --- /dev/null +++ b/src/main/java/cz/xefensor/retold/worldgen/earth/EarthGuardianEvents.java @@ -0,0 +1,88 @@ +package cz.xefensor.retold.worldgen.earth; + +import net.minecraft.core.registries.Registries; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.level.ChunkPos; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.levelgen.structure.BuiltinStructures; +import net.minecraft.world.level.levelgen.structure.Structure; +import net.minecraft.world.level.levelgen.structure.StructurePiece; +import net.minecraft.world.level.levelgen.structure.StructureStart; +import net.neoforged.bus.api.SubscribeEvent; +import net.neoforged.neoforge.event.tick.ServerTickEvent; + +import java.util.HashMap; +import java.util.Map; + +public final class EarthGuardianEvents { + private static final int SOURCE_SCAN_INTERVAL_TICKS = 40; + private static final int SOURCE_SCAN_CHUNK_RADIUS = 4; + + private EarthGuardianEvents() { + } + + @SubscribeEvent + public static void onServerTickPost(ServerTickEvent.Post event) { + ServerLevel overworld = event.getServer().getLevel(Level.OVERWORLD); + + if (overworld == null + || overworld.getGameTime() % SOURCE_SCAN_INTERVAL_TICKS != 0L) { + return; + } + + Structure junglePyramid = overworld.registryAccess() + .lookupOrThrow(Registries.STRUCTURE) + .getValue(BuiltinStructures.JUNGLE_TEMPLE); + + if (junglePyramid == null) { + return; + } + + Map sources = new HashMap<>(); + + for (ServerPlayer player : overworld.players()) { + if (player.isSpectator()) { + continue; + } + + collectLoadedSources(overworld, junglePyramid, player.chunkPosition(), sources); + } + + sources.values().forEach(source -> EarthGuardianSpawner.spawnIfNeeded(overworld, source)); + } + + private static void collectLoadedSources( + ServerLevel level, + Structure junglePyramid, + ChunkPos playerChunk, + Map sources + ) { + for (int dx = -SOURCE_SCAN_CHUNK_RADIUS; dx <= SOURCE_SCAN_CHUNK_RADIUS; dx++) { + for (int dz = -SOURCE_SCAN_CHUNK_RADIUS; dz <= SOURCE_SCAN_CHUNK_RADIUS; dz++) { + int chunkX = playerChunk.x() + dx; + int chunkZ = playerChunk.z() + dz; + + if (!level.hasChunk(chunkX, chunkZ)) { + continue; + } + + for (StructureStart start : level.structureManager().startsForStructure( + new ChunkPos(chunkX, chunkZ), + structure -> structure == junglePyramid + )) { + if (!start.isValid()) { + continue; + } + + for (StructurePiece piece : start.getPieces()) { + if (piece instanceof EarthLabyrinthPiece labyrinth) { + EarthLabyrinthSource source = labyrinth.guardianSource(); + sources.put(source.key(), source); + } + } + } + } + } + } +} diff --git a/src/main/java/cz/xefensor/retold/worldgen/earth/EarthGuardianLifecycle.java b/src/main/java/cz/xefensor/retold/worldgen/earth/EarthGuardianLifecycle.java new file mode 100644 index 00000000..4c8a9169 --- /dev/null +++ b/src/main/java/cz/xefensor/retold/worldgen/earth/EarthGuardianLifecycle.java @@ -0,0 +1,13 @@ +package cz.xefensor.retold.worldgen.earth; + +public enum EarthGuardianLifecycle { + DORMANT, + AWAKENING, + ROAMING, + DEFEATED; + + static EarthGuardianLifecycle bySerializedId(int id) { + EarthGuardianLifecycle[] values = values(); + return id >= 0 && id < values.length ? values[id] : DORMANT; + } +} diff --git a/src/main/java/cz/xefensor/retold/worldgen/earth/EarthGuardianMelee.java b/src/main/java/cz/xefensor/retold/worldgen/earth/EarthGuardianMelee.java new file mode 100644 index 00000000..b0a94fea --- /dev/null +++ b/src/main/java/cz/xefensor/retold/worldgen/earth/EarthGuardianMelee.java @@ -0,0 +1,69 @@ +package cz.xefensor.retold.worldgen.earth; + +import cz.xefensor.retold.behavior.performance.RetoldAiWorkBudget; +import cz.xefensor.retold.behavior.performance.RetoldBehaviorPerf; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntitySelector; +import net.minecraft.world.level.storage.ValueInput; +import net.minecraft.world.level.storage.ValueOutput; + +/** Contact combat with the heard player, without acquiring a live navigation target. */ +final class EarthGuardianMelee { + private static final int COOLDOWN_TICKS = 30; + private static final int CONTACT_CHECK_INTERVAL = 5; + private final EarthGuardian guardian; + private int cooldown; + + EarthGuardianMelee(EarthGuardian guardian) { + this.guardian = guardian; + } + + void tick(ServerLevel level) { + if (cooldown > 0) { + cooldown--; + } + if (cooldown > 0 || guardian.tickCount % CONTACT_CHECK_INTERVAL != 0 + || guardian.vibrationSourcePlayer() == null) { + return; + } + var player = level.getEntity(guardian.vibrationSourcePlayer()); + if (player instanceof ServerPlayer) { + guardian.doHurtTarget(level, player); + } + } + + boolean canAttack(ServerLevel level, Entity target) { + if (cooldown > 0 || level != guardian.level() || !guardian.isAlive() + || !guardian.canOwnMovement() + || guardian.lifecycle() != EarthGuardianLifecycle.ROAMING + || guardian.vibrationTarget() == null + || !(target instanceof ServerPlayer player) + || player.level() != level || !player.isAlive() + || !EntitySelector.NO_CREATIVE_OR_SPECTATOR.test(player) + || !player.getUUID().equals(guardian.vibrationSourcePlayer()) + || !guardian.isWithinMeleeAttackRange(player)) { + return false; + } + // A cached clear view can outlive a newly placed wall. Contact strikes need a fresh, + // budgeted obstruction check, used only after the cheap source/range/cooldown guards. + if (!RetoldAiWorkBudget.tryUseSightRaycast(level.getGameTime())) { + return false; + } + RetoldBehaviorPerf.recordSightCache(false); + return guardian.hasLineOfSight(player); + } + + void recordAttack() { + cooldown = COOLDOWN_TICKS; + } + + void save(ValueOutput output) { + output.putInt("retold_melee_cooldown", cooldown); + } + + void load(ValueInput input) { + cooldown = Math.clamp(input.getIntOr("retold_melee_cooldown", 0), 0, COOLDOWN_TICKS); + } +} diff --git a/src/main/java/cz/xefensor/retold/worldgen/earth/EarthGuardianRoute.java b/src/main/java/cz/xefensor/retold/worldgen/earth/EarthGuardianRoute.java new file mode 100644 index 00000000..517066b2 --- /dev/null +++ b/src/main/java/cz/xefensor/retold/worldgen/earth/EarthGuardianRoute.java @@ -0,0 +1,232 @@ +package cz.xefensor.retold.worldgen.earth; + +import cz.xefensor.retold.behavior.core.RetoldBehaviorMovement; +import cz.xefensor.retold.behavior.core.RetoldMobGriefing; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.storage.ValueInput; +import net.minecraft.world.level.storage.ValueOutput; +import net.minecraft.world.phys.Vec3; +import net.minecraft.world.phys.AABB; +import org.jspecify.annotations.Nullable; + +/** Short, loaded-only walking corridors. The controller batches these one-edit steps. */ +final class EarthGuardianRoute { + private final EarthGuardian guardian; + private @Nullable BlockPos start; + private @Nullable BlockPos clue; + private @Nullable Direction rampDirection; + private Direction direction = Direction.NORTH; + private int rampTargetY; + private int rise; + private boolean ready; + private @Nullable BlockPos blockedAt; + private boolean backfilled; + private int removed; + + EarthGuardianRoute(EarthGuardian guardian) { + this.guardian = guardian; + } + + boolean active() { + return start != null; + } + + Direction direction() { + return direction; + } + + boolean reserves(BlockPos pos) { + if (start == null) { + return false; + } + Direction side = direction.getClockWise(); + int dx = pos.getX() - start.getX(); + int dz = pos.getZ() - start.getZ(); + int distance = dx * direction.getStepX() + dz * direction.getStepZ(); + int width = dx * side.getStepX() + dz * side.getStepZ(); + if (distance < 0 || distance > 4 || Math.abs(width) > 1) { + return false; + } + int feetY = strip(start, direction, rise, distance).getY(); + int clearance = (int) Math.ceil(guardian.getBbHeight()) + (rise == 0 ? 0 : 1); + return pos.getY() >= feetY - 1 && pos.getY() < feetY + clearance; + } + + @Nullable BlockPos destination() { + return start != null && ready ? strip(start, direction, rise, 3) : null; + } + + void clear() { + start = null; + clue = null; + rampDirection = null; + ready = false; + } + + void tick(ServerLevel level, BlockPos target) { + // Footsteps move the remembered clue while this short segment is being built/walked. + // Finish the committed landing before steering toward the latest clue; restarting on + // each step repeatedly stops navigation at the same tunnel entrance. + clue = target.immutable(); + if (start != null && ready) { + BlockPos end = strip(start, direction, rise, 3); + Vec3 center = Vec3.atBottomCenterOf(end); + if (guardian.position().distanceToSqr(center) > 0.8D + || Math.abs(guardian.getY() - end.getY()) > 0.3D) { + if (!guardian.getNavigation().isDone()) { + return; + } + // Player edits and environmental attacks can invalidate a prepared segment. + ready = false; + } else { + start = null; + } + } + if (start == null) { + // Large-mob path nodes end on integer centers. Using floor(position) would shift + // the corridor sideways by one block after every segment instead of following it. + start = BlockPos.containing(guardian.getX() - 0.5D, guardian.getY(), guardian.getZ() - 0.5D); + rise = Integer.compare(target.getY(), start.getY()); + if (rise == 0) { + rampDirection = null; + } else if (rampDirection == null || rampTargetY != target.getY()) { + rampDirection = toward(start, target); + rampTargetY = target.getY(); + } + // Keep a ramp's heading until it reaches the clue's level; turning back each step + // toward a clue directly overhead would excavate the ramp we are standing on. + direction = rampDirection == null ? toward(start, target) : rampDirection; + // Only align sideways. Along the travel axis the next raised support must remain + // ahead of the entire body, otherwise occupancy protection correctly refuses it. + BlockPos occupied = guardian.blockPosition(); + start = direction.getAxis() == Direction.Axis.X + ? new BlockPos(occupied.getX(), start.getY(), start.getZ()) + : new BlockPos(start.getX(), start.getY(), occupied.getZ()); + ready = false; + guardian.getNavigation().stop(); + } + int clearance = (int) Math.ceil(guardian.getBbHeight()) + (rise == 0 ? 0 : 1); + Direction side = direction.getClockWise(); + // Aim beyond the first lower step: navigation may stop up to half a body-width short, + // which would otherwise leave this wide mob supported by the upper ledge forever. + for (int distance = 0; distance <= 4; distance++) { + BlockPos feet = strip(start, direction, rise, distance); + for (int height = 0; height < clearance; height++) { + for (int width = -1; width <= 1; width++) { + BlockPos pos = feet.relative(side, width).above(height); + if (!available(level, pos)) { + return; + } + if (!level.getBlockState(pos).isAir()) { + blockedAt = pos; + if (guardian.tryExcavateBlock(level, pos)) { + removed++; + RetoldBehaviorMovement.clearGroundPathState(guardian); + } else if (guardian.isTerrainReserveFull()) { + backfilled = guardian.placeBarrierBehind(level, direction); + } + return; + } + } + } + } + for (int distance = 0; distance <= 4; distance++) { + BlockPos feet = strip(start, direction, rise, distance); + for (int width = -1; width <= 1; width++) { + BlockPos support = feet.relative(side, width).below(); + if (!available(level, support)) { + return; + } + BlockState state = level.getBlockState(support); + if (state.isCollisionShapeFullBlock(level, support)) { + continue; + } + blockedAt = support; + if (state.isAir() && new AABB(support).intersects(guardian.getBoundingBox())) { + // Stopping navigation does not remove momentum. If the body drifted into + // the next raised support while we worked, move the next stair ahead of + // its current feet instead of repeatedly attempting an occupied placement. + start = null; + ready = false; + guardian.getNavigation().stop(); + return; + } + if (!state.isAir()) { + if (!guardian.tryExcavateBlock(level, support) && guardian.isTerrainReserveFull()) { + guardian.placeBarrierBehind(level, direction); + } + } else if (RetoldMobGriefing.canPlaceBlock(level, guardian, support)) { + if (guardian.hasRouteSupport(level, support)) { + guardian.tryPlaceRouteSupport(level, support); + } else { + gatherSupport(level, side); + } + } + return; + } + } + ready = true; + RetoldBehaviorMovement.clearGroundPathState(guardian); + } + + private void gatherSupport(ServerLevel level, Direction side) { + if (guardian.isTerrainReserveFull()) { + guardian.placeBarrierBehind(level, direction); + return; + } + // Donors are outside the three-wide route, never its own floor. No material is created. + for (int distance = 0; distance <= 3; distance++) { + for (int width : new int[]{-2, 2}) { + BlockPos donor = start.relative(direction, distance).relative(side, width).below(); + if (available(level, donor) && level.getBlockState(donor).isCollisionShapeFullBlock(level, donor) + && guardian.tryExcavateBlock(level, donor)) { + return; + } + } + } + } + + private static boolean available(ServerLevel level, BlockPos pos) { + return !level.isOutsideBuildHeight(pos) && level.hasChunkAt(pos); + } + + String describe() { + return "start=" + start + ", direction=" + direction + ", rise=" + rise + + ", ready=" + ready + ", blockedAt=" + blockedAt + + ", blockedState=" + (blockedAt == null ? null : guardian.level().getBlockState(blockedAt)) + + ", backfilled=" + backfilled + ", removed=" + removed + ", clue=" + clue; + } + + static BlockPos strip(BlockPos start, Direction direction, int rise, int distance) { + return start.relative(direction, distance).above(distance < 2 ? 0 : rise); + } + + private static Direction toward(BlockPos start, BlockPos target) { + int dx = target.getX() - start.getX(); + int dz = target.getZ() - start.getZ(); + if (dx == 0 && dz == 0) { + return Direction.NORTH; + } + return Math.abs(dx) >= Math.abs(dz) ? (dx >= 0 ? Direction.EAST : Direction.WEST) + : (dz >= 0 ? Direction.SOUTH : Direction.NORTH); + } + + void save(ValueOutput output) { + if (rampDirection != null) { + output.putInt("retold_ramp_direction", rampDirection.get2DDataValue()); + output.putInt("retold_ramp_target_y", rampTargetY); + } + } + + void load(ValueInput input) { + clear(); + int savedDirection = input.getIntOr("retold_ramp_direction", -1); + if (savedDirection >= 0 && savedDirection < 4) { + rampDirection = Direction.from2DDataValue(savedDirection); + rampTargetY = input.getIntOr("retold_ramp_target_y", guardian.blockPosition().getY()); + } + } +} diff --git a/src/main/java/cz/xefensor/retold/worldgen/earth/EarthGuardianSpawner.java b/src/main/java/cz/xefensor/retold/worldgen/earth/EarthGuardianSpawner.java new file mode 100644 index 00000000..f8d64246 --- /dev/null +++ b/src/main/java/cz/xefensor/retold/worldgen/earth/EarthGuardianSpawner.java @@ -0,0 +1,72 @@ +package cz.xefensor.retold.worldgen.earth; + +import cz.xefensor.retold.registry.RetoldEntityTypes; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntitySpawnReason; + +import java.util.Comparator; +import java.util.List; + +final class EarthGuardianSpawner { + private EarthGuardianSpawner() { + } + + static boolean spawnIfNeeded(ServerLevel level, EarthLabyrinthSource source) { + EarthGuardianEncounterData data = EarthGuardianEncounterData.get(level); + EarthGuardianLifecycle lifecycle = data.lifecycle(source.key()); + List existing = level.getEntities( + (Entity) null, + source.duplicateSearchBounds(), + entity -> entity instanceof EarthGuardian guardian + && guardian.isStructureBound() + && guardian.labyrinthKey() == source.key() + ).stream() + .map(EarthGuardian.class::cast) + .sorted(Comparator.comparingDouble(guardian -> guardian.distanceToSqr( + source.guardianPosition().getX() + 0.5D, + source.guardianPosition().getY(), + source.guardianPosition().getZ() + 0.5D + ))) + .toList(); + + if (lifecycle == EarthGuardianLifecycle.DEFEATED) { + existing.forEach(Entity::discard); + return true; + } + + if (!existing.isEmpty()) { + EarthGuardian keeper = existing.getFirst(); + keeper.configureForLabyrinth(level, source, lifecycle); + + for (int index = 1; index < existing.size(); index++) { + existing.get(index).discard(); + } + + return true; + } + + if (!level.hasChunkAt(source.guardianPosition())) { + return false; + } + + EarthGuardian guardian = RetoldEntityTypes.EARTH_GUARDIAN.get().create( + level, + EntitySpawnReason.STRUCTURE + ); + + if (guardian == null) { + return false; + } + + guardian.configureForLabyrinth(level, source, lifecycle); + guardian.finalizeSpawn( + level, + level.getCurrentDifficultyAt(source.guardianPosition()), + EntitySpawnReason.STRUCTURE, + null + ); + level.addFreshEntityWithPassengers(guardian); + return true; + } +} diff --git a/src/main/java/cz/xefensor/retold/worldgen/earth/EarthGuardianWalls.java b/src/main/java/cz/xefensor/retold/worldgen/earth/EarthGuardianWalls.java new file mode 100644 index 00000000..3b36a8eb --- /dev/null +++ b/src/main/java/cz/xefensor/retold/worldgen/earth/EarthGuardianWalls.java @@ -0,0 +1,55 @@ +package cz.xefensor.retold.worldgen.earth; + +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.server.level.ServerLevel; + +/** Small, supported trailing walls made only from conserved full-block material. */ +final class EarthGuardianWalls { + static final int WALL_BLOCKS = 9; + private static final int MINIMUM_RESERVE = 18; + + private EarthGuardianWalls() { + } + + static int buildBehind(ServerLevel level, EarthGuardian guardian, Direction travel) { + if (guardian.terrainReserveSize() < MINIMUM_RESERVE) { + return 0; + } + Direction side = travel.getClockWise(); + BlockPos origin = guardian.blockPosition(); + for (int distance = 3; distance <= 6; distance++) { + for (int height = -2; height <= 2; height++) { + BlockPos base = origin.relative(travel.getOpposite(), distance).above(height); + if (!hasSupportedBase(level, base, side)) { + continue; + } + int placed = 0; + for (int y = 0; y < 3; y++) { + for (int width = -1; width <= 1; width++) { + BlockPos pos = base.relative(side, width).above(y); + if (!guardian.isActiveRoutePosition(pos) && guardian.tryPlaceRouteSupport(level, pos)) { + placed++; + } + } + } + if (placed > 0) { + return placed; + } + } + } + return 0; + } + + private static boolean hasSupportedBase(ServerLevel level, BlockPos base, Direction side) { + for (int width = -1; width <= 1; width++) { + BlockPos foot = base.relative(side, width); + if (!level.hasChunkAt(foot) || level.isOutsideBuildHeight(foot.below()) + || level.isOutsideBuildHeight(foot.above(2)) + || !level.getBlockState(foot.below()).isCollisionShapeFullBlock(level, foot.below())) { + return false; + } + } + return true; + } +} diff --git a/src/main/java/cz/xefensor/retold/worldgen/earth/EarthJungleTemplePiece.java b/src/main/java/cz/xefensor/retold/worldgen/earth/EarthJungleTemplePiece.java new file mode 100644 index 00000000..2a6411d8 --- /dev/null +++ b/src/main/java/cz/xefensor/retold/worldgen/earth/EarthJungleTemplePiece.java @@ -0,0 +1,55 @@ +package cz.xefensor.retold.worldgen.earth; + +import cz.xefensor.retold.worldgen.RetoldWorldgenRegistries; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.util.RandomSource; +import net.minecraft.world.level.levelgen.structure.structures.JungleTemplePiece; +import net.minecraft.world.level.levelgen.structure.pieces.StructurePieceType; + +/** Vanilla Jungle Temple generation with a fixed precomputed ground height and Retold piece id. */ +public final class EarthJungleTemplePiece extends JungleTemplePiece { + EarthJungleTemplePiece(RandomSource random, int west, int north) { + super(random, west, north); + } + + public EarthJungleTemplePiece(CompoundTag tag) { + super(tag); + } + + void moveToGround(int groundY) { + this.boundingBox = this.boundingBox.moved(0, groundY - this.boundingBox.minY(), 0); + this.heightPosition = groundY; + } + + BlockPos labyrinthConnectionPosition() { + return this.getWorldPos( + EarthLabyrinthDimensions.CONNECTION_LOCAL_X, + EarthLabyrinthDimensions.CONNECTION_LOCAL_Y, + EarthLabyrinthDimensions.CONNECTION_LOCAL_Z + ).immutable(); + } + + Direction labyrinthEgressDirection() { + BlockPos connection = labyrinthConnectionPosition(); + BlockPos next = this.getWorldPos( + EarthLabyrinthDimensions.CONNECTION_LOCAL_X + 1, + EarthLabyrinthDimensions.CONNECTION_LOCAL_Y, + EarthLabyrinthDimensions.CONNECTION_LOCAL_Z + ); + int deltaX = next.getX() - connection.getX(); + int deltaZ = next.getZ() - connection.getZ(); + + if (deltaX != 0) { + return deltaX > 0 ? Direction.EAST : Direction.WEST; + } + + return deltaZ > 0 ? Direction.SOUTH : Direction.NORTH; + } + + @Override + public StructurePieceType getType() { + return RetoldWorldgenRegistries.EARTH_JUNGLE_TEMPLE_PIECE.get(); + } +} diff --git a/src/main/java/cz/xefensor/retold/worldgen/earth/EarthJungleTempleStructure.java b/src/main/java/cz/xefensor/retold/worldgen/earth/EarthJungleTempleStructure.java new file mode 100644 index 00000000..70e58159 --- /dev/null +++ b/src/main/java/cz/xefensor/retold/worldgen/earth/EarthJungleTempleStructure.java @@ -0,0 +1,103 @@ +package cz.xefensor.retold.worldgen.earth; + +import com.mojang.serialization.MapCodec; +import cz.xefensor.retold.worldgen.RetoldWorldgenRegistries; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.ChunkPos; +import net.minecraft.world.level.levelgen.Heightmap; +import net.minecraft.world.level.levelgen.structure.BoundingBox; +import net.minecraft.world.level.levelgen.structure.Structure; +import net.minecraft.world.level.levelgen.structure.StructureType; +import net.minecraft.world.level.levelgen.structure.pieces.StructurePiecesBuilder; + +import java.util.Optional; + +/** + * Composite replacement for newly generated Jungle Pyramids. The registry id remains + * {@code minecraft:jungle_pyramid}, so existing saved starts retain their vanilla pieces. + */ +public final class EarthJungleTempleStructure extends Structure { + public static final MapCodec CODEC = + simpleCodec(EarthJungleTempleStructure::new); + + public EarthJungleTempleStructure(StructureSettings settings) { + super(settings); + } + + @Override + protected Optional findGenerationPoint(GenerationContext context) { + if (getLowestY( + context, + EarthLabyrinthDimensions.PYRAMID_WIDTH, + EarthLabyrinthDimensions.PYRAMID_DEPTH + ) < context.chunkGenerator().getSeaLevel()) { + return Optional.empty(); + } + + return onTopOfChunkCenter( + context, + Heightmap.Types.WORLD_SURFACE_WG, + builder -> generatePieces(builder, context) + ); + } + + private static void generatePieces( + StructurePiecesBuilder builder, + GenerationContext context + ) { + ChunkPos chunkPos = context.chunkPos(); + EarthJungleTemplePiece temple = new EarthJungleTemplePiece( + context.random(), + chunkPos.getMinBlockX(), + chunkPos.getMinBlockZ() + ); + int pyramidBaseY = averageGroundHeight(context, temple.getBoundingBox()); + temple.moveToGround(pyramidBaseY); + + long layoutSeed = EarthLabyrinthPlanner.seedForPyramid( + context.seed(), + chunkPos.x(), + chunkPos.z() + ); + BlockPos connection = temple.labyrinthConnectionPosition(); + var egressDirection = temple.labyrinthEgressDirection(); + + builder.addPiece(temple); + builder.addPiece(new EarthLabyrinthPiece( + temple.getBoundingBox().getCenter().getX(), + temple.getBoundingBox().getCenter().getZ(), + pyramidBaseY, + connection, + egressDirection, + layoutSeed + )); + } + + private static int averageGroundHeight( + GenerationContext context, + BoundingBox pyramidBounds + ) { + long total = 0L; + int count = 0; + + for (int z = pyramidBounds.minZ(); z <= pyramidBounds.maxZ(); z++) { + for (int x = pyramidBounds.minX(); x <= pyramidBounds.maxX(); x++) { + total += context.chunkGenerator().getFirstOccupiedHeight( + x, + z, + Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, + context.heightAccessor(), + context.randomState() + ); + count++; + } + } + + return Math.toIntExact(total / count); + } + + @Override + public StructureType type() { + return RetoldWorldgenRegistries.EARTH_JUNGLE_TEMPLE_STRUCTURE.get(); + } +} diff --git a/src/main/java/cz/xefensor/retold/worldgen/earth/EarthLabyrinthDimensions.java b/src/main/java/cz/xefensor/retold/worldgen/earth/EarthLabyrinthDimensions.java new file mode 100644 index 00000000..202e048a --- /dev/null +++ b/src/main/java/cz/xefensor/retold/worldgen/earth/EarthLabyrinthDimensions.java @@ -0,0 +1,30 @@ +package cz.xefensor.retold.worldgen.earth; + +final class EarthLabyrinthDimensions { + static final int PYRAMID_WIDTH = 12; + static final int PYRAMID_DEPTH = 15; + static final int UPPER_LEVEL_DEPTH = 64; + static final int LEVEL_SEPARATION = 14; + static final int CHAMBER_HEIGHT = 5; + static final int GUARDIAN_ARENA_CELL_RADIUS = 3; + static final int GUARDIAN_CHAMBER_INTERIOR_RADIUS = 15; + static final int GUARDIAN_CHAMBER_ROUGH_RADIUS = 16; + static final int GUARDIAN_CHAMBER_SHELL_RADIUS = 17; + static final int GUARDIAN_CHAMBER_INTERIOR_HEIGHT = 10; + static final int GUARDIAN_CHAMBER_HEIGHT = 12; + static final int CONNECTION_LOCAL_X = 9; + static final int CONNECTION_LOCAL_Y = -4; + static final int CONNECTION_LOCAL_Z = 9; + static final int ENTRANCE_SHAFT_DEPTH = 8; + + private EarthLabyrinthDimensions() { + } + + static int upperFloorY(int pyramidBaseY) { + return pyramidBaseY - UPPER_LEVEL_DEPTH; + } + + static int floorY(int pyramidBaseY, int level) { + return upperFloorY(pyramidBaseY) - level * LEVEL_SEPARATION; + } +} diff --git a/src/main/java/cz/xefensor/retold/worldgen/earth/EarthLabyrinthGenerator.java b/src/main/java/cz/xefensor/retold/worldgen/earth/EarthLabyrinthGenerator.java new file mode 100644 index 00000000..029c8395 --- /dev/null +++ b/src/main/java/cz/xefensor/retold/worldgen/earth/EarthLabyrinthGenerator.java @@ -0,0 +1,814 @@ +package cz.xefensor.retold.worldgen.earth; + +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.world.level.WorldGenLevel; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.LadderBlock; +import net.minecraft.world.level.block.StairBlock; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.chunk.ProtoChunk; +import net.minecraft.world.level.levelgen.structure.BoundingBox; + +import java.util.ArrayList; +import java.util.List; + +/** Chunk-bounded placement of the initial carved-tunnel Earth Labyrinth. */ +final class EarthLabyrinthGenerator { + private static final int CHAMBER_RADIUS = 2; + private static final int INTERIOR_RADIUS = 1; + + private EarthLabyrinthGenerator() { + } + + static void generate( + WorldGenLevel level, + BoundingBox chunkBounds, + int centerX, + int centerZ, + int pyramidBaseY, + BlockPos connection, + Direction egressDirection, + long layoutSeed + ) { + generate(level, chunkBounds, centerX, centerZ, pyramidBaseY, connection, egressDirection, + layoutSeed, EarthLabyrinthRooms.CONTENT_VERSION); + } + + static void generate( + WorldGenLevel level, BoundingBox chunkBounds, int centerX, int centerZ, int pyramidBaseY, + BlockPos connection, Direction egressDirection, long layoutSeed, int contentVersion + ) { + EarthLabyrinthLayout layout = EarthLabyrinthPlanner.generate(layoutSeed); + Placement placement = Placement.centered( + layout, + centerX, + centerZ, + pyramidBaseY, + layoutSeed + ); + + generateHorizontalPassageShells(level, chunkBounds, layoutSeed, layout, placement); + generateCaveNodes(level, chunkBounds, layoutSeed, placement); + generateGuardianChamber(level, chunkBounds, layoutSeed, placement); + carveHorizontalPassages(level, chunkBounds, layoutSeed, layout, placement); + generateVerticalConnections(level, chunkBounds, layoutSeed, layout, placement); + generatePuzzleRoomShaft( + level, + chunkBounds, + layoutSeed, + connection, + egressDirection + ); + generateEntranceStaircase( + level, + chunkBounds, + layoutSeed, + entranceStaircaseStart(connection), + egressDirection, + placement.cellCenter(layout.entrance()) + ); + if (contentVersion >= 1) { + for (EarthLabyrinthRooms.Room room : EarthLabyrinthRooms.plan(layout, layoutSeed)) { + EarthLabyrinthRoomPlacement.place(level, chunkBounds, room, placement.cellCenter(room.cell())); + } + } + } + + private static void generateHorizontalPassageShells( + WorldGenLevel level, + BoundingBox chunkBounds, + long layoutSeed, + EarthLabyrinthLayout layout, + Placement placement + ) { + for (EarthLabyrinthLayout.Passage passage : layout.passages()) { + if (passage.isVertical()) { + continue; + } + + List path = placement.tunnelPath(passage); + + for (int index = 0; index < path.size(); index++) { + BlockPos center = path.get(index); + Direction direction = tunnelDirection(path, index); + + for (int yOffset = 0; + yOffset < EarthLabyrinthDimensions.CHAMBER_HEIGHT; + yOffset++) { + for (int width = -CHAMBER_RADIUS; width <= CHAMBER_RADIUS; width++) { + BlockPos target = passageCrossSectionPosition( + center, + direction, + width, + yOffset + ); + setBlock(level, chunkBounds, target, wallState(layoutSeed, target)); + } + } + } + } + } + + private static void generateCaveNodes( + WorldGenLevel level, + BoundingBox chunkBounds, + long layoutSeed, + Placement placement + ) { + for (EarthLabyrinthLayout.Cell cell : placement.layout().cells()) { + if (isInsideGuardianArena(placement.layout(), cell)) { + continue; + } + + BlockPos center = placement.cellCenter(cell); + + for (int yOffset = 0; + yOffset < EarthLabyrinthDimensions.CHAMBER_HEIGHT; + yOffset++) { + for (int zOffset = -CHAMBER_RADIUS; + zOffset <= CHAMBER_RADIUS; + zOffset++) { + for (int xOffset = -CHAMBER_RADIUS; + xOffset <= CHAMBER_RADIUS; + xOffset++) { + BlockPos target = center.offset(xOffset, yOffset, zOffset); + setBlock( + level, + chunkBounds, + target, + isCaveNodeInterior( + layoutSeed, + target, + xOffset, + yOffset, + zOffset + ) + ? Blocks.CAVE_AIR.defaultBlockState() + : wallState(layoutSeed, target) + ); + } + } + } + } + } + + private static void generateGuardianChamber( + WorldGenLevel level, + BoundingBox chunkBounds, + long layoutSeed, + Placement placement + ) { + BlockPos center = placement.cellCenter(placement.layout().guardianChamber()); + int shellRadius = EarthLabyrinthDimensions.GUARDIAN_CHAMBER_SHELL_RADIUS; + + for (int yOffset = 0; + yOffset < EarthLabyrinthDimensions.GUARDIAN_CHAMBER_HEIGHT; + yOffset++) { + for (int zOffset = -shellRadius; zOffset <= shellRadius; zOffset++) { + for (int xOffset = -shellRadius; xOffset <= shellRadius; xOffset++) { + BlockPos target = center.offset(xOffset, yOffset, zOffset); + setBlock( + level, + chunkBounds, + target, + isGuardianChamberInterior( + layoutSeed, + target, + xOffset, + yOffset, + zOffset + ) + ? Blocks.CAVE_AIR.defaultBlockState() + : wallState(layoutSeed, target) + ); + } + } + } + } + + private static boolean isCaveNodeInterior( + long layoutSeed, + BlockPos target, + int xOffset, + int yOffset, + int zOffset + ) { + if (yOffset < 1 || yOffset > 3) { + return false; + } + + if (Math.abs(xOffset) > INTERIOR_RADIUS || Math.abs(zOffset) > INTERIOR_RADIUS) { + return false; + } + + boolean corner = Math.abs(xOffset) == INTERIOR_RADIUS + && Math.abs(zOffset) == INTERIOR_RADIUS; + return !corner || roughValue(layoutSeed, target, 3L) != 0L; + } + + private static boolean isGuardianChamberInterior( + long layoutSeed, + BlockPos target, + int xOffset, + int yOffset, + int zOffset + ) { + if (yOffset < 1 + || yOffset > EarthLabyrinthDimensions.GUARDIAN_CHAMBER_INTERIOR_HEIGHT) { + return false; + } + + int distanceSquared = xOffset * xOffset + zOffset * zOffset; + int interiorRadius = EarthLabyrinthDimensions.GUARDIAN_CHAMBER_INTERIOR_RADIUS; + int roughRadius = EarthLabyrinthDimensions.GUARDIAN_CHAMBER_ROUGH_RADIUS; + return distanceSquared <= interiorRadius * interiorRadius + || distanceSquared <= roughRadius * roughRadius + && roughValue(layoutSeed, target, 3L) != 0L; + } + + private static boolean isInsideGuardianArena( + EarthLabyrinthLayout layout, + EarthLabyrinthLayout.Cell cell + ) { + EarthLabyrinthLayout.Cell guardian = layout.guardianChamber(); + return cell.level() == guardian.level() + && Math.abs(cell.x() - guardian.x()) + <= EarthLabyrinthDimensions.GUARDIAN_ARENA_CELL_RADIUS + && Math.abs(cell.z() - guardian.z()) + <= EarthLabyrinthDimensions.GUARDIAN_ARENA_CELL_RADIUS; + } + + private static void carveHorizontalPassages( + WorldGenLevel level, + BoundingBox chunkBounds, + long layoutSeed, + EarthLabyrinthLayout layout, + Placement placement + ) { + for (EarthLabyrinthLayout.Passage passage : layout.passages()) { + if (passage.isVertical()) { + continue; + } + + List path = placement.tunnelPath(passage); + + for (int index = 0; index < path.size(); index++) { + BlockPos center = path.get(index); + Direction direction = tunnelDirection(path, index); + + for (int height = 1; height <= 3; height++) { + int widthRadius = height == 3 + && roughValue(layoutSeed, center, 4L) == 0L + ? 0 + : INTERIOR_RADIUS; + + for (int width = -widthRadius; width <= widthRadius; width++) { + BlockPos target = passageCrossSectionPosition( + center, + direction, + width, + height + ); + setBlock(level, chunkBounds, target, Blocks.CAVE_AIR.defaultBlockState()); + } + } + } + } + } + + private static BlockPos passageCrossSectionPosition( + BlockPos center, + Direction direction, + int width, + int height + ) { + return direction.getAxis() == Direction.Axis.X + ? center.offset(0, height, width) + : center.offset(width, height, 0); + } + + private static Direction tunnelDirection(List path, int index) { + return index + 1 < path.size() + ? directionBetween(path.get(index), path.get(index + 1)) + : directionBetween(path.get(index - 1), path.get(index)); + } + + static BlockPos cellCenter( + EarthLabyrinthLayout layout, + EarthLabyrinthLayout.Cell cell, + int centerX, + int centerZ, + int pyramidBaseY, + long layoutSeed + ) { + return Placement.centered( + layout, + centerX, + centerZ, + pyramidBaseY, + layoutSeed + ).cellCenter(cell); + } + + static List tunnelPath( + EarthLabyrinthLayout layout, + EarthLabyrinthLayout.Passage passage, + int centerX, + int centerZ, + int pyramidBaseY, + long layoutSeed + ) { + return Placement.centered( + layout, + centerX, + centerZ, + pyramidBaseY, + layoutSeed + ).tunnelPath(passage); + } + + private static void generateVerticalConnections( + WorldGenLevel level, + BoundingBox chunkBounds, + long layoutSeed, + EarthLabyrinthLayout layout, + Placement placement + ) { + BlockState ladder = Blocks.LADDER.defaultBlockState() + .setValue(LadderBlock.FACING, Direction.SOUTH); + + for (EarthLabyrinthLayout.Passage passage : layout.passages()) { + if (!passage.isVertical()) { + continue; + } + + EarthLabyrinthLayout.Cell upperCell = passage.first().level() == 0 + ? passage.first() + : passage.second(); + EarthLabyrinthLayout.Cell lowerCell = passage.first().level() == 1 + ? passage.first() + : passage.second(); + BlockPos upper = placement.cellCenter(upperCell); + BlockPos lower = placement.cellCenter(lowerCell); + BlockPos supportBase = new BlockPos(upper.getX(), lower.getY(), upper.getZ()); + BlockPos ladderBase = supportBase.south(); + + for (int y = lower.getY(); + y <= upper.getY() + EarthLabyrinthDimensions.CHAMBER_HEIGHT - 2; + y++) { + BlockPos support = new BlockPos(supportBase.getX(), y, supportBase.getZ()); + BlockPos ladderPos = new BlockPos(ladderBase.getX(), y, ladderBase.getZ()); + setBlock(level, chunkBounds, support, wallState(layoutSeed, support)); + + if (y > lower.getY()) { + setBlock(level, chunkBounds, ladderPos, ladder); + } + } + } + } + + private static void generateEntranceStaircase( + WorldGenLevel level, + BoundingBox chunkBounds, + long layoutSeed, + BlockPos connection, + Direction egressDirection, + BlockPos entrance + ) { + List path = entrancePath(connection, egressDirection, entrance); + + for (int index = 3; index < path.size(); index++) { + BlockPos node = path.get(index); + + for (int yOffset = 0; yOffset <= 4; yOffset++) { + for (int zOffset = -2; zOffset <= 2; zOffset++) { + for (int xOffset = -2; xOffset <= 2; xOffset++) { + boolean shell = yOffset == 0 + || yOffset == 4 + || Math.abs(xOffset) == 2 + || Math.abs(zOffset) == 2; + + BlockPos target = node.offset(xOffset, yOffset, zOffset); + + if (shell + && !isInsideEntranceChamber(target, entrance) + && !isInsideEntranceShaft( + target, + connection, + egressDirection + )) { + setBlock(level, chunkBounds, target, wallState(layoutSeed, target)); + } + } + } + } + } + + for (int index = 1; index < path.size(); index++) { + BlockPos node = path.get(index); + int radius = index <= 3 ? 0 : INTERIOR_RADIUS; + + for (int yOffset = 1; yOffset <= 3; yOffset++) { + for (int zOffset = -radius; + zOffset <= radius; + zOffset++) { + for (int xOffset = -radius; + xOffset <= radius; + xOffset++) { + BlockPos target = node.offset(xOffset, yOffset, zOffset); + + if (!isInsideEntranceShaft(target, connection, egressDirection)) { + setBlock( + level, + chunkBounds, + target, + Blocks.CAVE_AIR.defaultBlockState() + ); + } + } + } + } + } + + for (int index = 1; index < path.size(); index++) { + BlockPos previous = path.get(index - 1); + BlockPos node = path.get(index); + + if (node.getY() >= previous.getY()) { + continue; + } + + Direction travel = directionBetween(previous, node); + BlockState stair = Blocks.MOSSY_COBBLESTONE_STAIRS.defaultBlockState() + .setValue(StairBlock.FACING, travel.getOpposite()); + setBlock(level, chunkBounds, node, stair); + } + } + + /** + * Drops below the complete vanilla puzzle footprint before any horizontal carving begins. + * The opening is the unused center of the revealed chamber at local (9, -3, 9); its + * neighboring redstone, pistons, repeater, hidden chest, and their supports remain untouched. + */ + private static void generatePuzzleRoomShaft( + WorldGenLevel level, + BoundingBox chunkBounds, + long layoutSeed, + BlockPos connection, + Direction egressDirection + ) { + BlockState ladder = Blocks.LADDER.defaultBlockState() + .setValue(LadderBlock.FACING, egressDirection); + Direction supportDirection = egressDirection.getOpposite(); + + setBlock( + level, + chunkBounds, + connection.above(), + Blocks.CAVE_AIR.defaultBlockState() + ); + + for (int depth = 0; + depth <= EarthLabyrinthDimensions.ENTRANCE_SHAFT_DEPTH; + depth++) { + BlockPos ladderPos = connection.below(depth); + BlockPos support = ladderPos.relative(supportDirection); + setBlock(level, chunkBounds, support, wallState(layoutSeed, support)); + setBlock(level, chunkBounds, ladderPos, ladder); + } + } + + static BlockPos entranceStaircaseStart(BlockPos connection) { + return connection.below(EarthLabyrinthDimensions.ENTRANCE_SHAFT_DEPTH); + } + + private static boolean isInsideEntranceShaft( + BlockPos target, + BlockPos staircaseStart, + Direction egressDirection + ) { + if (target.getY() < staircaseStart.getY()) { + return false; + } + + BlockPos supportStart = staircaseStart.relative(egressDirection.getOpposite()); + return (target.getX() == staircaseStart.getX() + && target.getZ() == staircaseStart.getZ()) + || (target.getX() == supportStart.getX() + && target.getZ() == supportStart.getZ()); + } + + private static boolean isInsideEntranceChamber(BlockPos target, BlockPos entrance) { + return Math.abs(target.getX() - entrance.getX()) <= CHAMBER_RADIUS + && Math.abs(target.getZ() - entrance.getZ()) <= CHAMBER_RADIUS + && target.getY() >= entrance.getY() + && target.getY() < entrance.getY() + EarthLabyrinthDimensions.CHAMBER_HEIGHT; + } + + static List entrancePath( + BlockPos connection, + Direction egressDirection, + BlockPos entrance + ) { + List path = new ArrayList<>(); + BlockPos.MutableBlockPos cursor = connection.mutable(); + path.add(cursor.immutable()); + + for (int step = 0; step < 3; step++) { + addStairPathStep(path, cursor, egressDirection, entrance.getY()); + } + + int directDistance = horizontalDistance(cursor, entrance); + int remainingDrop = cursor.getY() - entrance.getY(); + int extraHorizontalSteps = Math.max(0, remainingDrop - directDistance); + boolean alignXFirst = true; + + if (extraHorizontalSteps > 0) { + Direction detourDirection = detourDirection(cursor, entrance); + int detourAxisDistance = detourDirection.getAxis() == Direction.Axis.X + ? Math.abs(cursor.getX() - entrance.getX()) + : Math.abs(cursor.getZ() - entrance.getZ()); + int detourDistance = detourAxisDistance + (extraHorizontalSteps + 1) / 2; + alignXFirst = detourDirection.getAxis() == Direction.Axis.Z; + + for (int step = 0; step < detourDistance; step++) { + addStairPathStep(path, cursor, detourDirection, entrance.getY()); + } + } + + while (cursor.getX() != entrance.getX() || cursor.getZ() != entrance.getZ()) { + Direction direction; + + if (alignXFirst && cursor.getX() != entrance.getX()) { + direction = cursor.getX() < entrance.getX() ? Direction.EAST : Direction.WEST; + } else if (!alignXFirst && cursor.getZ() != entrance.getZ()) { + direction = cursor.getZ() < entrance.getZ() ? Direction.SOUTH : Direction.NORTH; + } else if (cursor.getX() != entrance.getX()) { + direction = cursor.getX() < entrance.getX() ? Direction.EAST : Direction.WEST; + } else { + direction = cursor.getZ() < entrance.getZ() ? Direction.SOUTH : Direction.NORTH; + } + + addStairPathStep(path, cursor, direction, entrance.getY()); + } + + if (cursor.getY() != entrance.getY()) { + throw new IllegalStateException("Earth Labyrinth staircase did not reach entrance depth"); + } + + return List.copyOf(path); + } + + private static void addStairPathStep( + List path, + BlockPos.MutableBlockPos cursor, + Direction direction, + int targetY + ) { + cursor.move(direction); + + if (cursor.getY() > targetY) { + cursor.move(Direction.DOWN); + } + + path.add(cursor.immutable()); + } + + private static int horizontalDistance(BlockPos first, BlockPos second) { + return Math.abs(first.getX() - second.getX()) + + Math.abs(first.getZ() - second.getZ()); + } + + private static Direction detourDirection(BlockPos cursor, BlockPos entrance) { + int xDistance = Math.abs(cursor.getX() - entrance.getX()); + int zDistance = Math.abs(cursor.getZ() - entrance.getZ()); + + if (xDistance <= zDistance) { + return cursor.getX() >= entrance.getX() ? Direction.WEST : Direction.EAST; + } + + return cursor.getZ() >= entrance.getZ() ? Direction.NORTH : Direction.SOUTH; + } + + private static Direction directionBetween(BlockPos first, BlockPos second) { + int deltaX = second.getX() - first.getX(); + + if (deltaX != 0) { + return deltaX > 0 ? Direction.EAST : Direction.WEST; + } + + int deltaZ = second.getZ() - first.getZ(); + return deltaZ > 0 ? Direction.SOUTH : Direction.NORTH; + } + + private static BlockState wallState(long layoutSeed, BlockPos pos) { + long choice = roughValue(layoutSeed, pos, 16L); + + if (pos.getY() < 0) { + if (choice < 9L) { + return Blocks.DEEPSLATE.defaultBlockState(); + } + if (choice < 12L) { + return Blocks.TUFF.defaultBlockState(); + } + if (choice < 14L) { + return Blocks.COBBLED_DEEPSLATE.defaultBlockState(); + } + return choice == 14L + ? Blocks.MOSSY_COBBLESTONE.defaultBlockState() + : Blocks.ANDESITE.defaultBlockState(); + } + + if (choice < 9L) { + return Blocks.STONE.defaultBlockState(); + } + if (choice < 12L) { + return Blocks.ANDESITE.defaultBlockState(); + } + if (choice < 14L) { + return Blocks.TUFF.defaultBlockState(); + } + return choice == 14L + ? Blocks.COBBLESTONE.defaultBlockState() + : Blocks.MOSSY_COBBLESTONE.defaultBlockState(); + } + + private static long roughValue(long layoutSeed, BlockPos pos, long bound) { + long value = layoutSeed + ^ (long) pos.getX() * 0x9E3779B185EBCA87L + ^ (long) pos.getY() * 0xC2B2AE3D27D4EB4FL + ^ (long) pos.getZ() * 0x165667B19E3779F9L; + value ^= value >>> 29; + return Long.remainderUnsigned(value, bound); + } + + private static void setBlock( + WorldGenLevel level, + BoundingBox chunkBounds, + BlockPos pos, + BlockState state + ) { + if (!chunkBounds.isInside(pos) || level.isOutsideBuildHeight(pos)) { + return; + } + + if (level.getBlockEntity(pos) != null) { + return; + } + + level.setBlock(pos, state, 2); + + if (state.is(Blocks.LADDER) && level.getChunk(pos) instanceof ProtoChunk protoChunk) { + protoChunk.markPosForPostProcessing(pos); + } + } + + private record Placement( + EarthLabyrinthLayout layout, + int minX, + int minZ, + int pyramidBaseY, + long layoutSeed + ) { + private static Placement centered( + EarthLabyrinthLayout layout, + int centerX, + int centerZ, + int pyramidBaseY, + long layoutSeed + ) { + return new Placement( + layout, + centerX - layout.footprintWidthBlocks() / 2, + centerZ - layout.footprintWidthBlocks() / 2, + pyramidBaseY, + layoutSeed + ); + } + + private BlockPos cellCenter(EarthLabyrinthLayout.Cell cell) { + return new BlockPos( + minX + CHAMBER_RADIUS + + cell.x() * EarthLabyrinthLayout.CELL_PITCH_BLOCKS + + cellJitter(cell, true), + EarthLabyrinthDimensions.floorY(pyramidBaseY, cell.level()), + minZ + CHAMBER_RADIUS + + cell.z() * EarthLabyrinthLayout.CELL_PITCH_BLOCKS + + cellJitter(cell, false) + ); + } + + private int cellJitter(EarthLabyrinthLayout.Cell cell, boolean xAxis) { + EarthLabyrinthLayout.CellKind kind = layout.kindAt(cell); + + if (kind == EarthLabyrinthLayout.CellKind.ENTRANCE + || kind == EarthLabyrinthLayout.CellKind.GUARDIAN_CHAMBER) { + return 0; + } + + BlockPos local = new BlockPos(cell.x(), 0, cell.z()); + long salt = xAxis ? 0x243F6A8885A308D3L : 0x13198A2E03707344L; + int jitter = (int) roughValue(layoutSeed ^ salt, local, 3L) - 1; + int coordinate = xAxis ? cell.x() : cell.z(); + + if (coordinate == 0) { + return Math.abs(jitter); + } + if (coordinate == layout.sideCells() - 1) { + return -Math.abs(jitter); + } + return jitter; + } + + private List tunnelPath(EarthLabyrinthLayout.Passage passage) { + BlockPos first = cellCenter(passage.first()); + BlockPos second = cellCenter(passage.second()); + List path = new ArrayList<>(); + BlockPos.MutableBlockPos cursor = first.mutable(); + path.add(cursor.immutable()); + + int xDistance = Math.abs(second.getX() - first.getX()); + int zDistance = Math.abs(second.getZ() - first.getZ()); + long curveSeed = layoutSeed + ^ (long) passage.first().hashCode() * 0x9E3779B97F4A7C15L + ^ (long) passage.second().hashCode() * 0xC2B2AE3D27D4EB4FL; + int curveOffset = (int) Long.remainderUnsigned(curveSeed, 3L) - 1; + int bendX = (first.getX() + second.getX()) / 2; + int bendZ = (first.getZ() + second.getZ()) / 2; + + if (xDistance >= zDistance) { + bendZ += curveOffset; + } else { + bendX += curveOffset; + } + + appendMeanderingSteps( + path, + cursor, + clampTunnelX(bendX), + clampTunnelZ(bendZ), + curveSeed + ); + appendMeanderingSteps( + path, + cursor, + second.getX(), + second.getZ(), + curveSeed ^ 0xA4093822299F31D0L + ); + + return List.copyOf(path); + } + + private int clampTunnelX(int x) { + return Math.max( + minX + CHAMBER_RADIUS, + Math.min(minX + layout.footprintWidthBlocks() - 1 - CHAMBER_RADIUS, x) + ); + } + + private int clampTunnelZ(int z) { + return Math.max( + minZ + CHAMBER_RADIUS, + Math.min(minZ + layout.footprintWidthBlocks() - 1 - CHAMBER_RADIUS, z) + ); + } + + private static void appendMeanderingSteps( + List path, + BlockPos.MutableBlockPos cursor, + int targetX, + int targetZ, + long pathSeed + ) { + while (cursor.getX() != targetX || cursor.getZ() != targetZ) { + int xDistance = Math.abs(targetX - cursor.getX()); + int zDistance = Math.abs(targetZ - cursor.getZ()); + long choice = roughValue(pathSeed, cursor, 4L); + Direction direction; + + if (zDistance == 0) { + direction = cursor.getX() < targetX ? Direction.EAST : Direction.WEST; + } else if (xDistance == 0) { + direction = cursor.getZ() < targetZ ? Direction.SOUTH : Direction.NORTH; + } else if (xDistance > zDistance) { + direction = choice == 0L + ? cursor.getZ() < targetZ ? Direction.SOUTH : Direction.NORTH + : cursor.getX() < targetX ? Direction.EAST : Direction.WEST; + } else if (zDistance > xDistance) { + direction = choice == 0L + ? cursor.getX() < targetX ? Direction.EAST : Direction.WEST + : cursor.getZ() < targetZ ? Direction.SOUTH : Direction.NORTH; + } else if ((choice & 1L) == 0L) { + direction = cursor.getX() < targetX ? Direction.EAST : Direction.WEST; + } else { + direction = cursor.getZ() < targetZ ? Direction.SOUTH : Direction.NORTH; + } + + cursor.move(direction); + path.add(cursor.immutable()); + } + } + } +} diff --git a/src/main/java/cz/xefensor/retold/worldgen/earth/EarthLabyrinthLayout.java b/src/main/java/cz/xefensor/retold/worldgen/earth/EarthLabyrinthLayout.java new file mode 100644 index 00000000..717a2023 --- /dev/null +++ b/src/main/java/cz/xefensor/retold/worldgen/earth/EarthLabyrinthLayout.java @@ -0,0 +1,123 @@ +package cz.xefensor.retold.worldgen.earth; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +/** + * Immutable, block-independent topology for one two-level Earth Labyrinth. + * Cell coordinates are local to the labyrinth rather than world coordinates. + */ +record EarthLabyrinthLayout( + int sideCells, + List passages, + Map cellKinds +) { + static final int LEVEL_COUNT = 2; + static final int CELL_PITCH_BLOCKS = 6; + static final int CELL_ROOM_WIDTH_BLOCKS = 5; + + EarthLabyrinthLayout { + if (sideCells < 3 || sideCells % 2 == 0) { + throw new IllegalArgumentException("Earth Labyrinth sides must use an odd cell count"); + } + + passages = List.copyOf(passages); + cellKinds = Map.copyOf(cellKinds); + } + + int footprintWidthBlocks() { + return (sideCells - 1) * CELL_PITCH_BLOCKS + CELL_ROOM_WIDTH_BLOCKS; + } + + Cell entrance() { + return new Cell(sideCells / 2, 0, 0); + } + + Cell guardianChamber() { + return new Cell(sideCells / 2, sideCells / 2, LEVEL_COUNT - 1); + } + + List cells() { + List cells = new ArrayList<>(sideCells * sideCells * LEVEL_COUNT); + + for (int level = 0; level < LEVEL_COUNT; level++) { + for (int z = 0; z < sideCells; z++) { + for (int x = 0; x < sideCells; x++) { + cells.add(new Cell(x, z, level)); + } + } + } + + return List.copyOf(cells); + } + + List neighbors(Cell cell) { + List neighbors = new ArrayList<>(); + + for (Passage passage : passages) { + if (passage.first().equals(cell)) { + neighbors.add(passage.second()); + } else if (passage.second().equals(cell)) { + neighbors.add(passage.first()); + } + } + + neighbors.sort(Cell::compareTo); + return List.copyOf(neighbors); + } + + CellKind kindAt(Cell cell) { + return cellKinds.getOrDefault(cell, CellKind.PASSAGE); + } + + long verticalPassageCount() { + return passages.stream().filter(Passage::isVertical).count(); + } + + enum CellKind { + PASSAGE, + ENTRANCE, + STAIR, + GUARDIAN_CHAMBER + } + + record Cell(int x, int z, int level) implements Comparable { + @Override + public int compareTo(Cell other) { + int levelOrder = Integer.compare(level, other.level); + + if (levelOrder != 0) { + return levelOrder; + } + + int zOrder = Integer.compare(z, other.z); + return zOrder != 0 ? zOrder : Integer.compare(x, other.x); + } + } + + record Passage(Cell first, Cell second) { + Passage { + if (!areAdjacent(first, second)) { + throw new IllegalArgumentException("Labyrinth passages must join adjacent cells"); + } + + if (first.compareTo(second) > 0) { + Cell previousFirst = first; + first = second; + second = previousFirst; + } + } + + boolean isVertical() { + return first.level() != second.level(); + } + + private static boolean areAdjacent(Cell first, Cell second) { + int distance = Math.abs(first.x() - second.x()) + + Math.abs(first.z() - second.z()) + + Math.abs(first.level() - second.level()); + return distance == 1; + } + } +} diff --git a/src/main/java/cz/xefensor/retold/worldgen/earth/EarthLabyrinthPiece.java b/src/main/java/cz/xefensor/retold/worldgen/earth/EarthLabyrinthPiece.java new file mode 100644 index 00000000..37ed821f --- /dev/null +++ b/src/main/java/cz/xefensor/retold/worldgen/earth/EarthLabyrinthPiece.java @@ -0,0 +1,151 @@ +package cz.xefensor.retold.worldgen.earth; + +import cz.xefensor.retold.worldgen.RetoldWorldgenRegistries; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.util.RandomSource; +import net.minecraft.world.level.ChunkPos; +import net.minecraft.world.level.StructureManager; +import net.minecraft.world.level.WorldGenLevel; +import net.minecraft.world.level.chunk.ChunkGenerator; +import net.minecraft.world.level.levelgen.structure.BoundingBox; +import net.minecraft.world.level.levelgen.structure.StructurePiece; +import net.minecraft.world.level.levelgen.structure.pieces.StructurePieceSerializationContext; + +public final class EarthLabyrinthPiece extends StructurePiece { + private final int centerX; + private final int centerZ; + private final int pyramidBaseY; + private final BlockPos connection; + private final Direction egressDirection; + private final long layoutSeed; + private final int contentVersion; + + EarthLabyrinthPiece( + int centerX, + int centerZ, + int pyramidBaseY, + BlockPos connection, + Direction egressDirection, + long layoutSeed + ) { + super( + RetoldWorldgenRegistries.EARTH_LABYRINTH_PIECE.get(), + 0, + createBoundingBox(centerX, centerZ, pyramidBaseY, connection, layoutSeed) + ); + this.centerX = centerX; + this.centerZ = centerZ; + this.pyramidBaseY = pyramidBaseY; + this.connection = connection.immutable(); + this.egressDirection = egressDirection; + this.layoutSeed = layoutSeed; + this.contentVersion = EarthLabyrinthRooms.CONTENT_VERSION; + } + + public EarthLabyrinthPiece(CompoundTag tag) { + super(RetoldWorldgenRegistries.EARTH_LABYRINTH_PIECE.get(), tag); + this.centerX = tag.getIntOr("CenterX", this.boundingBox.getCenter().getX()); + this.centerZ = tag.getIntOr("CenterZ", this.boundingBox.getCenter().getZ()); + this.pyramidBaseY = tag.getIntOr( + "PyramidBaseY", + this.boundingBox.maxY() - EarthLabyrinthDimensions.CONNECTION_LOCAL_Y + ); + this.connection = new BlockPos( + tag.getIntOr("ConnectionX", centerX), + tag.getIntOr("ConnectionY", this.boundingBox.maxY()), + tag.getIntOr("ConnectionZ", centerZ) + ); + this.egressDirection = Direction.from2DDataValue(tag.getIntOr("EgressDirection", 0)); + this.layoutSeed = tag.getLongOr("LayoutSeed", 0L); + // Old/partially generated starts retain their original empty-room content. + this.contentVersion = tag.getIntOr("ContentVersion", 0); + } + + private static BoundingBox createBoundingBox( + int centerX, + int centerZ, + int pyramidBaseY, + BlockPos connection, + long layoutSeed + ) { + EarthLabyrinthLayout layout = EarthLabyrinthPlanner.generate(layoutSeed); + int width = layout.footprintWidthBlocks(); + int minX = centerX - width / 2; + int minZ = centerZ - width / 2; + int minY = EarthLabyrinthDimensions.floorY( + pyramidBaseY, + EarthLabyrinthLayout.LEVEL_COUNT - 1 + ); + int maxY = Math.max( + connection.getY() + 3, + EarthLabyrinthDimensions.upperFloorY(pyramidBaseY) + + EarthLabyrinthDimensions.CHAMBER_HEIGHT - 1 + ); + return new BoundingBox( + minX, + minY, + minZ, + minX + width - 1, + maxY, + minZ + width - 1 + ); + } + + @Override + protected void addAdditionalSaveData( + StructurePieceSerializationContext context, + CompoundTag tag + ) { + tag.putInt("CenterX", centerX); + tag.putInt("CenterZ", centerZ); + tag.putInt("PyramidBaseY", pyramidBaseY); + tag.putInt("ConnectionX", connection.getX()); + tag.putInt("ConnectionY", connection.getY()); + tag.putInt("ConnectionZ", connection.getZ()); + tag.putInt("EgressDirection", egressDirection.get2DDataValue()); + tag.putLong("LayoutSeed", layoutSeed); + tag.putInt("ContentVersion", contentVersion); + } + + @Override + public void postProcess( + WorldGenLevel level, + StructureManager structureManager, + ChunkGenerator generator, + RandomSource random, + BoundingBox chunkBB, + ChunkPos chunkPos, + BlockPos referencePos + ) { + EarthLabyrinthGenerator.generate( + level, + chunkBB, + centerX, + centerZ, + pyramidBaseY, + connection, + egressDirection, + layoutSeed, + contentVersion + ); + } + + long layoutSeed() { + return layoutSeed; + } + + EarthLabyrinthSource guardianSource() { + EarthLabyrinthLayout layout = EarthLabyrinthPlanner.generate(layoutSeed); + BlockPos chamberFloor = EarthLabyrinthGenerator.cellCenter( + layout, + layout.guardianChamber(), + centerX, + centerZ, + pyramidBaseY, + layoutSeed + ); + return new EarthLabyrinthSource(chamberFloor.above(), this.boundingBox); + } +} diff --git a/src/main/java/cz/xefensor/retold/worldgen/earth/EarthLabyrinthPlanner.java b/src/main/java/cz/xefensor/retold/worldgen/earth/EarthLabyrinthPlanner.java new file mode 100644 index 00000000..d0cfc680 --- /dev/null +++ b/src/main/java/cz/xefensor/retold/worldgen/earth/EarthLabyrinthPlanner.java @@ -0,0 +1,317 @@ +package cz.xefensor.retold.worldgen.earth; + +import java.util.ArrayDeque; +import java.util.ArrayList; +import java.util.Deque; +import java.util.HashMap; +import java.util.HashSet; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +/** Pure deterministic topology planning for the Earth Labyrinth. */ +final class EarthLabyrinthPlanner { + private static final int SMALL_SIDE_CELLS = 13; + private static final int LARGE_SIDE_CELLS = 17; + private static final int MIN_VERTICAL_CONNECTIONS = 4; + private static final int CLOSED_EDGES_PER_LOOP = 18; + + private EarthLabyrinthPlanner() { + } + + static long seedForPyramid(long worldSeed, int chunkX, int chunkZ) { + long positionedSeed = worldSeed + ^ (long) chunkX * 0x4F9939F508L + ^ (long) chunkZ * 0x1EF1565BD5L; + return mix64(positionedSeed ^ 0x6A09E667F3BCC909L); + } + + static EarthLabyrinthLayout generate(long seed) { + LayoutRandom random = new LayoutRandom(seed ^ 0x45A27B1D6E3C890FL); + int sideCells = random.nextBoolean() ? SMALL_SIDE_CELLS : LARGE_SIDE_CELLS; + Set passages = new LinkedHashSet<>(); + EarthLabyrinthLayout.Cell entrance = new EarthLabyrinthLayout.Cell( + sideCells / 2, + 0, + 0 + ); + EarthLabyrinthLayout.Cell guardian = new EarthLabyrinthLayout.Cell( + sideCells / 2, + sideCells / 2, + EarthLabyrinthLayout.LEVEL_COUNT - 1 + ); + + carveLevel(sideCells, 0, entrance, random, passages); + carveLevel(sideCells, 1, guardian, random, passages); + addLoops(sideCells, 0, random, passages); + addLoops(sideCells, 1, random, passages); + + List stairs = addVerticalConnections( + sideCells, + entrance, + guardian, + random, + passages + ); + Map cellKinds = + new HashMap<>(); + + for (EarthLabyrinthLayout.Passage stair : stairs) { + cellKinds.put(stair.first(), EarthLabyrinthLayout.CellKind.STAIR); + cellKinds.put(stair.second(), EarthLabyrinthLayout.CellKind.STAIR); + } + + cellKinds.put(entrance, EarthLabyrinthLayout.CellKind.ENTRANCE); + cellKinds.put(guardian, EarthLabyrinthLayout.CellKind.GUARDIAN_CHAMBER); + + return new EarthLabyrinthLayout( + sideCells, + List.copyOf(passages), + cellKinds + ); + } + + private static long mix64(long value) { + value = (value ^ value >>> 30) * 0xBF58476D1CE4E5B9L; + value = (value ^ value >>> 27) * 0x94D049BB133111EBL; + return value ^ value >>> 31; + } + + private static void carveLevel( + int sideCells, + int level, + EarthLabyrinthLayout.Cell start, + LayoutRandom random, + Set passages + ) { + Set visited = new HashSet<>(); + Deque path = new ArrayDeque<>(); + + visited.add(start); + path.push(start); + + while (!path.isEmpty()) { + EarthLabyrinthLayout.Cell current = path.peek(); + List candidates = unvisitedNeighbors( + current, + sideCells, + level, + visited + ); + + if (candidates.isEmpty()) { + path.pop(); + continue; + } + + EarthLabyrinthLayout.Cell next = candidates.get(random.nextInt(candidates.size())); + passages.add(new EarthLabyrinthLayout.Passage(current, next)); + visited.add(next); + path.push(next); + } + } + + private static List unvisitedNeighbors( + EarthLabyrinthLayout.Cell cell, + int sideCells, + int level, + Set visited + ) { + List candidates = new ArrayList<>(4); + + addCandidate(candidates, visited, cell.x(), cell.z() - 1, level, sideCells); + addCandidate(candidates, visited, cell.x() + 1, cell.z(), level, sideCells); + addCandidate(candidates, visited, cell.x(), cell.z() + 1, level, sideCells); + addCandidate(candidates, visited, cell.x() - 1, cell.z(), level, sideCells); + return candidates; + } + + private static void addCandidate( + List candidates, + Set visited, + int x, + int z, + int level, + int sideCells + ) { + if (x < 0 || z < 0 || x >= sideCells || z >= sideCells) { + return; + } + + EarthLabyrinthLayout.Cell candidate = new EarthLabyrinthLayout.Cell(x, z, level); + + if (!visited.contains(candidate)) { + candidates.add(candidate); + } + } + + private static void addLoops( + int sideCells, + int level, + LayoutRandom random, + Set passages + ) { + List closedEdges = new ArrayList<>(); + + for (int z = 0; z < sideCells; z++) { + for (int x = 0; x < sideCells; x++) { + EarthLabyrinthLayout.Cell cell = new EarthLabyrinthLayout.Cell(x, z, level); + + if (x + 1 < sideCells) { + addClosedEdge( + closedEdges, + passages, + cell, + new EarthLabyrinthLayout.Cell(x + 1, z, level) + ); + } + if (z + 1 < sideCells) { + addClosedEdge( + closedEdges, + passages, + cell, + new EarthLabyrinthLayout.Cell(x, z + 1, level) + ); + } + } + } + + random.shuffle(closedEdges); + int loopCount = Math.max(3, sideCells * sideCells / CLOSED_EDGES_PER_LOOP); + + for (int index = 0; index < Math.min(loopCount, closedEdges.size()); index++) { + passages.add(closedEdges.get(index)); + } + } + + private static void addClosedEdge( + List closedEdges, + Set passages, + EarthLabyrinthLayout.Cell first, + EarthLabyrinthLayout.Cell second + ) { + EarthLabyrinthLayout.Passage passage = new EarthLabyrinthLayout.Passage(first, second); + + if (!passages.contains(passage)) { + closedEdges.add(passage); + } + } + + private static List addVerticalConnections( + int sideCells, + EarthLabyrinthLayout.Cell entrance, + EarthLabyrinthLayout.Cell guardian, + LayoutRandom random, + Set passages + ) { + List candidates = new ArrayList<>(); + + for (int z = 1; z < sideCells - 1; z++) { + for (int x = 1; x < sideCells - 1; x++) { + EarthLabyrinthLayout.Cell upper = new EarthLabyrinthLayout.Cell(x, z, 0); + EarthLabyrinthLayout.Cell lower = new EarthLabyrinthLayout.Cell(x, z, 1); + + if (!upper.equals(entrance) + && !isInsideGuardianArena(lower, guardian)) { + candidates.add(upper); + } + } + } + + random.shuffle(candidates); + int targetCount = MIN_VERTICAL_CONNECTIONS + (random.nextBoolean() ? 1 : 0); + List stairs = new ArrayList<>(targetCount); + + for (EarthLabyrinthLayout.Cell upper : candidates) { + if (stairs.size() >= targetCount) { + break; + } + if (!isSeparatedFromExistingStair(upper, stairs, sideCells / 3)) { + continue; + } + + EarthLabyrinthLayout.Cell lower = new EarthLabyrinthLayout.Cell( + upper.x(), + upper.z(), + 1 + ); + EarthLabyrinthLayout.Passage stair = new EarthLabyrinthLayout.Passage(upper, lower); + passages.add(stair); + stairs.add(stair); + } + + if (stairs.size() < MIN_VERTICAL_CONNECTIONS) { + throw new IllegalStateException("Could not place separated Earth Labyrinth stairs"); + } + + return List.copyOf(stairs); + } + + private static boolean isInsideGuardianArena( + EarthLabyrinthLayout.Cell cell, + EarthLabyrinthLayout.Cell guardian + ) { + return cell.level() == guardian.level() + && Math.abs(cell.x() - guardian.x()) + <= EarthLabyrinthDimensions.GUARDIAN_ARENA_CELL_RADIUS + && Math.abs(cell.z() - guardian.z()) + <= EarthLabyrinthDimensions.GUARDIAN_ARENA_CELL_RADIUS; + } + + private static boolean isSeparatedFromExistingStair( + EarthLabyrinthLayout.Cell candidate, + List stairs, + int requiredDistance + ) { + for (EarthLabyrinthLayout.Passage stair : stairs) { + EarthLabyrinthLayout.Cell existing = stair.first(); + int distance = Math.abs(candidate.x() - existing.x()) + + Math.abs(candidate.z() - existing.z()); + + if (distance < requiredDistance) { + return false; + } + } + + return true; + } + + /** Stable SplitMix64-backed random source so saved world seeds retain their layouts. */ + private static final class LayoutRandom { + private long state; + + private LayoutRandom(long seed) { + state = seed; + } + + private boolean nextBoolean() { + return (nextLong() & 1L) == 0L; + } + + private int nextInt(int bound) { + if (bound <= 0) { + throw new IllegalArgumentException("Random bound must be positive"); + } + + return (int) Long.remainderUnsigned(nextLong(), bound); + } + + private void shuffle(List values) { + for (int index = values.size() - 1; index > 0; index--) { + int swapIndex = nextInt(index + 1); + T previous = values.get(index); + values.set(index, values.get(swapIndex)); + values.set(swapIndex, previous); + } + } + + private long nextLong() { + state += 0x9E3779B97F4A7C15L; + long value = state; + value = (value ^ value >>> 30) * 0xBF58476D1CE4E5B9L; + value = (value ^ value >>> 27) * 0x94D049BB133111EBL; + return value ^ value >>> 31; + } + } +} diff --git a/src/main/java/cz/xefensor/retold/worldgen/earth/EarthLabyrinthRoomPlacement.java b/src/main/java/cz/xefensor/retold/worldgen/earth/EarthLabyrinthRoomPlacement.java new file mode 100644 index 00000000..f8104ff0 --- /dev/null +++ b/src/main/java/cz/xefensor/retold/worldgen/earth/EarthLabyrinthRoomPlacement.java @@ -0,0 +1,60 @@ +package cz.xefensor.retold.worldgen.earth; + +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.core.registries.Registries; +import net.minecraft.resources.Identifier; +import net.minecraft.resources.ResourceKey; +import net.minecraft.world.level.WorldGenLevel; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.ChestBlock; +import net.minecraft.world.level.block.DispenserBlock; +import net.minecraft.world.level.block.entity.RandomizableContainerBlockEntity; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.levelgen.structure.BoundingBox; +import net.minecraft.world.level.storage.loot.LootTable; + +/** Vanilla redstone/loot containers; no ticking dungeon owner, lights, or forced mob spawns. */ +final class EarthLabyrinthRoomPlacement { + static final ResourceKey TREASURE = lootTable("chests/earth_labyrinth"); + static final ResourceKey ARROWS = lootTable("chests/earth_labyrinth_dispenser"); + + private EarthLabyrinthRoomPlacement() { + } + + static void place(WorldGenLevel level, BoundingBox chunkBounds, EarthLabyrinthRooms.Room room, BlockPos floor) { + Direction back = room.backX() > 0 ? Direction.EAST : room.backX() < 0 ? Direction.WEST + : room.backZ() > 0 ? Direction.SOUTH : Direction.NORTH; + BlockPos trigger = floor.relative(back).above(); + if (room.kind() == EarthLabyrinthRooms.Kind.TREASURE) { + placeContainer(level, chunkBounds, trigger, + Blocks.CHEST.defaultBlockState().setValue(ChestBlock.FACING, back.getOpposite()), + TREASURE, room.lootSeed()); + return; + } + // A plate immediately in front of the dispenser powers it directly. The center remains walkable. + BlockPos dispenser = floor.relative(back, 2).above(); + placeContainer(level, chunkBounds, dispenser, + Blocks.DISPENSER.defaultBlockState().setValue(DispenserBlock.FACING, back.getOpposite()), + ARROWS, room.lootSeed()); + if (chunkBounds.isInside(trigger) && !level.isOutsideBuildHeight(trigger)) { + level.setBlock(trigger.below(), Blocks.STONE.defaultBlockState(), 2); + level.setBlock(trigger, Blocks.STONE_PRESSURE_PLATE.defaultBlockState(), 2); + } + } + + private static void placeContainer(WorldGenLevel level, BoundingBox bounds, BlockPos pos, BlockState state, + ResourceKey table, long seed) { + if (!bounds.isInside(pos) || level.isOutsideBuildHeight(pos) || level.getBlockEntity(pos) != null) { + return; + } + level.setBlock(pos, state, 2); + if (level.getBlockEntity(pos) instanceof RandomizableContainerBlockEntity container) { + container.setLootTable(table, seed); + } + } + + private static ResourceKey lootTable(String path) { + return ResourceKey.create(Registries.LOOT_TABLE, Identifier.fromNamespaceAndPath("retold", path)); + } +} diff --git a/src/main/java/cz/xefensor/retold/worldgen/earth/EarthLabyrinthRooms.java b/src/main/java/cz/xefensor/retold/worldgen/earth/EarthLabyrinthRooms.java new file mode 100644 index 00000000..b56558c2 --- /dev/null +++ b/src/main/java/cz/xefensor/retold/worldgen/earth/EarthLabyrinthRooms.java @@ -0,0 +1,78 @@ +package cz.xefensor.retold.worldgen.earth; + +import java.util.ArrayList; +import java.util.Comparator; +import java.util.List; + +/** Stable side-branch content selection, independent of topology and its saved random stream. */ +final class EarthLabyrinthRooms { + static final int CONTENT_VERSION = 1; + + private EarthLabyrinthRooms() { + } + + static List plan(EarthLabyrinthLayout layout, long seed) { + List result = new ArrayList<>(); + for (int level = 0; level < EarthLabyrinthLayout.LEVEL_COUNT; level++) { + List candidates = new ArrayList<>(); + for (EarthLabyrinthLayout.Cell cell : layout.cells()) { + if (cell.level() == level && eligible(layout, cell)) { + candidates.add(cell); + } + } + candidates.sort(Comparator.comparingLong((EarthLabyrinthLayout.Cell cell) -> roomSeed(seed, cell)) + .thenComparing(Comparator.naturalOrder())); + int count = 0; + for (EarthLabyrinthLayout.Cell cell : candidates) { + if (count >= 6) { + break; + } + if (result.stream().anyMatch(room -> distance(room.cell(), cell) <= 2)) { + continue; + } + EarthLabyrinthLayout.Cell mouth = layout.neighbors(cell).getFirst(); + result.add(new Room(cell, cell.x() - mouth.x(), cell.z() - mouth.z(), + count % 3 == 1 ? Kind.TREASURE : Kind.ARROW_TRAP, roomSeed(seed, cell))); + count++; + } + } + return List.copyOf(result); + } + + private static boolean eligible(EarthLabyrinthLayout layout, EarthLabyrinthLayout.Cell cell) { + if (layout.kindAt(cell) != EarthLabyrinthLayout.CellKind.PASSAGE + || layout.neighbors(cell).size() != 1 + || distance(cell, layout.entrance()) <= 2) { + return false; + } + EarthLabyrinthLayout.Cell guardian = layout.guardianChamber(); + if (cell.level() == guardian.level() + && Math.abs(cell.x() - guardian.x()) <= EarthLabyrinthDimensions.GUARDIAN_ARENA_CELL_RADIUS + 1 + && Math.abs(cell.z() - guardian.z()) <= EarthLabyrinthDimensions.GUARDIAN_ARENA_CELL_RADIUS + 1) { + return false; + } + return layout.cellKinds().entrySet().stream().noneMatch(entry -> + entry.getValue() == EarthLabyrinthLayout.CellKind.STAIR && distance(entry.getKey(), cell) <= 1); + } + + private static int distance(EarthLabyrinthLayout.Cell first, EarthLabyrinthLayout.Cell second) { + return first.level() == second.level() + ? Math.abs(first.x() - second.x()) + Math.abs(first.z() - second.z()) + : Integer.MAX_VALUE; + } + + private static long roomSeed(long seed, EarthLabyrinthLayout.Cell cell) { + long value = seed ^ (long) cell.x() * 0x9E3779B185EBCA87L + ^ (long) cell.z() * 0xC2B2AE3D27D4EB4FL ^ (long) cell.level() * 0x165667B19E3779F9L; + value = (value ^ value >>> 30) * 0xBF58476D1CE4E5B9L; + return (value ^ value >>> 27) * 0x94D049BB133111EBL; + } + + enum Kind { + ARROW_TRAP, + TREASURE + } + + record Room(EarthLabyrinthLayout.Cell cell, int backX, int backZ, Kind kind, long lootSeed) { + } +} diff --git a/src/main/java/cz/xefensor/retold/worldgen/earth/EarthLabyrinthSource.java b/src/main/java/cz/xefensor/retold/worldgen/earth/EarthLabyrinthSource.java new file mode 100644 index 00000000..a5607f16 --- /dev/null +++ b/src/main/java/cz/xefensor/retold/worldgen/earth/EarthLabyrinthSource.java @@ -0,0 +1,21 @@ +package cz.xefensor.retold.worldgen.earth; + +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.levelgen.structure.BoundingBox; +import net.minecraft.world.phys.AABB; + +record EarthLabyrinthSource(BlockPos guardianPosition, BoundingBox structureBounds) { + private static final double DUPLICATE_SEARCH_MARGIN = 8.0D; + + EarthLabyrinthSource { + guardianPosition = guardianPosition.immutable(); + } + + long key() { + return guardianPosition.asLong(); + } + + AABB duplicateSearchBounds() { + return AABB.of(structureBounds).inflate(DUPLICATE_SEARCH_MARGIN); + } +} diff --git a/src/main/java/cz/xefensor/retold/worldgen/earth/RetoldEarthCombatGameTests.java b/src/main/java/cz/xefensor/retold/worldgen/earth/RetoldEarthCombatGameTests.java new file mode 100644 index 00000000..0b1bc33f --- /dev/null +++ b/src/main/java/cz/xefensor/retold/worldgen/earth/RetoldEarthCombatGameTests.java @@ -0,0 +1,192 @@ +package cz.xefensor.retold.worldgen.earth; + +import cz.xefensor.retold.registry.RetoldEntityTypes; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Holder; +import net.minecraft.gametest.framework.BuiltinTestFunctions; +import net.minecraft.gametest.framework.FunctionGameTestInstance; +import net.minecraft.gametest.framework.GameTestHelper; +import net.minecraft.gametest.framework.TestData; +import net.minecraft.gametest.framework.TestEnvironmentDefinition; +import net.minecraft.network.Connection; +import net.minecraft.network.protocol.PacketFlow; +import net.minecraft.resources.Identifier; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.server.level.TicketType; +import net.minecraft.server.network.CommonListenerCookie; +import net.minecraft.server.network.ServerGamePacketListenerImpl; +import net.minecraft.util.ProblemReporter; +import net.minecraft.world.damagesource.DamageTypes; +import net.minecraft.world.entity.EntitySpawnReason; +import net.minecraft.world.entity.ai.attributes.Attributes; +import net.minecraft.world.level.ChunkPos; +import net.minecraft.world.level.GameType; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.gameevent.GameEvent; +import net.minecraft.world.level.gamerules.GameRules; +import net.minecraft.world.level.storage.TagValueInput; +import net.minecraft.world.level.storage.TagValueOutput; +import net.minecraft.world.phys.Vec3; +import net.neoforged.neoforge.event.RegisterGameTestsEvent; + +final class RetoldEarthCombatGameTests { + private RetoldEarthCombatGameTests() { + } + + static void register(RegisterGameTestsEvent event, Holder> environment) { + var data = new TestData<>(environment, Identifier.withDefaultNamespace("empty"), 200, 0, true); + event.registerTest(Identifier.fromNamespaceAndPath("retold", "earth_guardian_melee_respects_contact_and_cooldown"), + new FunctionGameTestInstance(BuiltinTestFunctions.ALWAYS_PASS, data) { + @Override + public void run(GameTestHelper helper) { + contactPolicy(helper); + } + }); + event.registerTest(Identifier.fromNamespaceAndPath("retold", "earth_guardian_pursues_during_hazards_and_melees"), + new FunctionGameTestInstance(BuiltinTestFunctions.ALWAYS_PASS, data) { + @Override + public void run(GameTestHelper helper) { + combinedCombat(helper); + } + }); + } + + private static ServerPlayer player(GameTestHelper helper, GameType mode, BlockPos pos) { + ServerPlayer player = (ServerPlayer) helper.makeMockServerPlayer(mode); + // Damage feedback needs a listener, but this fixture does not connect a real client. + player.connection = new ServerGamePacketListenerImpl(helper.getLevel().getServer(), + new Connection(PacketFlow.SERVERBOUND), player, + CommonListenerCookie.createInitial(player.getGameProfile(), false)); + player.connection.markClientLoaded(); + player.getAttribute(Attributes.MAX_HEALTH).setBaseValue(200.0D); + player.setHealth(200.0F); + player.setPos(Vec3.atBottomCenterOf(pos)); + return player; + } + + private static void clue(EarthGuardian guardian, ServerPlayer player) { + guardian.getVibrationUser().onReceiveVibration((net.minecraft.server.level.ServerLevel) guardian.level(), + player.blockPosition(), GameEvent.STEP, player, null, 1.0F); + } + + private static void contactPolicy(GameTestHelper helper) { + var level = helper.getLevel(); + BlockPos origin = helper.absolutePos(new BlockPos(8, 4, 8)); + var guardian = helper.spawn(RetoldEntityTypes.EARTH_GUARDIAN.get(), + 8.5D, 4.0D, 8.5D, EntitySpawnReason.COMMAND); + ServerPlayer survivor = player(helper, GameType.SURVIVAL, origin.east(2)); + ServerPlayer stranger = player(helper, GameType.SURVIVAL, origin.east(2)); + ServerPlayer creative = player(helper, GameType.CREATIVE, origin.east(2)); + ServerPlayer spectator = player(helper, GameType.SPECTATOR, origin.east(2)); + try { + survivor.setPos(guardian.position().add(1.7D, 0.0D, 0.0D)); + helper.assertFalse(guardian.doHurtTarget(level, survivor), "An unheard player must not grant melee targeting"); + clue(guardian, survivor); + helper.assertFalse(guardian.doHurtTarget(level, stranger), "Melee must remain tied to the heard player"); + helper.assertFalse(guardian.doHurtTarget(level, creative), "Creative players must remain excluded"); + helper.assertFalse(guardian.doHurtTarget(level, spectator), "Spectators must remain excluded"); + survivor.setPos(guardian.position().add(8.0D, 0.0D, 0.0D)); + helper.assertFalse(guardian.doHurtTarget(level, survivor), "Melee must not hit a distant heard player"); + survivor.setPos(guardian.position().add(1.7D, 0.0D, 0.0D)); + for (int y = 0; y <= 4; y++) { + level.setBlock(origin.east().above(y), Blocks.STONE.defaultBlockState(), 2); + } + helper.assertFalse(guardian.doHurtTarget(level, survivor), "A fresh wall must stop a contact strike"); + for (int y = 0; y <= 4; y++) { + level.setBlock(origin.east().above(y), Blocks.AIR.defaultBlockState(), 2); + } + helper.assertTrue(guardian.isWithinMeleeAttackRange(survivor), "Fixture player must be within vanilla melee reach"); + helper.assertTrue(guardian.hasLineOfSight(survivor), "Fixture wall must be completely removed"); + helper.assertTrue(guardian.doHurtTarget(level, survivor), "An unobstructed heard player in reach must take a golem strike" + + "; player invulnerable=" + survivor.isInvulnerableTo(level, guardian.damageSources().mobAttack(guardian)) + + ", source=" + guardian.vibrationSourcePlayer() + ", player=" + survivor.getUUID()); + helper.assertTrue(survivor.getHealth() < 200.0F, "Melee must deal real damage"); + helper.assertFalse(guardian.doHurtTarget(level, survivor), "Repeated calls must respect the cooldown"); + var saved = TagValueOutput.createWithContext(ProblemReporter.DISCARDING, level.registryAccess()); + guardian.addAdditionalSaveData(saved); + helper.assertValueEqual(saved.buildResult().getIntOr("retold_melee_cooldown", -1), 30, "Melee cooldown must persist"); + guardian.readAdditionalSaveData(TagValueInput.create(ProblemReporter.DISCARDING, level.registryAccess(), saved.buildResult())); + helper.assertFalse(guardian.doHurtTarget(level, survivor), "Reload must not allow an immediate second strike"); + helper.assertTrue(guardian.getTarget() == null, "Contact combat must not assign a live sight target"); + var dormant = saved.buildResult(); + dormant.putInt("retold_melee_cooldown", 0); + dormant.putInt("retold_lifecycle", EarthGuardianLifecycle.DORMANT.ordinal()); + guardian.readAdditionalSaveData(TagValueInput.create(ProblemReporter.DISCARDING, level.registryAccess(), dormant)); + helper.assertFalse(guardian.doHurtTarget(level, survivor), "A dormant guardian must not attack even with a saved clue"); + helper.succeed(); + } finally { + guardian.discard(); + survivor.discard(); + stranger.discard(); + creative.discard(); + spectator.discard(); + } + } + + private static void combinedCombat(GameTestHelper helper) { + var level = helper.getLevel(); + BlockPos origin = helper.absolutePos(new BlockPos(8, 4, 8)); + ChunkPos ticket = new ChunkPos(origin.getX() >> 4, origin.getZ() >> 4); + level.getChunkSource().addTicketWithRadius(TicketType.FORCED, ticket, 4); + boolean oldGriefing = level.getGameRules().get(GameRules.MOB_GRIEFING); + level.getGameRules().set(GameRules.MOB_GRIEFING, true, level.getServer()); + for (int x = -3; x <= 18; x++) { + for (int z = -4; z <= 4; z++) { + for (int y = -1; y <= 6; y++) { + level.setBlock(origin.offset(x, y, z), y == -1 + ? Blocks.STONE.defaultBlockState() : Blocks.AIR.defaultBlockState(), 2); + } + } + } + var guardian = helper.spawn(RetoldEntityTypes.EARTH_GUARDIAN.get(), + 8.5D, 4.0D, 8.5D, EntitySpawnReason.COMMAND); + BlockPos destination = origin.east(10); + BlockPos ceiling = destination.above(4); + level.setBlock(ceiling, Blocks.STONE.defaultBlockState(), 2); + ServerPlayer survivor = player(helper, GameType.SURVIVAL, destination); + level.addFreshEntity(survivor); + guardian.setNoAi(true); + int[] warningStartTick = {0}; + double[] initialX = {guardian.getX()}; + helper.startSequence() + // Chunk preparation can advance GameTest time without ticking the entity. + .thenWaitUntil(() -> helper.assertTrue(guardian.tickCount >= 40, "Wait for loaded entity-ticking terrain")) + .thenExecute(() -> guardian.setNoAi(false)) + .thenWaitUntil(() -> helper.assertTrue(guardian.getNavigation().createPath(destination, 0) != null, + "Fixture destination must have a navigable floor; pos=" + guardian.position() + + ", floor=" + level.getBlockState(guardian.blockPosition().below()) + + ", onGround=" + guardian.onGround())) + .thenExecute(() -> { + clue(guardian, survivor); + guardian.tickEnvironmentalCombat(level); + helper.assertTrue(guardian.isPreparingEnvironmentalAttack(), "The combined encounter must start a real hazard warning"); + warningStartTick[0] = guardian.tickCount; + initialX[0] = guardian.getX(); + }) + .thenWaitUntil(() -> helper.assertTrue(guardian.tickCount >= warningStartTick[0] + 20, "Wait for actual warning ticks")) + .thenExecute(() -> { + helper.assertTrue(guardian.isPreparingEnvironmentalAttack(), "The hazard must still be warning"); + helper.assertTrue(guardian.getX() > initialX[0] + 1.0D, "The guardian must advance during its hazard warning" + + "; x=" + guardian.getX() + ", start=" + initialX[0] + ", ticks=" + guardian.tickCount + + ", path=" + guardian.getNavigation().getPath() + ", clue=" + guardian.vibrationTarget() + + ", pos=" + guardian.position() + ", noAi=" + guardian.isNoAi() + + ", route=" + guardian.routeDescription() + + ", owner=" + cz.xefensor.retold.behavior.control.RetoldAiControl.getOwner(guardian)); + }) + .thenWaitUntil(() -> helper.assertTrue( + survivor.getLastDamageSource() != null && survivor.getLastDamageSource().is(DamageTypes.MOB_ATTACK) + && survivor.getLastDamageSource().getEntity() == guardian, + "Pursuit must close into an automatic melee strike; pos=" + guardian.position() + + ", clue=" + guardian.vibrationTarget() + ", health=" + survivor.getHealth())) + .thenExecute(() -> { + helper.assertTrue(level.getBlockState(ceiling).isAir(), "The environmental ceiling attack must also release"); + helper.assertTrue(guardian.getTarget() == null, "Combined attacks must not grant sight tracking"); + level.players().remove(survivor); + survivor.discard(); + guardian.discard(); + level.getGameRules().set(GameRules.MOB_GRIEFING, oldGriefing, level.getServer()); + level.getChunkSource().removeTicketWithRadius(TicketType.FORCED, ticket, 4); + }) + .thenSucceed(); + } +} diff --git a/src/main/java/cz/xefensor/retold/worldgen/earth/RetoldEarthLabyrinthGameTests.java b/src/main/java/cz/xefensor/retold/worldgen/earth/RetoldEarthLabyrinthGameTests.java new file mode 100644 index 00000000..c15d0ac1 --- /dev/null +++ b/src/main/java/cz/xefensor/retold/worldgen/earth/RetoldEarthLabyrinthGameTests.java @@ -0,0 +1,1951 @@ +package cz.xefensor.retold.worldgen.earth; + +import cz.xefensor.retold.api.world.RetoldWorldMutationType; +import cz.xefensor.retold.api.world.RetoldWorldProtection; +import cz.xefensor.retold.behavior.control.RetoldAiControl; +import cz.xefensor.retold.behavior.control.RetoldAiControlOwner; +import cz.xefensor.retold.registry.RetoldBlocks; +import cz.xefensor.retold.registry.RetoldEntityTypes; +import cz.xefensor.retold.stage.RetoldWorldData; +import cz.xefensor.retold.stage.RetoldWorldStage; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.core.Holder; +import net.minecraft.core.Registry; +import net.minecraft.core.registries.Registries; +import net.minecraft.gametest.framework.BuiltinTestFunctions; +import net.minecraft.gametest.framework.FunctionGameTestInstance; +import net.minecraft.gametest.framework.GameTestHelper; +import net.minecraft.gametest.framework.TestData; +import net.minecraft.gametest.framework.TestEnvironmentDefinition; +import net.minecraft.nbt.ListTag; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.resources.Identifier; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.server.level.TicketType; +import net.minecraft.util.ProblemReporter; +import net.minecraft.util.RandomSource; +import net.minecraft.world.damagesource.DamageTypes; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntitySpawnReason; +import net.minecraft.world.entity.EntityTypes; +import net.minecraft.world.entity.item.FallingBlockEntity; +import net.minecraft.world.entity.monster.zombie.Zombie; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.SpawnEggItem; +import net.minecraft.world.level.ChunkPos; +import net.minecraft.world.level.GameType; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.gamerules.GameRules; +import net.minecraft.world.level.levelgen.structure.BoundingBox; +import net.minecraft.world.level.levelgen.structure.BuiltinStructures; +import net.minecraft.world.level.levelgen.structure.Structure; +import net.minecraft.world.level.levelgen.structure.StructurePiece; +import net.minecraft.world.level.levelgen.structure.pieces.PiecesContainer; +import net.minecraft.world.level.levelgen.structure.pieces.StructurePieceSerializationContext; +import net.minecraft.world.level.levelgen.structure.structures.JungleTemplePiece; +import net.minecraft.world.level.storage.TagValueInput; +import net.minecraft.world.level.storage.TagValueOutput; +import net.neoforged.neoforge.event.RegisterGameTestsEvent; + +import java.util.List; +import java.util.function.Consumer; + +public final class RetoldEarthLabyrinthGameTests { + private static final Identifier EMPTY_STRUCTURE = + Identifier.withDefaultNamespace("empty"); + + private RetoldEarthLabyrinthGameTests() { + } + + public static void register( + RegisterGameTestsEvent event, + Holder> environment + ) { + TestData>> testData = + new TestData<>(environment, EMPTY_STRUCTURE, 40, 0, true); + TestData>> environmentalTickTestData = + new TestData<>(environment, EMPTY_STRUCTURE, 100, 0, true); + TestData>> patrolTickTestData = + new TestData<>(environment, EMPTY_STRUCTURE, 240, 0, true); + RetoldEarthRoomGameTests.register(event, environmentalTickTestData); + RetoldEarthTraversalGameTests.register(event, environment); + RetoldEarthCombatGameTests.register(event, environment); + RetoldEarthTerrainGameTests.register(event, environment); + RetoldEarthMazePursuitGameTests.register(event, environment); + + register( + event, + testData, + "jungle_pyramids_use_earth_labyrinth_structure", + RetoldEarthLabyrinthGameTests::junglePyramidsUseEarthLabyrinthStructure + ); + register( + event, + testData, + "earth_labyrinth_pieces_round_trip_without_upgrading_old_pyramids", + RetoldEarthLabyrinthGameTests::earthLabyrinthPiecesRoundTrip + ); + register( + event, + testData, + "earth_labyrinth_staircase_leaves_puzzle_room_safely", + RetoldEarthLabyrinthGameTests::earthLabyrinthStaircaseLeavesPuzzleRoom + ); + register( + event, + testData, + "earth_labyrinth_piece_places_connected_maze_geometry", + RetoldEarthLabyrinthGameTests::earthLabyrinthPiecePlacesGeometry + ); + register( + event, + testData, + "earth_guardian_foundation_spawns_and_persists_lifecycle", + RetoldEarthLabyrinthGameTests::earthGuardianFoundationSpawnsAndPersistsLifecycle + ); + register( + event, + testData, + "earth_guardian_tracks_weighted_vibrations_without_sight", + RetoldEarthLabyrinthGameTests::earthGuardianTracksWeightedVibrationsWithoutSight + ); + register( + event, + testData, + "earth_guardian_uses_environmental_attacks", + RetoldEarthLabyrinthGameTests::earthGuardianUsesEnvironmentalAttacks + ); + register( + event, + environmentalTickTestData, + "earth_guardian_ceiling_debris_hits_on_server_ticks", + RetoldEarthLabyrinthGameTests::earthGuardianCeilingDebrisHitsOnServerTicks + ); + register( + event, + environmentalTickTestData, + "earth_guardian_lava_ground_burns_on_server_ticks", + RetoldEarthLabyrinthGameTests::earthGuardianLavaGroundBurnsOnServerTicks + ); + register( + event, + environmentalTickTestData, + "earth_guardian_floor_collapse_causes_real_fall", + RetoldEarthLabyrinthGameTests::earthGuardianFloorCollapseCausesRealFall + ); + register( + event, + environmentalTickTestData, + "earth_guardian_physically_investigates_vibrations", + RetoldEarthLabyrinthGameTests::earthGuardianPhysicallyInvestigatesVibrations + ); + register( + event, + patrolTickTestData, + "earth_guardian_physically_patrols_maze", + RetoldEarthLabyrinthGameTests::earthGuardianPhysicallyPatrolsMaze + ); + register( + event, + testData, + "earth_guardian_relocates_any_loaded_block", + RetoldEarthLabyrinthGameTests::earthGuardianRelocatesAnyLoadedBlock + ); + } + + private static void junglePyramidsUseEarthLabyrinthStructure(GameTestHelper helper) { + Registry structures = helper.getLevel() + .registryAccess() + .lookupOrThrow(Registries.STRUCTURE); + Structure junglePyramid = structures.getValueOrThrow(BuiltinStructures.JUNGLE_TEMPLE); + + helper.assertTrue( + junglePyramid instanceof EarthJungleTempleStructure, + "New Jungle Pyramid starts must use the Retold composite structure" + ); + helper.assertTrue( + junglePyramid.biomes().isBound() && junglePyramid.biomes().size() > 0, + "The replacement must retain the vanilla Jungle Pyramid biome boundary" + ); + helper.succeed(); + } + + private static void earthLabyrinthPiecesRoundTrip(GameTestHelper helper) { + StructurePieceSerializationContext context = + StructurePieceSerializationContext.fromLevel(helper.getLevel()); + EarthJungleTemplePiece temple = new EarthJungleTemplePiece( + RandomSource.create(19L), + 0, + 0 + ); + temple.moveToGround(80); + EarthLabyrinthPiece labyrinth = new EarthLabyrinthPiece( + temple.getBoundingBox().getCenter().getX(), + temple.getBoundingBox().getCenter().getZ(), + 80, + temple.labyrinthConnectionPosition(), + temple.labyrinthEgressDirection(), + 0x4E415A45L + ); + PiecesContainer loadedNewPieces = roundTrip( + context, + new PiecesContainer(List.of(temple, labyrinth)) + ); + + helper.assertValueEqual(loadedNewPieces.pieces().size(), 2, "New composite piece count"); + helper.assertTrue( + loadedNewPieces.pieces().get(0) instanceof EarthJungleTemplePiece, + "The grounded Retold temple wrapper must survive structure serialization" + ); + helper.assertTrue( + loadedNewPieces.pieces().get(1) instanceof EarthLabyrinthPiece loadedLabyrinth + && loadedLabyrinth.layoutSeed() == labyrinth.layoutSeed(), + "The labyrinth topology seed must survive structure serialization" + ); + + JungleTemplePiece oldTemple = new JungleTemplePiece(RandomSource.create(23L), 32, 32); + CompoundTag savedLabyrinth = labyrinth.createTag(context); + helper.assertValueEqual(savedLabyrinth.getIntOr("ContentVersion", -1), 1, + "New starts must persist room-content version"); + savedLabyrinth.remove("ContentVersion"); + CompoundTag legacyLabyrinth = new EarthLabyrinthPiece(savedLabyrinth).createTag(context); + helper.assertValueEqual(legacyLabyrinth.getIntOr("ContentVersion", -1), 0, + "Older partially generated starts must retain empty-room content"); + PiecesContainer loadedOldPieces = roundTrip( + context, + new PiecesContainer(List.of(oldTemple)) + ); + StructurePiece loadedOldPiece = loadedOldPieces.pieces().getFirst(); + + helper.assertTrue( + loadedOldPiece.getClass() == JungleTemplePiece.class, + "A saved vanilla pyramid piece must remain vanilla and gain no labyrinth piece" + ); + helper.succeed(); + } + + private static void earthLabyrinthStaircaseLeavesPuzzleRoom(GameTestHelper helper) { + BlockPos connection = new BlockPos(0, 80, 0); + BlockPos entrance = new BlockPos(0, 20, -20); + BlockPos staircaseStart = EarthLabyrinthGenerator.entranceStaircaseStart(connection); + helper.assertValueEqual( + staircaseStart, + connection.below(EarthLabyrinthDimensions.ENTRANCE_SHAFT_DEPTH), + "Staircase must start beneath the puzzle-clearance ladder shaft" + ); + for (Direction egress : List.of( + Direction.NORTH, + Direction.EAST, + Direction.SOUTH, + Direction.WEST + )) { + List path = EarthLabyrinthGenerator.entrancePath( + staircaseStart, + egress, + entrance + ); + + helper.assertValueEqual(path.getFirst(), staircaseStart, "Staircase start"); + helper.assertValueEqual( + path.get(1), + staircaseStart.relative(egress).below(), + "First safe egress step" + ); + helper.assertValueEqual( + path.get(2), + staircaseStart.relative(egress, 2).below(2), + "Second safe egress step" + ); + helper.assertValueEqual( + path.get(3), + staircaseStart.relative(egress, 3).below(3), + "Third safe egress step" + ); + helper.assertValueEqual(path.getLast(), entrance, "Maze entrance destination"); + helper.assertValueEqual(path.size(), 53, "Deep switchback path length"); + helper.assertTrue( + path.stream().allMatch(node -> node.getY() + 4 < connection.getY()), + "Staircase shell must remain below every vanilla puzzle component" + ); + + for (int index = 1; index < path.size(); index++) { + BlockPos previous = path.get(index - 1); + BlockPos current = path.get(index); + int horizontalDistance = Math.abs(current.getX() - previous.getX()) + + Math.abs(current.getZ() - previous.getZ()); + int verticalDrop = previous.getY() - current.getY(); + + helper.assertValueEqual(horizontalDistance, 1, "Horizontal staircase step"); + helper.assertTrue( + verticalDrop == 0 || verticalDrop == 1, + "The staircase must descend by at most one block per horizontal step" + ); + } + + helper.assertValueEqual( + path.stream().distinct().count(), + (long) path.size(), + "The deep staircase must not double back through an existing step" + ); + } + + helper.succeed(); + } + + private static void earthLabyrinthPiecePlacesGeometry(GameTestHelper helper) { + BlockPos testCenter = helper.absolutePos(new BlockPos(96, 96, 96)); + int pyramidBaseY = testCenter.getY(); + long layoutSeed = 0x4C41425952494E54L; + EarthLabyrinthLayout layout = EarthLabyrinthPlanner.generate(layoutSeed); + int width = layout.footprintWidthBlocks(); + int minX = testCenter.getX() - width / 2; + int minZ = testCenter.getZ() - width / 2; + long offsetJunctions = layout.cells() + .stream() + .filter(cell -> { + BlockPos actual = cellCenter( + layout, + cell, + testCenter, + pyramidBaseY, + layoutSeed + ); + int regularX = minX + 2 + + cell.x() * EarthLabyrinthLayout.CELL_PITCH_BLOCKS; + int regularZ = minZ + 2 + + cell.z() * EarthLabyrinthLayout.CELL_PITCH_BLOCKS; + return actual.getX() != regularX || actual.getZ() != regularZ; + }) + .count(); + long bentTunnels = layout.passages() + .stream() + .filter(passage -> !passage.isVertical()) + .map(passage -> EarthLabyrinthGenerator.tunnelPath( + layout, + passage, + testCenter.getX(), + testCenter.getZ(), + pyramidBaseY, + layoutSeed + )) + .filter(RetoldEarthLabyrinthGameTests::hasTunnelTurn) + .count(); + helper.assertTrue(offsetJunctions > 0L, "Cave junctions must break the logical grid"); + helper.assertTrue(bentTunnels > 0L, "Cave tunnels must include natural-looking bends"); + BlockPos connection = new BlockPos( + testCenter.getX(), + pyramidBaseY + EarthLabyrinthDimensions.CONNECTION_LOCAL_Y, + testCenter.getZ() + ); + BoundingBox fullBounds = new BoundingBox( + minX, + EarthLabyrinthDimensions.floorY(pyramidBaseY, 1), + minZ, + minX + width - 1, + connection.getY() + 3, + minZ + width - 1 + ); + + EarthLabyrinthGenerator.generate( + helper.getLevel(), + fullBounds, + testCenter.getX(), + testCenter.getZ(), + pyramidBaseY, + connection, + Direction.EAST, + layoutSeed + ); + + BlockPos entranceCenter = cellCenter( + layout, + layout.entrance(), + testCenter, + pyramidBaseY, + layoutSeed + ); + for (var room : EarthLabyrinthRooms.plan(layout, layoutSeed)) { + BlockPos floor = cellCenter(layout, room.cell(), testCenter, pyramidBaseY, layoutSeed); + int distance = room.kind() == EarthLabyrinthRooms.Kind.TREASURE ? 1 : 2; + BlockPos container = floor.offset(room.backX() * distance, 1, room.backZ() * distance); + helper.assertTrue(helper.getLevel().getBlockEntity(container) + instanceof net.minecraft.world.level.block.entity.RandomizableContainerBlockEntity, + "Every selected room must contain its initialized loot container"); + helper.assertTrue(helper.getLevel().getBlockState(floor.above(2)).isAir(), + "Side-room contents must preserve the central walking route"); + } + helper.assertTrue( + isMazeStone(helper, entranceCenter) + || helper.getLevel().getBlockState(entranceCenter) + .is(Blocks.MOSSY_COBBLESTONE_STAIRS), + "The entrance chamber must retain a walkable maze-owned floor" + ); + helper.assertTrue( + helper.getLevel().getBlockState(entranceCenter.above(2)).is(Blocks.CAVE_AIR), + "Every chamber must retain a three-block-high interior" + ); + + BlockPos guardianCenter = cellCenter( + layout, + layout.guardianChamber(), + testCenter, + pyramidBaseY, + layoutSeed + ); + for (Direction direction : Direction.Plane.HORIZONTAL) { + helper.assertTrue( + helper.getLevel().getBlockState( + guardianCenter.relative(direction, 15).above(5) + ).is(Blocks.CAVE_AIR), + "The central guardian arena must remain at least 31 blocks wide" + ); + } + helper.assertTrue( + helper.getLevel().getBlockState(guardianCenter.above(10)).is(Blocks.CAVE_AIR), + "The central guardian arena must provide ten blocks of headroom" + ); + helper.assertTrue( + isMazeStone(helper, guardianCenter.above(11)), + "The huge guardian arena must retain a maze-owned ceiling" + ); + + EarthLabyrinthLayout.Passage horizontal = layout.passages() + .stream() + .filter(passage -> !passage.isVertical()) + .findFirst() + .orElseThrow(); + List tunnelPath = EarthLabyrinthGenerator.tunnelPath( + layout, + horizontal, + testCenter.getX(), + testCenter.getZ(), + pyramidBaseY, + layoutSeed + ); + int tunnelIndex = tunnelPath.size() / 2; + BlockPos tunnelCenter = tunnelPath.get(tunnelIndex); + BlockPos doorway = tunnelCenter.above(2); + helper.assertTrue( + helper.getLevel().getBlockState(doorway).is(Blocks.CAVE_AIR), + "Planned horizontal passages must carve a continuous cave tunnel" + ); + boolean hasNaturalTunnelShell = layout.passages() + .stream() + .filter(passage -> !passage.isVertical()) + .flatMap(passage -> EarthLabyrinthGenerator.tunnelPath( + layout, + passage, + testCenter.getX(), + testCenter.getZ(), + pyramidBaseY, + layoutSeed + ).stream()) + .anyMatch(center -> helper.getLevel().getBlockState(center.above(2)) + .is(Blocks.CAVE_AIR) + && isMazeStone(helper, center.above(4))); + helper.assertTrue( + hasNaturalTunnelShell, + "Carved tunnels must retain natural maze-owned stone ceilings" + ); + + long ladderCount = layout.passages() + .stream() + .filter(EarthLabyrinthLayout.Passage::isVertical) + .filter(passage -> hasGeneratedLadder( + helper, + passage, + layout, + testCenter, + pyramidBaseY, + layoutSeed + )) + .count(); + helper.assertTrue( + ladderCount >= 1L, + "At least one planned vertical connection must remain physically climbable" + ); + helper.assertTrue( + helper.getLevel().getBlockState(connection.above()).isAir(), + "The hidden puzzle room floor opening must lead into the staircase" + ); + helper.assertTrue( + helper.getLevel().getBlockState(connection).is(Blocks.LADDER), + "The puzzle-room opening must enter a narrow ladder shaft" + ); + helper.assertTrue( + helper.getLevel().getBlockState( + connection.below(EarthLabyrinthDimensions.ENTRANCE_SHAFT_DEPTH) + ).is(Blocks.LADDER), + "The ladder shaft must reach the safely lowered staircase start" + ); + helper.assertTrue( + isMazeStone(helper, connection.west()), + "The entrance ladder must retain a supporting wall away from its east exit" + ); + helper.succeed(); + } + + private static void earthGuardianFoundationSpawnsAndPersistsLifecycle( + GameTestHelper helper + ) { + ServerLevel level = helper.getLevel(); + RetoldWorldData worldData = RetoldWorldData.get(level); + RetoldWorldStage originalStage = worldData.getStage(); + BlockPos guardianPosition = helper.absolutePos(new BlockPos(4, 3, 4)); + EarthLabyrinthSource source = new EarthLabyrinthSource( + guardianPosition, + new BoundingBox( + guardianPosition.getX() - 24, + guardianPosition.getY() - 8, + guardianPosition.getZ() - 24, + guardianPosition.getX() + 24, + guardianPosition.getY() + 72, + guardianPosition.getZ() + 24 + ) + ); + EarthGuardianEncounterData encounterData = EarthGuardianEncounterData.get(level); + ServerPlayer player = null; + EarthGuardian restored = null; + + try { + encounterData.setLifecycle(source.key(), EarthGuardianLifecycle.DORMANT); + worldData.setStage(RetoldWorldStage.STAGE_1); + helper.assertTrue( + EarthGuardianSpawner.spawnIfNeeded(level, source), + "A loaded labyrinth must create its dormant guardian" + ); + EarthGuardian guardian = findStructureGuardians(level, source).getFirst(); + helper.assertTrue(guardian.isPersistenceRequired(), "The guardian must persist"); + helper.assertValueEqual( + guardian.lifecycle(), + EarthGuardianLifecycle.DORMANT, + "Initial guardian lifecycle" + ); + helper.assertTrue(guardian.isNoAi(), "The Stage 1 statue must have no AI"); + helper.assertTrue(guardian.isInvulnerable(), "The Stage 1 statue must be invulnerable"); + helper.assertFalse( + guardian.isBossBarVisible(), + "The dormant statue must not expose a boss bar" + ); + helper.assertFalse( + guardian.canUsePortal(false), + "A labyrinth guardian must not leave through a portal" + ); + helper.assertFalse( + guardian.hurtServer(level, level.damageSources().generic(), 20.0F), + "The dormant statue must not take damage before awakening" + ); + guardian.setPos(guardian.position().add(4.0D, 1.0D, 0.0D)); + helper.assertTrue( + EarthGuardianSpawner.spawnIfNeeded(level, source), + "A repeated source scan must repair rather than duplicate the guardian" + ); + helper.assertValueEqual( + guardian.position(), + net.minecraft.world.phys.Vec3.atBottomCenterOf(guardianPosition), + "A displaced dormant statue must still return to its chamber anchor" + ); + helper.assertValueEqual( + findStructureGuardians(level, source).size(), + 1, + "Guardian count after a repeated source scan" + ); + helper.assertTrue( + SpawnEggItem.spawnsEntity( + new ItemStack(RetoldBlocks.EARTH_GUARDIAN_SPAWN_EGG.get()), + RetoldEntityTypes.EARTH_GUARDIAN.get() + ), + "The Earth Guardian spawn egg must map to the guardian entity" + ); + + player = (ServerPlayer) helper.makeMockServerPlayer(GameType.SURVIVAL); + level.players().add(player); + player.snapTo( + guardianPosition.getX() + 0.5D, + guardianPosition.getY(), + guardianPosition.getZ() + 0.5D, + 0.0F, + 0.0F + ); + guardian.tickGuardianState(level); + helper.assertValueEqual( + guardian.lifecycle(), + EarthGuardianLifecycle.DORMANT, + "A chamber visit before Stage 2 must not wake the statue" + ); + + worldData.setStage(RetoldWorldStage.STAGE_2); + guardian.tickGuardianState(level); + helper.assertValueEqual( + guardian.lifecycle(), + EarthGuardianLifecycle.AWAKENING, + "A Stage 2 chamber visit must begin awakening" + ); + helper.assertTrue( + guardian.isBossBarVisible(), + "The awakening guardian must reveal its boss bar" + ); + helper.assertValueEqual( + encounterData.lifecycle(source.key()), + EarthGuardianLifecycle.AWAKENING, + "Awakening must update authoritative encounter state" + ); + helper.assertValueEqual(guardian.awakeningProgress(0.0F), 0.0F, + "The synchronized pose must begin at the dormant endpoint"); + + for (int tick = 0; tick < EarthGuardian.AWAKENING_DURATION_TICKS; tick++) { + if (tick % 20 == 0) { + EarthGuardianSpawner.spawnIfNeeded(level, source); + } + guardian.tickGuardianState(level); + if (tick == EarthGuardian.AWAKENING_DURATION_TICKS / 2 - 1) { + helper.assertValueEqual(guardian.awakeningProgress(0.0F), 0.5F, + "The synchronized pose must track the authoritative countdown"); + helper.assertTrue(guardian.awakeningProgress(0.5F) > 0.5F + && guardian.awakeningProgress(0.5F) < 0.52F, + "The awakening pose must interpolate between server ticks"); + restored = RetoldEntityTypes.EARTH_GUARDIAN.get().create(level, EntitySpawnReason.LOAD); + helper.assertTrue(restored != null, "An awakening guardian must be reloadable"); + restored.readAdditionalSaveData(TagValueInput.create( + ProblemReporter.DISCARDING, level.registryAccess(), saveAdditionalState(level, guardian) + )); + helper.assertValueEqual(restored.awakeningProgress(0.0F), 0.5F, + "Restoring an awakening guardian must retain its synchronized pose"); + restored.configureForLabyrinth(level, source, EarthGuardianLifecycle.AWAKENING); + helper.assertValueEqual(restored.awakeningProgress(0.0F), 0.5F, + "Encounter rebinding must not restart the awakening pose"); + restored.discard(); + restored = null; + } + } + + helper.assertValueEqual( + guardian.lifecycle(), + EarthGuardianLifecycle.ROAMING, + "The awakening timer must reach the future roaming state" + ); + helper.assertValueEqual(guardian.awakeningProgress(0.0F), 1.0F, + "The synchronized pose must reach the roaming endpoint"); + helper.assertTrue( + !guardian.isNoAi() && !guardian.isInvulnerable(), + "Roaming must enable investigation and make the awakened boss damageable" + ); + helper.assertValueEqual( + encounterData.lifecycle(source.key()), + EarthGuardianLifecycle.ROAMING, + "Roaming must persist in authoritative encounter state" + ); + + net.minecraft.world.phys.Vec3 roamingPosition = guardian.position().add(10.0D, 2.0D, 6.0D); + net.minecraft.world.phys.Vec3 roamingVelocity = new net.minecraft.world.phys.Vec3(0.1D, -0.2D, 0.15D); + guardian.setPos(roamingPosition); + guardian.setDeltaMovement(roamingVelocity); + guardian.setYRot(75.0F); + guardian.setHealth(200.0F); + guardian.getVibrationUser().onReceiveVibration( + level, + guardianPosition, + net.minecraft.world.level.gameevent.GameEvent.STEP, + player, + null, + 12.0F + ); + CompoundTag beforeRepair = saveAdditionalState(level, guardian); + + for (int scan = 0; scan < 4; scan++) { + helper.assertTrue(EarthGuardianSpawner.spawnIfNeeded(level, source), "Roaming source repair"); + helper.assertValueEqual(guardian.position(), roamingPosition, "Repair must not teleport a roaming guardian"); + helper.assertValueEqual(guardian.getDeltaMovement(), roamingVelocity, "Repair must retain roaming velocity"); + helper.assertValueEqual(guardian.getYRot(), 75.0F, "Repair must retain facing"); + helper.assertValueEqual(saveAdditionalState(level, guardian), beforeRepair, "Repair must retain entity state and clue"); + helper.assertValueEqual(findStructureGuardians(level, source).getFirst(), guardian, "Repair must retain the same guardian"); + guardian.tickGuardianState(level); + helper.assertValueEqual(guardian.position(), roamingPosition, "Roaming lifecycle ticks must not restore the statue anchor"); + } + + CompoundTag saved = saveAdditionalState(level, guardian); + restored = RetoldEntityTypes.EARTH_GUARDIAN.get().create( + level, + EntitySpawnReason.LOAD + ); + helper.assertTrue(restored != null, "A restored guardian entity must be creatable"); + restored.readAdditionalSaveData(TagValueInput.create( + ProblemReporter.DISCARDING, + level.registryAccess(), + saved + )); + helper.assertValueEqual( + restored.lifecycle(), + EarthGuardianLifecycle.ROAMING, + "Entity serialization must preserve the lifecycle" + ); + helper.assertTrue( + restored.isStructureBound() + && restored.labyrinthKey() == source.key(), + "Entity serialization must preserve labyrinth ownership" + ); + restored.setPos(roamingPosition); + restored.configureForLabyrinth(level, source, EarthGuardianLifecycle.ROAMING); + helper.assertValueEqual(restored.position(), roamingPosition, "Rebinding a loaded roaming guardian must retain its position"); + + encounterData.setLifecycle(source.key(), EarthGuardianLifecycle.DEFEATED); + helper.assertTrue( + EarthGuardianSpawner.spawnIfNeeded(level, source), + "A defeated encounter must be handled without respawning" + ); + helper.assertTrue( + findStructureGuardians(level, source).isEmpty(), + "A defeated labyrinth must remain permanently cleared" + ); + helper.succeed(); + } finally { + if (player != null) { + level.players().remove(player); + player.discard(); + } + + if (restored != null) { + restored.discard(); + } + + findStructureGuardians(level, source).forEach(Entity::discard); + encounterData.setLifecycle(source.key(), EarthGuardianLifecycle.DORMANT); + worldData.setStage(originalStage); + } + } + + private static void earthGuardianTracksWeightedVibrationsWithoutSight( + GameTestHelper helper + ) { + ServerLevel level = helper.getLevel(); + BlockPos guardianPosition = helper.absolutePos(new BlockPos(4, 3, 4)); + EarthLabyrinthSource source = new EarthLabyrinthSource( + guardianPosition, + new BoundingBox( + guardianPosition.getX() - 32, + guardianPosition.getY() - 8, + guardianPosition.getZ() - 32, + guardianPosition.getX() + 32, + guardianPosition.getY() + 72, + guardianPosition.getZ() + 32 + ) + ); + EarthGuardianEncounterData encounterData = EarthGuardianEncounterData.get(level); + ServerPlayer walker = null; + ServerPlayer explosivePlayer = null; + EarthGuardian restored = null; + + try { + encounterData.setLifecycle(source.key(), EarthGuardianLifecycle.ROAMING); + helper.assertTrue( + EarthGuardianSpawner.spawnIfNeeded(level, source), + "The vibration fixture must create its roaming guardian" + ); + EarthGuardian guardian = findStructureGuardians(level, source).getFirst(); + helper.assertFalse(guardian.isNoAi(), "A roaming guardian must run investigation AI"); + helper.assertFalse( + guardian.isInvulnerable(), + "The awakened guardian must be damageable during environmental combat" + ); + helper.assertTrue(guardian.getTarget() == null, "The blind guardian must start untargeted"); + + walker = (ServerPlayer) helper.makeMockServerPlayer(GameType.SURVIVAL); + explosivePlayer = (ServerPlayer) helper.makeMockServerPlayer(GameType.SURVIVAL); + BlockPos walkingClue = guardianPosition.offset(12, 0, 0); + BlockPos explosionClue = guardianPosition.offset(0, 0, 10); + walker.snapTo( + walkingClue.getX() + 0.5D, + walkingClue.getY(), + walkingClue.getZ() + 0.5D, + 0.0F, + 0.0F + ); + explosivePlayer.snapTo( + explosionClue.getX() + 0.5D, + explosionClue.getY(), + explosionClue.getZ() + 0.5D, + 0.0F, + 0.0F + ); + + helper.assertTrue( + guardian.getVibrationUser().canReceiveVibration( + level, + walkingClue, + net.minecraft.world.level.gameevent.GameEvent.STEP, + net.minecraft.world.level.gameevent.GameEvent.Context.of(walker) + ), + "A Survival player's step inside the labyrinth must be a valid clue" + ); + guardian.getVibrationUser().onReceiveVibration( + level, + walkingClue, + net.minecraft.world.level.gameevent.GameEvent.STEP, + walker, + null, + 12.0F + ); + helper.assertValueEqual( + guardian.vibrationTarget(), + walkingClue, + "The listener callback must remember a valid walking clue" + ); + + guardian.getVibrationUser().onReceiveVibration( + level, + explosionClue, + net.minecraft.world.level.gameevent.GameEvent.EXPLODE, + explosivePlayer, + null, + 10.0F + ); + int explosionStrength = guardian.vibrationStrength(); + helper.assertValueEqual( + guardian.vibrationTarget(), + explosionClue, + "A stronger explosion must replace a quieter player's clue" + ); + + guardian.getVibrationUser().onReceiveVibration( + level, + walkingClue, + net.minecraft.world.level.gameevent.GameEvent.STEP, + walker, + null, + 1.0F + ); + helper.assertValueEqual( + guardian.vibrationTarget(), + explosionClue, + "A weaker clue from another player must not replace the active source" + ); + helper.assertValueEqual( + guardian.vibrationStrength(), + explosionStrength, + "Rejected vibration strength" + ); + helper.assertTrue( + guardian.getTarget() == null, + "Remembering a vibration must not grant a sight-like combat target" + ); + + float healthBeforeDamage = guardian.getHealth(); + helper.assertTrue( + guardian.hurtServer(level, level.damageSources().playerAttack(walker), 1.0F), + "An awakened guardian must accept player damage" + ); + helper.assertTrue( + guardian.getHealth() < healthBeforeDamage, + "Accepted player damage must reduce awakened guardian health" + ); + helper.assertValueEqual( + guardian.vibrationTarget(), + walker.blockPosition(), + "Direct damage must provide the strongest location clue" + ); + + for (int tick = 0; tick < 5; tick++) { + guardian.tick(); + } + helper.assertTrue( + RetoldAiControl.isControlledBy( + guardian, + RetoldAiControlOwner.EARTH_GUARDIAN + ), + "Vibration investigation must own guardian movement" + ); + + CompoundTag saved = saveAdditionalState(level, guardian); + restored = RetoldEntityTypes.EARTH_GUARDIAN.get().create( + level, + EntitySpawnReason.LOAD + ); + helper.assertTrue(restored != null, "A vibration-aware guardian must restore"); + restored.readAdditionalSaveData(TagValueInput.create( + ProblemReporter.DISCARDING, + level.registryAccess(), + saved + )); + helper.assertValueEqual( + restored.vibrationTarget(), + guardian.vibrationTarget(), + "Remembered vibration position after save/load" + ); + helper.assertValueEqual( + restored.vibrationStrength(), + guardian.vibrationStrength(), + "Remembered vibration strength after save/load" + ); + helper.succeed(); + } finally { + if (walker != null) { + level.players().remove(walker); + walker.discard(); + } + if (explosivePlayer != null) { + level.players().remove(explosivePlayer); + explosivePlayer.discard(); + } + if (restored != null) { + restored.discard(); + } + findStructureGuardians(level, source).forEach(Entity::discard); + encounterData.setLifecycle(source.key(), EarthGuardianLifecycle.DORMANT); + } + } + + private static void earthGuardianUsesEnvironmentalAttacks( + GameTestHelper helper + ) { + ServerLevel level = helper.getLevel(); + BlockPos guardianPosition = helper.absolutePos(new BlockPos(8, 3, 8)); + EarthLabyrinthSource source = new EarthLabyrinthSource( + guardianPosition, + new BoundingBox( + guardianPosition.getX() - 24, + guardianPosition.getY() - 8, + guardianPosition.getZ() - 24, + guardianPosition.getX() + 24, + guardianPosition.getY() + 16, + guardianPosition.getZ() + 24 + ) + ); + EarthGuardianEncounterData encounterData = EarthGuardianEncounterData.get(level); + ServerPlayer player = null; + Zombie victim = null; + EarthGuardian restored = null; + RetoldWorldProtection.Registration protection = null; + + try { + encounterData.setLifecycle(source.key(), EarthGuardianLifecycle.ROAMING); + helper.assertTrue( + EarthGuardianSpawner.spawnIfNeeded(level, source), + "The combat fixture must create its roaming guardian" + ); + EarthGuardian guardian = findStructureGuardians(level, source).getFirst(); + player = (ServerPlayer) helper.makeMockServerPlayer(GameType.SURVIVAL); + victim = helper.spawnWithNoFreeWill(EntityTypes.ZOMBIE, 20, 3, 8); + + BlockPos hazardClue = guardianPosition.east(12); + BlockPos ceiling = hazardClue.above(6); + level.setBlockAndUpdate(hazardClue.below(), Blocks.STONE.defaultBlockState()); + level.setBlockAndUpdate(hazardClue, Blocks.AIR.defaultBlockState()); + level.setBlockAndUpdate(ceiling, Blocks.STONE.defaultBlockState()); + level.setBlockAndUpdate(ceiling.east(), Blocks.STONE.defaultBlockState()); + level.setBlockAndUpdate(ceiling.west(), Blocks.STONE.defaultBlockState()); + level.setBlockAndUpdate(ceiling.north(), Blocks.STONE.defaultBlockState()); + level.setBlockAndUpdate(ceiling.south(), Blocks.STONE.defaultBlockState()); + BlockPos protectedCeiling = ceiling.east(); + protection = RetoldWorldProtection.register( + Identifier.fromNamespaceAndPath( + "retold", + "earth_guardian_environmental_attack_test" + ), + context -> context.type() != RetoldWorldMutationType.MOB_BREAK + || !context.pos().equals(protectedCeiling) + ); + player.snapTo( + hazardClue.getX() + 0.5D, + hazardClue.getY(), + hazardClue.getZ() + 0.5D, + 0.0F, + 0.0F + ); + victim.snapTo( + hazardClue.getX() + 0.5D, + hazardClue.getY(), + hazardClue.getZ() + 0.5D, + 0.0F, + 0.0F + ); + float healthBeforeDirectAttempt = victim.getHealth(); + helper.assertFalse( + guardian.doHurtTarget(level, victim), + "Contact melee must not target unrelated mobs at a distant hazard location" + ); + helper.assertValueEqual( + victim.getHealth(), + healthBeforeDirectAttempt, + "Rejecting direct attacks must leave the victim unharmed" + ); + guardian.getVibrationUser().onReceiveVibration( + level, + hazardClue, + net.minecraft.world.level.gameevent.GameEvent.STEP, + player, + null, + 12.0F + ); + float healthBeforeCollapse = victim.getHealth(); + guardian.tickEnvironmentalCombat(level); + helper.assertTrue( + guardian.isPreparingEnvironmentalAttack(), + "A remembered vibration beneath a ceiling must start an environmental attack" + ); + helper.assertValueEqual( + victim.getHealth(), + healthBeforeCollapse, + "Starting a ceiling warning must not directly damage its victim" + ); + helper.assertTrue( + guardian.getTarget() == null, + "Environmental attacks must not grant the blind guardian a sight target" + ); + CompoundTag saved = saveAdditionalState(level, guardian); + restored = RetoldEntityTypes.EARTH_GUARDIAN.get().create( + level, + EntitySpawnReason.LOAD + ); + helper.assertTrue(restored != null, "A winding-up guardian must restore"); + restored.readAdditionalSaveData(TagValueInput.create( + ProblemReporter.DISCARDING, + level.registryAccess(), + saved + )); + helper.assertTrue( + restored.isPreparingEnvironmentalAttack(), + "The pending environmental warning must survive save/load" + ); + + for (int tick = 0; tick < 29; tick++) { + guardian.tickEnvironmentalCombat(level); + } + helper.assertValueEqual( + level.getBlockState(ceiling).getBlock(), + Blocks.STONE, + "The ceiling must remain intact throughout the warning" + ); + guardian.tickEnvironmentalCombat(level); + helper.assertTrue( + level.getBlockState(ceiling).isAir(), + "The released collapse must remove a real ceiling block" + ); + helper.assertTrue( + level.getBlockState(protectedCeiling).is(Blocks.STONE), + "Administrative world protection must be able to preserve ceiling blocks" + ); + protection.close(); + protection = null; + helper.assertFalse( + guardian.isPreparingEnvironmentalAttack(), + "The collapse must clear its pending attack after release" + ); + helper.assertTrue( + !level.getEntitiesOfClass( + FallingBlockEntity.class, + new net.minecraft.world.phys.AABB(ceiling).inflate(2.0D) + ).isEmpty(), + "The ceiling block must become physical falling debris" + ); + + victim.setHealth(victim.getMaxHealth()); + victim.invulnerableTime = 0; + victim.setRemainingFireTicks(0); + victim.setDeltaMovement(net.minecraft.world.phys.Vec3.ZERO); + victim.snapTo( + hazardClue.getX() + 0.5D, + hazardClue.getY(), + hazardClue.getZ() + 0.5D, + 0.0F, + 0.0F + ); + BlockPos lavaGround = hazardClue.below(); + for (int x = -1; x <= 1; x++) { + for (int z = -1; z <= 1; z++) { + level.setBlockAndUpdate(lavaGround.offset(x, 0, z), Blocks.STONE.defaultBlockState()); + } + } + level.setBlockAndUpdate(lavaGround.north(), Blocks.BEDROCK.defaultBlockState()); + level.setBlockAndUpdate(lavaGround.south(), Blocks.CHEST.defaultBlockState()); + protection = RetoldWorldProtection.register( + Identifier.fromNamespaceAndPath("retold", "earth_guardian_lava_test"), + context -> !(context.type() == RetoldWorldMutationType.MOB_BREAK + && context.pos().equals(lavaGround.east())) + && !(context.type() == RetoldWorldMutationType.MOB_PLACE + && context.pos().equals(lavaGround.west())) + ); + guardian.getVibrationUser().onReceiveVibration( + level, + hazardClue, + net.minecraft.world.level.gameevent.GameEvent.STEP, + player, + null, + 12.0F + ); + for (int tick = 0; tick < 80 && !guardian.isPreparingEnvironmentalAttack(); tick++) { + guardian.tickEnvironmentalCombat(level); + } + helper.assertTrue( + guardian.isPreparingEnvironmentalAttack(), + "The alternating attack must begin a lava eruption after cooldown" + ); + float healthBeforeEruption = victim.getHealth(); + for (int tick = 0; tick < 29; tick++) { + guardian.tickEnvironmentalCombat(level); + } + helper.assertValueEqual( + victim.getHealth(), + healthBeforeEruption, + "The lava warning must leave time to leave the marked ground" + ); + guardian.tickEnvironmentalCombat(level); + helper.assertValueEqual( + victim.getHealth(), + healthBeforeEruption, + "Releasing lava must not apply scripted damage before fluid contact" + ); + helper.assertTrue( + victim.getRemainingFireTicks() == 0 && victim.getDeltaMovement().y == 0.0D, + "Ground conversion must not directly ignite or launch its victim" + ); + for (int x = -1; x <= 1; x++) { + for (int z = -1; z <= 1; z++) { + BlockPos ground = lavaGround.offset(x, 0, z); + boolean protectedGround = ground.equals(lavaGround.east()) + || ground.equals(lavaGround.west()); + helper.assertTrue( + level.getBlockState(ground).is(protectedGround ? Blocks.STONE : Blocks.LAVA), + "Only protection-approved ground in the 3x3 patch must become lava" + ); + } + } + helper.assertTrue( + level.getFluidState(lavaGround).isSource() + && level.getBlockState(hazardClue).isAir() + && level.getBlockEntity(lavaGround.south()) == null, + "The attack must create real sources below the victim, including container replacement" + ); + protection.close(); + protection = null; + helper.assertTrue( + guardian.getTarget() == null, + "The eruption must still use vibration memory without assigning a target" + ); + + level.setBlockAndUpdate(protectedCeiling, Blocks.AIR.defaultBlockState()); + level.setBlockAndUpdate(lavaGround, Blocks.STONE.defaultBlockState()); + victim.setHealth(victim.getMaxHealth()); + victim.invulnerableTime = 0; + victim.setRemainingFireTicks(0); + victim.setDeltaMovement(net.minecraft.world.phys.Vec3.ZERO); + guardian.getVibrationUser().onReceiveVibration( + level, + hazardClue, + net.minecraft.world.level.gameevent.GameEvent.STEP, + player, + null, + 12.0F + ); + for (int tick = 0; tick < 80 && !guardian.isPreparingEnvironmentalAttack(); tick++) { + guardian.tickEnvironmentalCombat(level); + } + helper.assertTrue( + guardian.isPreparingEnvironmentalAttack(), + "The attack after lava must begin a floor-collapse warning" + ); + for (int tick = 0; tick < 30; tick++) { + guardian.tickEnvironmentalCombat(level); + } + helper.assertTrue( + level.getBlockState(lavaGround).isAir(), + "The third attack must open the floor instead of producing more lava" + ); + + victim.setHealth(victim.getMaxHealth()); + victim.invulnerableTime = 0; + victim.setRemainingFireTicks(0); + victim.setDeltaMovement(net.minecraft.world.phys.Vec3.ZERO); + level.setBlockAndUpdate(lavaGround, Blocks.STONE.defaultBlockState()); + BlockPos obstructedCeiling = hazardClue.above(6); + BlockPos obstruction = hazardClue.above(); + level.setBlockAndUpdate(obstructedCeiling, Blocks.STONE.defaultBlockState()); + level.setBlockAndUpdate(obstruction, Blocks.STONE.defaultBlockState()); + guardian.getVibrationUser().onReceiveVibration( + level, + hazardClue, + net.minecraft.world.level.gameevent.GameEvent.STEP, + player, + null, + 12.0F + ); + for (int tick = 0; tick < 80 && !guardian.isPreparingEnvironmentalAttack(); tick++) { + guardian.tickEnvironmentalCombat(level); + } + helper.assertTrue( + guardian.isPreparingEnvironmentalAttack(), + "A blocked ceiling must still begin a fallback environmental warning" + ); + for (int tick = 0; tick < 30; tick++) { + guardian.tickEnvironmentalCombat(level); + } + helper.assertTrue( + level.getBlockState(obstructedCeiling).is(Blocks.STONE), + "Ceiling debris must not be selected when its fall path is blocked" + ); + helper.assertTrue( + level.getBlockState(lavaGround).is(Blocks.LAVA), + "A blocked ceiling collapse must fall back to ground conversion" + ); + boolean originalMobGriefing = level.getGameRules().get(GameRules.MOB_GRIEFING); + try { + level.setBlockAndUpdate(lavaGround, Blocks.STONE.defaultBlockState()); + for (int tick = 0; tick < 80 && !guardian.isPreparingEnvironmentalAttack(); tick++) { + guardian.tickEnvironmentalCombat(level); + } + helper.assertTrue(guardian.isPreparingEnvironmentalAttack(), "A floor warning must be pending"); + // Administrative policy is rechecked at release, even if it changes during the warning. + level.getGameRules().set(GameRules.MOB_GRIEFING, false, level.getServer()); + for (int tick = 0; tick < 30; tick++) { + guardian.tickEnvironmentalCombat(level); + } + helper.assertTrue( + level.getBlockState(lavaGround).is(Blocks.STONE), + "Disabling mob griefing during windup must prevent floor collapse" + ); + } finally { + level.getGameRules().set(GameRules.MOB_GRIEFING, originalMobGriefing, level.getServer()); + } + helper.succeed(); + } finally { + if (protection != null) { + protection.close(); + } + if (player != null) { + player.discard(); + } + if (victim != null) { + victim.discard(); + } + if (restored != null) { + restored.discard(); + } + level.getEntitiesOfClass( + FallingBlockEntity.class, + new net.minecraft.world.phys.AABB(guardianPosition).inflate(32.0D) + ).forEach(Entity::discard); + findStructureGuardians(level, source).forEach(Entity::discard); + encounterData.setLifecycle(source.key(), EarthGuardianLifecycle.DORMANT); + } + } + + private static void earthGuardianCeilingDebrisHitsOnServerTicks( + GameTestHelper helper + ) { + ServerLevel level = helper.getLevel(); + BlockPos guardianStart = helper.absolutePos(new BlockPos(4, 3, 4)); + ChunkPos ticketCenter = new ChunkPos( + guardianStart.getX() >> 4, + guardianStart.getZ() >> 4 + ); + setForcedChunks(level, ticketCenter, true); + EarthGuardian guardian = helper.spawn( + RetoldEntityTypes.EARTH_GUARDIAN.get(), + 4.0D, + 3.0D, + 4.0D, + EntitySpawnReason.COMMAND + ); + Zombie victim = helper.spawnWithNoFreeWill(EntityTypes.ZOMBIE, 16, 3, 4); + ServerPlayer player = (ServerPlayer) helper.makeMockServerPlayer(GameType.SURVIVAL); + BlockPos attackFloor = helper.absolutePos(new BlockPos(16, 3, 4)); + BlockPos attackCeiling = attackFloor.above(6); + BlockPos movedFloor = helper.absolutePos(new BlockPos(16, 3, 10)); + BlockPos decoyCeiling = movedFloor.above(6); + + level.setBlockAndUpdate(attackFloor.below(), Blocks.STONE.defaultBlockState()); + level.setBlockAndUpdate(attackFloor, Blocks.AIR.defaultBlockState()); + level.setBlockAndUpdate(attackCeiling, Blocks.STONE.defaultBlockState()); + level.setBlockAndUpdate(decoyCeiling, Blocks.STONE.defaultBlockState()); + player.snapTo( + attackFloor.getX() + 0.5D, + attackFloor.getY(), + attackFloor.getZ() + 0.5D, + 0.0F, + 0.0F + ); + victim.snapTo( + attackFloor.getX() + 0.5D, + attackFloor.getY(), + attackFloor.getZ() + 0.5D, + 0.0F, + 0.0F + ); + guardian.getVibrationUser().onReceiveVibration( + level, + attackFloor, + net.minecraft.world.level.gameevent.GameEvent.STEP, + player, + null, + 12.0F + ); + helper.assertValueEqual( + guardian.lifecycle(), + EarthGuardianLifecycle.ROAMING, + "The real-tick fixture guardian lifecycle" + ); + helper.assertValueEqual( + guardian.vibrationTarget(), + attackFloor, + "The real-tick fixture vibration target" + ); + float startingHealth = victim.getHealth(); + + helper.startSequence() + .thenWaitUntil(() -> helper.assertTrue( + guardian.isPreparingEnvironmentalAttack(), + "A real guardian tick must begin the environmental warning" + + " (lifecycle=" + guardian.lifecycle() + + ", removed=" + guardian.isRemoved() + + ", noAi=" + guardian.isNoAi() + + ", tickCount=" + guardian.tickCount + + ", position=" + guardian.position() + + ", vibration=" + guardian.vibrationTarget() + + ", floor=" + level.getBlockState(attackFloor) + + ", support=" + level.getBlockState(attackFloor.below()) + + ", ceiling=" + level.getBlockState(attackCeiling) + ")" + )) + .thenExecute(() -> player.snapTo( + movedFloor.getX() + 0.5D, + movedFloor.getY(), + movedFloor.getZ() + 0.5D, + 0.0F, + 0.0F + )) + .thenIdle(20) + .thenExecute(() -> { + helper.assertTrue( + level.getBlockState(attackCeiling).is(Blocks.STONE), + "The real warning interval must not release ceiling debris early" + ); + helper.assertValueEqual( + victim.getHealth(), + startingHealth, + "The warning interval must remain non-damaging on real ticks" + ); + }) + .thenWaitUntil(() -> helper.assertTrue( + level.getBlockState(attackCeiling).isAir(), + "The locked original ceiling must release after the warning" + )) + .thenWaitUntil(() -> helper.assertTrue( + victim.getHealth() < startingHealth + && victim.getLastDamageSource() != null + && victim.getLastDamageSource().is(DamageTypes.FALLING_BLOCK), + "Physical falling debris must hit with the falling-block damage source" + )) + .thenExecute(() -> helper.assertTrue( + level.getBlockState(decoyCeiling).is(Blocks.STONE), + "Moving after lock-on must not redirect collapse to the player's new position" + )) + .thenExecute(() -> { + player.discard(); + victim.discard(); + guardian.discard(); + setForcedChunks(level, ticketCenter, false); + }) + .thenSucceed(); + } + + private static void earthGuardianLavaGroundBurnsOnServerTicks(GameTestHelper helper) { + ServerLevel level = helper.getLevel(); + helper.setTime(18_000L); + EarthGuardian guardian = helper.spawn( + RetoldEntityTypes.EARTH_GUARDIAN.get(), 4.0D, 3.0D, 4.0D, EntitySpawnReason.COMMAND + ); + ChunkPos ticketCenter = guardian.chunkPosition(); + setForcedChunks(level, ticketCenter, true); + BlockPos target = helper.absolutePos(new BlockPos(16, 3, 4)); + BlockPos ground = target.below(); + BlockPos escapedGround = ground.south(6); + // A stone basin contains fluid spread so the test measures contact damage at the locked floor. + for (int x = -2; x <= 2; x++) { + for (int z = -2; z <= 2; z++) { + level.setBlockAndUpdate(ground.offset(x, -1, z), Blocks.STONE.defaultBlockState()); + level.setBlockAndUpdate(ground.offset(x, 0, z), Blocks.STONE.defaultBlockState()); + } + } + level.setBlockAndUpdate(escapedGround, Blocks.STONE.defaultBlockState()); + Zombie victim = helper.spawnWithNoFreeWill(EntityTypes.ZOMBIE, 16, 3, 4); + Zombie escapedVictim = helper.spawnWithNoFreeWill(EntityTypes.ZOMBIE, 16, 3, 10); + victim.setPos(net.minecraft.world.phys.Vec3.atBottomCenterOf(target)); + escapedVictim.setPos(net.minecraft.world.phys.Vec3.atBottomCenterOf(escapedGround.above())); + ServerPlayer player = (ServerPlayer) helper.makeMockServerPlayer(GameType.SURVIVAL); + player.setPos(net.minecraft.world.phys.Vec3.atBottomCenterOf(target)); + guardian.getVibrationUser().onReceiveVibration( + level, target, net.minecraft.world.level.gameevent.GameEvent.STEP, player, null, 12.0F + ); + float startingHealth = victim.getHealth(); + float escapedHealth = escapedVictim.getHealth(); + helper.startSequence() + .thenWaitUntil(() -> helper.assertTrue( + guardian.isPreparingEnvironmentalAttack(), "The open-sky clue must begin a lava warning" + )) + .thenExecute(() -> player.setPos( + net.minecraft.world.phys.Vec3.atBottomCenterOf(escapedGround.above()) + )) + .thenIdle(20) + .thenExecute(() -> { + helper.assertTrue(level.getBlockState(ground).is(Blocks.STONE), "Warning must leave ground intact"); + helper.assertValueEqual(victim.getHealth(), startingHealth, "Warning must remain harmless"); + }) + .thenWaitUntil(() -> helper.assertTrue( + level.getBlockState(ground).is(Blocks.LAVA), "The original supporting block must become lava" + )) + .thenWaitUntil(() -> helper.assertTrue( + victim.getHealth() < startingHealth + && victim.getLastDamageSource() != null + && victim.getLastDamageSource().is(DamageTypes.LAVA) + && victim.getY() < target.getY(), + "The victim must sink into the changed floor and take vanilla lava contact damage" + )) + .thenExecute(() -> { + helper.assertTrue(level.getFluidState(ground).isSource(), "The source must persist after release"); + helper.assertTrue( + level.getBlockState(escapedGround).is(Blocks.STONE), + "Moving after the warning must not redirect ground conversion" + ); + helper.assertValueEqual(escapedVictim.getHealth(), escapedHealth, "Leaving the patch must avoid damage"); + player.discard(); + victim.discard(); + escapedVictim.discard(); + guardian.discard(); + setForcedChunks(level, ticketCenter, false); + }) + .thenSucceed(); + } + + private static void earthGuardianFloorCollapseCausesRealFall(GameTestHelper helper) { + ServerLevel level = helper.getLevel(); + helper.setTime(18_000L); + EarthGuardian guardian = helper.spawn( + RetoldEntityTypes.EARTH_GUARDIAN.get(), 4.0D, 3.0D, 4.0D, EntitySpawnReason.COMMAND + ); + ChunkPos ticketCenter = guardian.chunkPosition(); + setForcedChunks(level, ticketCenter, true); + BlockPos target = helper.absolutePos(new BlockPos(16, 3, 4)); + BlockPos ground = target.below(); + BlockPos escapedGround = ground.south(6); + for (int x = -2; x <= 2; x++) { + for (int z = -2; z <= 2; z++) { + for (int depth = 1; depth <= 5; depth++) { + level.setBlockAndUpdate(target.offset(x, -depth, z), Blocks.STONE.defaultBlockState()); + } + } + } + level.setBlockAndUpdate(guardian.blockPosition().below(), Blocks.STONE.defaultBlockState()); + level.setBlockAndUpdate(escapedGround, Blocks.STONE.defaultBlockState()); + level.setBlockAndUpdate(ground, Blocks.BEDROCK.defaultBlockState()); + level.setBlockAndUpdate(ground.south(), Blocks.CHEST.defaultBlockState()); + Zombie victim = helper.spawnWithNoFreeWill(EntityTypes.ZOMBIE, 16, 3, 4); + victim.setPos(net.minecraft.world.phys.Vec3.atBottomCenterOf(target)); + Zombie escapedVictim = helper.spawnWithNoFreeWill(EntityTypes.ZOMBIE, 16, 3, 10); + escapedVictim.setPos(net.minecraft.world.phys.Vec3.atBottomCenterOf(escapedGround.above())); + ServerPlayer player = (ServerPlayer) helper.makeMockServerPlayer(GameType.SURVIVAL); + player.setPos(net.minecraft.world.phys.Vec3.atBottomCenterOf(target)); + + CompoundTag saved = saveAdditionalState(level, guardian); + saved.remove("retold_next_environmental_attack"); + saved.putBoolean("retold_prefer_lava_attack", true); + guardian.readAdditionalSaveData(TagValueInput.create( + ProblemReporter.DISCARDING, level.registryAccess(), saved + )); + helper.assertValueEqual( + saveAdditionalState(level, guardian).getIntOr("retold_next_environmental_attack", -1), + 1, + "Legacy lava preference must migrate without changing the next attack" + ); + saved.putInt("retold_next_environmental_attack", 2); + guardian.readAdditionalSaveData(TagValueInput.create( + ProblemReporter.DISCARDING, level.registryAccess(), saved + )); + guardian.getVibrationUser().onReceiveVibration( + level, target, net.minecraft.world.level.gameevent.GameEvent.STEP, player, null, 12.0F + ); + guardian.tickEnvironmentalCombat(level); + helper.assertTrue(guardian.isPreparingEnvironmentalAttack(), "Floor collapse must start with a warning"); + CompoundTag pending = saveAdditionalState(level, guardian); + helper.assertValueEqual(pending.getIntOr("retold_environmental_attack_type", -1), 2, "Saved floor hazard"); + helper.assertValueEqual(pending.getIntOr("retold_next_environmental_attack", -1), 0, "Rotation returns to ceiling"); + guardian.readAdditionalSaveData(TagValueInput.create( + ProblemReporter.DISCARDING, level.registryAccess(), pending + )); + // Register after the warning to verify that protection is checked at the moment of removal. + RetoldWorldProtection.Registration protection = RetoldWorldProtection.register( + Identifier.fromNamespaceAndPath("retold", "earth_guardian_floor_test"), + context -> context.type() != RetoldWorldMutationType.MOB_BREAK + || !context.pos().equals(ground.north()) + ); + player.setPos(net.minecraft.world.phys.Vec3.atBottomCenterOf(escapedGround.above())); + float startingHealth = victim.getHealth(); + float escapedHealth = escapedVictim.getHealth(); + helper.startSequence() + .thenIdle(20) + .thenExecute(() -> { + helper.assertTrue(level.getBlockState(ground).is(Blocks.BEDROCK), "Warning leaves support intact"); + helper.assertValueEqual(victim.getHealth(), startingHealth, "Warning must remain harmless"); + }) + .thenWaitUntil(() -> helper.assertTrue( + level.getBlockState(ground).isAir(), "The locked floor must open after reload" + )) + .thenExecute(() -> { + for (int depth = 1; depth <= 4; depth++) { + helper.assertTrue(level.getBlockState(target.below(depth)).isAir(), "Pit must reach four blocks deep"); + helper.assertTrue( + level.getBlockState(target.north().below(depth)).is(Blocks.STONE), + "Protected support and its underlying column must remain intact" + ); + } + helper.assertTrue(level.getBlockState(target.below(5)).is(Blocks.STONE), "Pit depth must be bounded"); + helper.assertTrue(level.getBlockState(ground.east(2)).is(Blocks.STONE), "Pit width must be bounded"); + helper.assertTrue(level.getBlockEntity(ground.south()) == null, "Containers are also valid floor material"); + }) + .thenWaitUntil(() -> helper.assertTrue( + victim.getY() <= target.getY() - 3.9D + && victim.getHealth() < startingHealth + && victim.getLastDamageSource() != null + && victim.getLastDamageSource().is(DamageTypes.FALL), + "The opened pit must cause real falling and vanilla landing damage" + )) + .thenExecute(() -> { + helper.assertValueEqual(escapedVictim.getHealth(), escapedHealth, "Safe ground must avoid damage"); + helper.assertTrue(level.getBlockState(escapedGround).is(Blocks.STONE), "The pit must not follow the player"); + protection.close(); + player.discard(); + victim.discard(); + escapedVictim.discard(); + guardian.discard(); + setForcedChunks(level, ticketCenter, false); + }) + .thenSucceed(); + } + + private static void earthGuardianPhysicallyInvestigatesVibrations(GameTestHelper helper) { + ServerLevel level = helper.getLevel(); + for (int x = 0; x <= 38; x++) { + for (int z = 1; z <= 7; z++) { + level.setBlockAndUpdate(helper.absolutePos(new BlockPos(x, 2, z)), Blocks.STONE.defaultBlockState()); + } + } + EarthGuardian guardian = helper.spawn( + RetoldEntityTypes.EARTH_GUARDIAN.get(), 4.0D, 3.0D, 4.0D, EntitySpawnReason.COMMAND + ); + BlockPos start = guardian.blockPosition(); + EarthLabyrinthSource source = new EarthLabyrinthSource( + start, new BoundingBox(start.getX() - 8, start.getY() - 4, start.getZ() - 8, + start.getX() + 38, start.getY() + 8, start.getZ() + 8) + ); + guardian.configureForLabyrinth(level, source, EarthGuardianLifecycle.ROAMING); + BlockPos middle = helper.absolutePos(new BlockPos(19, 3, 4)); + ChunkPos ticketCenter = new ChunkPos(middle.getX() >> 4, middle.getZ() >> 4); + ChunkPos guardianChunk = guardian.chunkPosition(); + setForcedChunks(level, ticketCenter, true); + setForcedChunks(level, guardianChunk, true); + ServerPlayer player = (ServerPlayer) helper.makeMockServerPlayer(GameType.SURVIVAL); + BlockPos clue = helper.absolutePos(new BlockPos(34, 3, 4)); + player.setPos(net.minecraft.world.phys.Vec3.atBottomCenterOf(clue)); + guardian.getVibrationUser().onReceiveVibration( + level, clue, net.minecraft.world.level.gameevent.GameEvent.STEP, player, null, 30.0F + ); + double startingX = guardian.getX(); + int[] repairs = {0}; + helper.onEachTick(() -> { + if (guardian.isAlive() && guardian.tickCount > 0 && guardian.tickCount % 40 == 0) { + net.minecraft.world.phys.Vec3 position = guardian.position(); + var path = guardian.getNavigation().getPath(); + var owner = RetoldAiControl.getOwner(guardian); + EarthGuardianSpawner.spawnIfNeeded(level, source); + helper.assertValueEqual(guardian.position(), position, "Periodic source repair must not interrupt physical pursuit"); + helper.assertTrue(guardian.getNavigation().getPath() == path, "Repair must retain the current navigation path"); + helper.assertValueEqual(RetoldAiControl.getOwner(guardian), owner, "Repair must retain movement ownership"); + repairs[0]++; + } + }); + helper.startSequence() + .thenWaitUntil(() -> helper.assertTrue(repairs[0] > 0, "A real-tick pursuit must cross a periodic source repair")) + .thenWaitUntil(() -> helper.assertTrue( + guardian.getX() > startingX + 2.0D, + "The guardian must physically approach a distant remembered clue" + + "; position=" + guardian.position() + + ", ticks=" + guardian.tickCount + + ", path=" + guardian.getNavigation().getPath() + + ", owner=" + RetoldAiControl.getOwner(guardian) + )) + .thenExecute(() -> { + helper.assertTrue( + RetoldAiControl.isControlledBy(guardian, RetoldAiControlOwner.EARTH_GUARDIAN), + "Investigation must retain its movement ownership" + ); + helper.assertTrue(guardian.getTarget() == null, "Physical pursuit must not grant a sight target"); + player.discard(); + guardian.discard(); + EarthGuardianEncounterData.get(level).setLifecycle(source.key(), EarthGuardianLifecycle.DORMANT); + setForcedChunks(level, ticketCenter, false); + setForcedChunks(level, guardianChunk, false); + }) + .thenSucceed(); + } + + private static void earthGuardianPhysicallyPatrolsMaze(GameTestHelper helper) { + ServerLevel level = helper.getLevel(); + BlockPos fixtureCenter = helper.absolutePos(new BlockPos(12, 3, 12)); + ChunkPos ticketCenter = new ChunkPos(fixtureCenter.getX() >> 4, fixtureCenter.getZ() >> 4); + level.getChunkSource().addTicketWithRadius(TicketType.FORCED, ticketCenter, 2); + for (int x = 0; x <= 24; x++) { + for (int z = 0; z <= 24; z++) { + level.setBlockAndUpdate(helper.absolutePos(new BlockPos(x, 2, z)), Blocks.STONE.defaultBlockState()); + } + } + EarthGuardian guardian = helper.spawn( + RetoldEntityTypes.EARTH_GUARDIAN.get(), 12.0D, 3.0D, 12.0D, EntitySpawnReason.COMMAND + ); + BlockPos start = guardian.blockPosition(); + EarthLabyrinthSource source = new EarthLabyrinthSource( + start, new BoundingBox(start.getX() - 7, start.getY(), start.getZ() - 7, + start.getX() + 7, start.getY() + 5, start.getZ() + 7) + ); + guardian.configureForLabyrinth(level, source, EarthGuardianLifecycle.ROAMING); + guardian.getRandom().setSeed(11L); + ServerPlayer observer = (ServerPlayer) helper.makeMockServerPlayer(GameType.CREATIVE); + observer.setPos(net.minecraft.world.phys.Vec3.atCenterOf(start.above(8))); + level.getChunkAt(guardian.blockPosition()); + net.minecraft.world.phys.Vec3 startPosition = guardian.position(); + helper.startSequence() + .thenWaitUntil(() -> helper.assertTrue( + guardian.distanceToSqr(startPosition) > 0.25D, + "An idle guardian must physically follow its selected maze patrol path" + + "; path=" + guardian.getNavigation().getPath() + + ", ticks=" + guardian.tickCount + + ", lifecycle=" + guardian.lifecycle() + + ", noAi=" + guardian.isNoAi() + + ", position=" + guardian.position() + + ", onGround=" + guardian.onGround() + + ", support=" + level.getBlockState(guardian.blockPosition().below()) + + ", clue=" + guardian.vibrationTarget() + + ", owner=" + RetoldAiControl.getOwner(guardian) + )) + .thenExecute(() -> { + helper.assertTrue( + RetoldAiControl.isControlledBy(guardian, RetoldAiControlOwner.EARTH_GUARDIAN), + "Patrol movement must retain guardian ownership" + ); + helper.assertTrue( + guardian.getTarget() == null && guardian.vibrationTarget() == null, + "Idle patrol must not invent an enemy or a vibration" + ); + observer.discard(); + guardian.discard(); + EarthGuardianEncounterData.get(level).setLifecycle(source.key(), EarthGuardianLifecycle.DORMANT); + level.getChunkSource().removeTicketWithRadius(TicketType.FORCED, ticketCenter, 2); + }) + .thenSucceed(); + } + + private static void setForcedChunks( + ServerLevel level, + ChunkPos center, + boolean forced + ) { + for (int chunkX = center.x() - 1; chunkX <= center.x() + 1; chunkX++) { + for (int chunkZ = center.z() - 1; chunkZ <= center.z() + 1; chunkZ++) { + level.setChunkForced(chunkX, chunkZ, forced); + } + } + } + + private static void earthGuardianRelocatesAnyLoadedBlock( + GameTestHelper helper + ) { + ServerLevel level = helper.getLevel(); + BlockPos guardianPosition = helper.absolutePos(new BlockPos(8, 3, 8)); + EarthLabyrinthSource source = new EarthLabyrinthSource( + guardianPosition, + new BoundingBox( + guardianPosition.getX() - 1, + guardianPosition.getY() - 1, + guardianPosition.getZ() - 1, + guardianPosition.getX() + 1, + guardianPosition.getY() + 3, + guardianPosition.getZ() + 1 + ) + ); + EarthGuardianEncounterData encounterData = EarthGuardianEncounterData.get(level); + ServerPlayer vibrationPlayer = null; + EarthGuardian restored = null; + RetoldWorldProtection.Registration registration = null; + BlockPos wall = source.guardianPosition().east(2); + BlockPos relocatedContainer = source.guardianPosition().west(3); + BlockPos container = source.guardianPosition().south(2); + BlockPos relocatedWall = source.guardianPosition().north(3); + + try { + encounterData.setLifecycle(source.key(), EarthGuardianLifecycle.ROAMING); + helper.assertTrue( + EarthGuardianSpawner.spawnIfNeeded(level, source), + "The terrain fixture must create its roaming guardian" + ); + EarthGuardian guardian = findStructureGuardians(level, source).getFirst(); + level.setBlockAndUpdate(wall, Blocks.BEDROCK.defaultBlockState()); + level.setBlockAndUpdate(relocatedContainer, Blocks.CAVE_AIR.defaultBlockState()); + level.setBlockAndUpdate(container, Blocks.CHEST.defaultBlockState()); + level.setBlockAndUpdate(relocatedWall, Blocks.CAVE_AIR.defaultBlockState()); + + helper.assertTrue( + level.getBlockEntity(container) != null, + "The unrestricted fixture must begin with a real container block entity" + ); + + registration = RetoldWorldProtection.register( + Identifier.fromNamespaceAndPath( + "retold", + "earth_guardian_terrain_test" + ), + context -> context.type() != RetoldWorldMutationType.MOB_BREAK + || !context.pos().equals(container) + ); + helper.assertFalse( + guardian.tryExcavateBlock(level, container), + "Administrative world protection must still be able to deny excavation" + ); + registration.close(); + registration = null; + + helper.assertTrue( + guardian.tryExcavateBlock(level, container), + "A container outside the labyrinth must be valid terrain material" + ); + helper.assertTrue( + level.getBlockState(container).isAir() + && level.getBlockEntity(container) == null, + "Excavating a container must remove its block and block entity" + ); + helper.assertTrue( + guardian.tryPlaceReservedBlock(level, relocatedContainer), + "The stored container state must be placeable outside the labyrinth" + ); + helper.assertTrue( + level.getBlockState(relocatedContainer).is(Blocks.CHEST), + "Relocation must preserve an unrestricted container block state" + ); + vibrationPlayer = (ServerPlayer) helper.makeMockServerPlayer(GameType.SURVIVAL); + BlockPos clue = source.guardianPosition().east(10); + vibrationPlayer.snapTo( + clue.getX() + 0.5D, + clue.getY(), + clue.getZ() + 0.5D, + 0.0F, + 0.0F + ); + guardian.getVibrationUser().onReceiveVibration( + level, + clue, + net.minecraft.world.level.gameevent.GameEvent.STEP, + vibrationPlayer, + null, + 10.0F + ); + guardian.tickTerrainControl(level); + helper.assertTrue( + level.getBlockState(wall).isAir(), + "Following an outside vibration must excavate even Bedrock outside the maze" + ); + helper.assertValueEqual( + guardian.terrainReserveSize(), + 1, + "Excavated reserve size" + ); + + CompoundTag saved = saveAdditionalState(level, guardian); + restored = RetoldEntityTypes.EARTH_GUARDIAN.get().create( + level, + EntitySpawnReason.LOAD + ); + helper.assertTrue(restored != null, "A terrain-shaping guardian must restore"); + restored.readAdditionalSaveData(TagValueInput.create( + ProblemReporter.DISCARDING, + level.registryAccess(), + saved + )); + helper.assertValueEqual( + restored.terrainReserveSize(), + 1, + "The conserved terrain reserve must survive save/load" + ); + + registration = RetoldWorldProtection.register( + Identifier.fromNamespaceAndPath( + "retold", + "earth_guardian_terrain_test" + ), + context -> context.type() != RetoldWorldMutationType.MOB_PLACE + || !context.pos().equals(relocatedWall) + ); + helper.assertFalse( + restored.tryPlaceReservedBlock(level, relocatedWall), + "Administrative world protection must still be able to deny placement" + ); + registration.close(); + registration = null; + + helper.assertTrue( + restored.tryPlaceReservedBlock(level, relocatedWall), + "The guardian must relocate stored Bedrock beyond the labyrinth" + ); + helper.assertTrue( + level.getBlockState(relocatedWall).is(Blocks.BEDROCK), + "Relocation must preserve the exact excavated material" + ); + helper.assertValueEqual( + restored.terrainReserveSize(), + 0, + "Placed material must be consumed rather than duplicated" + ); + helper.succeed(); + } finally { + if (registration != null) { + registration.close(); + } + if (restored != null) { + restored.discard(); + } + if (vibrationPlayer != null) { + vibrationPlayer.discard(); + } + findStructureGuardians(level, source).forEach(Entity::discard); + encounterData.setLifecycle(source.key(), EarthGuardianLifecycle.DORMANT); + level.setBlockAndUpdate(wall, Blocks.CAVE_AIR.defaultBlockState()); + level.setBlockAndUpdate(relocatedContainer, Blocks.CAVE_AIR.defaultBlockState()); + level.setBlockAndUpdate(container, Blocks.CAVE_AIR.defaultBlockState()); + level.setBlockAndUpdate(relocatedWall, Blocks.CAVE_AIR.defaultBlockState()); + } + } + + private static List findStructureGuardians( + ServerLevel level, + EarthLabyrinthSource source + ) { + return level.getEntities( + (Entity) null, + source.duplicateSearchBounds(), + entity -> entity instanceof EarthGuardian guardian + && guardian.isStructureBound() + && guardian.labyrinthKey() == source.key() + ).stream().map(EarthGuardian.class::cast).toList(); + } + + private static CompoundTag saveAdditionalState( + ServerLevel level, + EarthGuardian guardian + ) { + TagValueOutput output = TagValueOutput.createWithContext( + ProblemReporter.DISCARDING, + level.registryAccess() + ); + guardian.addAdditionalSaveData(output); + return output.buildResult(); + } + + private static BlockPos cellCenter( + EarthLabyrinthLayout layout, + EarthLabyrinthLayout.Cell cell, + BlockPos labyrinthCenter, + int pyramidBaseY, + long layoutSeed + ) { + return EarthLabyrinthGenerator.cellCenter( + layout, + cell, + labyrinthCenter.getX(), + labyrinthCenter.getZ(), + pyramidBaseY, + layoutSeed + ); + } + + private static boolean hasTunnelTurn(List path) { + for (int index = 1; index + 1 < path.size(); index++) { + BlockPos previous = path.get(index - 1); + BlockPos current = path.get(index); + BlockPos next = path.get(index + 1); + int firstDeltaX = current.getX() - previous.getX(); + int firstDeltaZ = current.getZ() - previous.getZ(); + int secondDeltaX = next.getX() - current.getX(); + int secondDeltaZ = next.getZ() - current.getZ(); + + if (firstDeltaX != secondDeltaX || firstDeltaZ != secondDeltaZ) { + return true; + } + } + + return false; + } + + private static boolean hasGeneratedLadder( + GameTestHelper helper, + EarthLabyrinthLayout.Passage passage, + EarthLabyrinthLayout layout, + BlockPos labyrinthCenter, + int pyramidBaseY, + long layoutSeed + ) { + EarthLabyrinthLayout.Cell lowerCell = passage.first().level() == 1 + ? passage.first() + : passage.second(); + BlockPos lower = cellCenter( + layout, + lowerCell, + labyrinthCenter, + pyramidBaseY, + layoutSeed + ); + return helper.getLevel().getBlockState(lower.south().above()).is(Blocks.LADDER); + } + + private static boolean isMazeStone(GameTestHelper helper, BlockPos pos) { + return helper.getLevel().getBlockState(pos).is(Blocks.STONE) + || helper.getLevel().getBlockState(pos).is(Blocks.DEEPSLATE) + || helper.getLevel().getBlockState(pos).is(Blocks.ANDESITE) + || helper.getLevel().getBlockState(pos).is(Blocks.TUFF) + || helper.getLevel().getBlockState(pos).is(Blocks.COBBLESTONE) + || helper.getLevel().getBlockState(pos).is(Blocks.COBBLED_DEEPSLATE) + || helper.getLevel().getBlockState(pos).is(Blocks.MOSSY_COBBLESTONE); + } + + private static PiecesContainer roundTrip( + StructurePieceSerializationContext context, + PiecesContainer pieces + ) { + ListTag saved = (ListTag) pieces.save(context); + return PiecesContainer.load(saved, context); + } + + private static void register( + RegisterGameTestsEvent event, + TestData>> testData, + String name, + Consumer test + ) { + event.registerTest( + Identifier.fromNamespaceAndPath("retold", name), + new InlineGameTest(testData, test) + ); + } + + private static final class InlineGameTest extends FunctionGameTestInstance { + private final Consumer test; + + private InlineGameTest( + TestData>> testData, + Consumer test + ) { + super(BuiltinTestFunctions.ALWAYS_PASS, testData); + this.test = test; + } + + @Override + public void run(GameTestHelper helper) { + test.accept(helper); + } + } +} diff --git a/src/main/java/cz/xefensor/retold/worldgen/earth/RetoldEarthMazePursuitGameTests.java b/src/main/java/cz/xefensor/retold/worldgen/earth/RetoldEarthMazePursuitGameTests.java new file mode 100644 index 00000000..cf3dbf20 --- /dev/null +++ b/src/main/java/cz/xefensor/retold/worldgen/earth/RetoldEarthMazePursuitGameTests.java @@ -0,0 +1,180 @@ +package cz.xefensor.retold.worldgen.earth; + +import cz.xefensor.retold.registry.RetoldEntityTypes; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.core.Holder; +import net.minecraft.gametest.framework.BuiltinTestFunctions; +import net.minecraft.gametest.framework.FunctionGameTestInstance; +import net.minecraft.gametest.framework.GameTestHelper; +import net.minecraft.gametest.framework.GameTestInfo; +import net.minecraft.gametest.framework.GameTestListener; +import net.minecraft.gametest.framework.GameTestRunner; +import net.minecraft.gametest.framework.TestData; +import net.minecraft.gametest.framework.TestEnvironmentDefinition; +import net.minecraft.resources.Identifier; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.server.level.TicketType; +import net.minecraft.world.entity.EntitySpawnReason; +import net.minecraft.world.level.ChunkPos; +import net.minecraft.world.level.GameType; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.gameevent.GameEvent; +import net.minecraft.world.level.gamerules.GameRules; +import net.minecraft.world.phys.Vec3; +import net.neoforged.neoforge.event.RegisterGameTestsEvent; + +import java.util.ArrayDeque; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** Integration against generated chamber/tunnel geometry, not a hand-built straight corridor. */ +final class RetoldEarthMazePursuitGameTests { + private RetoldEarthMazePursuitGameTests() { + } + + static void register(RegisterGameTestsEvent event, Holder> environment) { + var data = new TestData<>(environment, Identifier.withDefaultNamespace("empty"), 2400, 0, true); + event.registerTest(Identifier.fromNamespaceAndPath("retold", "earth_guardian_pursues_into_generated_maze"), + new FunctionGameTestInstance(BuiltinTestFunctions.ALWAYS_PASS, data) { + @Override + public void run(GameTestHelper helper) { + pursue(helper); + } + }); + } + + private static void pursue(GameTestHelper helper) { + ServerLevel level = helper.getLevel(); + BlockPos center = helper.absolutePos(new BlockPos(96, 96, 96)); + long seed = 0x4C41425952494E54L; + var piece = new EarthLabyrinthPiece(center.getX(), center.getZ(), center.getY(), + center, Direction.EAST, seed); + var source = piece.guardianSource(); + BlockPos feet = source.guardianPosition(); + var ticket = ChunkPos.containing(feet); + level.getChunkSource().addTicketWithRadius(TicketType.FORCED, ticket, 8); + boolean oldGriefing = level.getGameRules().get(GameRules.MOB_GRIEFING); + level.getGameRules().set(GameRules.MOB_GRIEFING, true, level.getServer()); + // Supply the underground host stone that a void GameTest world otherwise lacks. + var bounds = source.structureBounds(); + for (int x = bounds.minX(); x <= bounds.maxX(); x++) { + for (int z = bounds.minZ(); z <= bounds.maxZ(); z++) { + for (int y = feet.getY() - 6; y <= feet.getY() + 12; y++) { + level.setBlock(new BlockPos(x, y, z), Blocks.STONE.defaultBlockState(), 2); + } + } + } + EarthLabyrinthGenerator.generate(level, bounds, center.getX(), center.getZ(), center.getY(), + center, Direction.EAST, seed); + List trail = playerTrail(level, feet); + helper.assertTrue(!trail.isEmpty(), "Generated lower floor must have a player route out of the arena"); + EarthGuardianEncounterData.get(level).setLifecycle(source.key(), EarthGuardianLifecycle.ROAMING); + var guardian = RetoldEntityTypes.EARTH_GUARDIAN.get().create(level, EntitySpawnReason.STRUCTURE); + helper.assertTrue(guardian != null, "Guardian must be registered"); + guardian.configureForLabyrinth(level, source, EarthGuardianLifecycle.ROAMING); + level.addFreshEntity(guardian); + ServerPlayer player = (ServerPlayer) helper.makeMockServerPlayer(GameType.SURVIVAL); + int[] progress = {Math.min(8, trail.size() - 1)}; + int[] heard = {0}; + boolean[] erupted = {false}; + cleanupAfterTest(helper, () -> { + guardian.discard(); + player.discard(); + level.getGameRules().set(GameRules.MOB_GRIEFING, oldGriefing, level.getServer()); + level.getChunkSource().removeTicketWithRadius(TicketType.FORCED, ticket, 8); + }); + helper.onEachTick(() -> { + if (!guardian.isAlive()) { + return; + } + if (guardian.tickCount % 10 == 0) { + erupted[0] |= trail.stream().anyMatch(pos -> level.getBlockState(pos.below()).is(Blocks.LAVA)); + player.setPos(Vec3.atBottomCenterOf(trail.get(progress[0]))); + level.gameEvent(GameEvent.STEP, player.position(), GameEvent.Context.of(player)); + if (guardian.tickCount > 40 && progress[0] < trail.size() - 1) { + progress[0]++; + } + } + if (guardian.tickCount % 40 == 0) { + EarthGuardianSpawner.spawnIfNeeded(level, source); + } + if (guardian.vibrationTarget() != null) { + heard[0]++; + } + }); + helper.startSequence() + .thenWaitUntil(() -> helper.assertTrue( + guardian.position().distanceToSqr(Vec3.atBottomCenterOf(trail.getLast())) < 25.0D + && guardian.position().distanceToSqr(Vec3.atBottomCenterOf(feet)) > 324.0D, + "Guardian must leave its generated arena and approach the heard player in the maze" + + "; pos=" + guardian.position() + ", origin=" + feet + ", end=" + trail.getLast() + + ", ticks=" + guardian.tickCount + ", heard=" + heard[0] + + ", clue=" + guardian.vibrationTarget() + ", health=" + guardian.getHealth() + + ", removed=" + guardian.getRemovalReason() + ", reserve=" + guardian.terrainReserveSize() + + ", path=" + guardian.getNavigation().getPath() + ", route=" + guardian.routeDescription())) + .thenExecute(() -> { + helper.assertTrue(heard[0] > 0 && guardian.getTarget() == null, + "Pursuit must use actual dispatched footsteps without a sight target"); + helper.assertTrue(erupted[0], "Pursuit must survive a real lava eruption on the player's trail"); + cz.xefensor.retold.Retold.LOGGER.info("EARTH_MAZE_PURSUIT ticks={}, origin={}, reached={}, lavaSeen={}", + guardian.tickCount, feet, guardian.position(), erupted[0]); + }) + .thenSucceed(); + } + + private static void cleanupAfterTest(GameTestHelper helper, Runnable cleanup) { + helper.testInfo.addListener(new GameTestListener() { + @Override + public void testStructureLoaded(GameTestInfo info) { + } + + @Override + public void testPassed(GameTestInfo info, GameTestRunner runner) { + cleanup.run(); + } + + @Override + public void testFailed(GameTestInfo info, GameTestRunner runner) { + cleanup.run(); + } + + @Override + public void testAddedForRerun(GameTestInfo original, GameTestInfo copy, GameTestRunner runner) { + } + }); + } + + private static List playerTrail(ServerLevel level, BlockPos start) { + var queue = new ArrayDeque(); + Map previous = new HashMap<>(); + queue.add(start); + previous.put(start, start); + while (!queue.isEmpty()) { + BlockPos current = queue.removeFirst(); + if (current.distSqr(start) >= 24 * 24) { + List trail = new ArrayList<>(); + for (BlockPos pos = current; !pos.equals(start); pos = previous.get(pos)) { + trail.add(pos); + } + trail.add(start); + Collections.reverse(trail); + return List.copyOf(trail); + } + for (Direction direction : Direction.Plane.HORIZONTAL) { + BlockPos next = current.relative(direction); + if (!previous.containsKey(next) && next.distSqr(start) <= 26 * 26 + && level.getBlockState(next).isAir() && level.getBlockState(next.above()).isAir() + && !level.getBlockState(next.below()).getCollisionShape(level, next.below()).isEmpty()) { + previous.put(next, current); + queue.addLast(next); + } + } + } + return List.of(); + } +} diff --git a/src/main/java/cz/xefensor/retold/worldgen/earth/RetoldEarthRoomGameTests.java b/src/main/java/cz/xefensor/retold/worldgen/earth/RetoldEarthRoomGameTests.java new file mode 100644 index 00000000..b95f487c --- /dev/null +++ b/src/main/java/cz/xefensor/retold/worldgen/earth/RetoldEarthRoomGameTests.java @@ -0,0 +1,108 @@ +package cz.xefensor.retold.worldgen.earth; + +import net.minecraft.core.BlockPos; +import net.minecraft.core.Holder; +import net.minecraft.gametest.framework.BuiltinTestFunctions; +import net.minecraft.gametest.framework.FunctionGameTestInstance; +import net.minecraft.gametest.framework.GameTestHelper; +import net.minecraft.gametest.framework.TestData; +import net.minecraft.gametest.framework.TestEnvironmentDefinition; +import net.minecraft.resources.Identifier; +import net.minecraft.server.level.TicketType; +import net.minecraft.world.entity.EntityTypes; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; +import net.minecraft.world.level.ChunkPos; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.entity.ChestBlockEntity; +import net.minecraft.world.level.block.entity.DispenserBlockEntity; +import net.minecraft.world.level.levelgen.structure.BoundingBox; +import net.minecraft.world.phys.Vec3; +import net.neoforged.neoforge.event.RegisterGameTestsEvent; + +final class RetoldEarthRoomGameTests { + private RetoldEarthRoomGameTests() { + } + + static void register(RegisterGameTestsEvent event, TestData>> data) { + event.registerTest(Identifier.fromNamespaceAndPath("retold", "earth_rooms_keep_loot_and_fire_across_chunk_border"), + new FunctionGameTestInstance(BuiltinTestFunctions.ALWAYS_PASS, data) { + @Override + public void run(GameTestHelper helper) { + roomContents(helper); + } + }); + } + + private static void roomContents(GameTestHelper helper) { + var level = helper.getLevel(); + BlockPos anchor = helper.absolutePos(new BlockPos(8, 4, 8)); + BlockPos floor = new BlockPos((anchor.getX() & ~15) + 14, anchor.getY(), anchor.getZ()); + ChunkPos ticket = new ChunkPos(floor.getX() >> 4, floor.getZ() >> 4); + level.getChunkSource().addTicketWithRadius(TicketType.FORCED, ticket, 2); + for (int x = -3; x <= 3; x++) { + for (int z = -3; z <= 3; z++) { + level.setBlockAndUpdate(floor.offset(x, 0, z), Blocks.STONE.defaultBlockState()); + } + } + BoundingBox left = new BoundingBox(floor.getX() - 14, level.getMinY(), floor.getZ() - 4, + floor.getX() + 1, level.getMaxY(), floor.getZ() + 4); + BoundingBox right = new BoundingBox(floor.getX() + 2, level.getMinY(), floor.getZ() - 4, + floor.getX() + 17, level.getMaxY(), floor.getZ() + 4); + var trap = new EarthLabyrinthRooms.Room(new EarthLabyrinthLayout.Cell(0, 0, 0), + 1, 0, EarthLabyrinthRooms.Kind.ARROW_TRAP, 17L); + BlockPos dispenserPos = floor.east(2).above(); + EarthLabyrinthRoomPlacement.place(level, left, trap, floor); + helper.assertTrue(level.getBlockEntity(dispenserPos) == null, "Placement must not cross its chunk boundary"); + EarthLabyrinthRoomPlacement.place(level, right, trap, floor); + helper.assertTrue(level.getBlockEntity(dispenserPos) instanceof DispenserBlockEntity, + "The adjacent chunk must complete the dispenser"); + DispenserBlockEntity dispenser = (DispenserBlockEntity) level.getBlockEntity(dispenserPos); + helper.assertValueEqual(dispenser.getLootTable(), EarthLabyrinthRoomPlacement.ARROWS, "Trap loot table"); + dispenser.unpackLootTable(null); + int arrows = arrowCount(dispenser); + helper.assertTrue(arrows >= 8 && arrows <= 16, "The trap must have finite live ammunition"); + + var treasure = new EarthLabyrinthRooms.Room(new EarthLabyrinthLayout.Cell(1, 0, 0), + 0, 1, EarthLabyrinthRooms.Kind.TREASURE, 31L); + BlockPos treasureFloor = floor.west(2); + EarthLabyrinthRoomPlacement.place(level, left, treasure, treasureFloor); + ChestBlockEntity chest = (ChestBlockEntity) level.getBlockEntity(treasureFloor.south().above()); + helper.assertValueEqual(chest.getLootTable(), EarthLabyrinthRoomPlacement.TREASURE, "Treasure loot table"); + chest.unpackLootTable(null); + helper.assertTrue(!chest.isEmpty(), "Treasure must generate real loot"); + for (int slot = 0; slot < chest.getContainerSize(); slot++) { + helper.assertFalse(chest.getItem(slot).is(Items.LODESTONE), "Side treasure must not award the boss artifact"); + } + chest.clearContent(); + chest.setItem(0, new ItemStack(Items.STICK, 3)); + EarthLabyrinthRoomPlacement.place(level, left, treasure, treasureFloor); + helper.assertTrue(chest.getLootTable() == null && chest.getItem(0).getCount() == 3, + "Repeated chunk placement must not refill or overwrite a container"); + + var victim = EntityTypes.ZOMBIE.create(level, net.minecraft.world.entity.EntitySpawnReason.COMMAND); + helper.assertTrue(victim != null, "Trap victim must spawn"); + victim.setNoAi(true); + victim.setPos(Vec3.atBottomCenterOf(floor.east().above())); + level.addFreshEntity(victim); + helper.startSequence() + .thenWaitUntil(() -> helper.assertTrue(arrowCount(dispenser) < arrows, + "Standing on the pressure plate must fire real dispenser ammunition")) + .thenExecute(() -> { + victim.discard(); + level.getChunkSource().removeTicketWithRadius(TicketType.FORCED, ticket, 2); + }) + .thenSucceed(); + } + + private static int arrowCount(DispenserBlockEntity dispenser) { + int count = 0; + for (int slot = 0; slot < dispenser.getContainerSize(); slot++) { + ItemStack stack = dispenser.getItem(slot); + if (stack.is(Items.ARROW)) { + count += stack.getCount(); + } + } + return count; + } +} diff --git a/src/main/java/cz/xefensor/retold/worldgen/earth/RetoldEarthTerrainGameTests.java b/src/main/java/cz/xefensor/retold/worldgen/earth/RetoldEarthTerrainGameTests.java new file mode 100644 index 00000000..3a4cb795 --- /dev/null +++ b/src/main/java/cz/xefensor/retold/worldgen/earth/RetoldEarthTerrainGameTests.java @@ -0,0 +1,233 @@ +package cz.xefensor.retold.worldgen.earth; + +import cz.xefensor.retold.api.world.RetoldWorldMutationType; +import cz.xefensor.retold.api.world.RetoldWorldProtection; +import cz.xefensor.retold.registry.RetoldEntityTypes; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.core.Holder; +import net.minecraft.gametest.framework.BuiltinTestFunctions; +import net.minecraft.gametest.framework.FunctionGameTestInstance; +import net.minecraft.gametest.framework.GameTestHelper; +import net.minecraft.gametest.framework.TestData; +import net.minecraft.gametest.framework.TestEnvironmentDefinition; +import net.minecraft.resources.Identifier; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.entity.EntitySpawnReason; +import net.minecraft.world.entity.EntityTypes; +import net.minecraft.world.level.GameType; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.gameevent.GameEvent; +import net.minecraft.world.level.gamerules.GameRules; +import net.neoforged.neoforge.event.RegisterGameTestsEvent; + +final class RetoldEarthTerrainGameTests { + private RetoldEarthTerrainGameTests() { + } + + static void register(RegisterGameTestsEvent event, Holder> environment) { + var data = new TestData<>(environment, Identifier.withDefaultNamespace("empty"), 40, 0, true); + event.registerTest(Identifier.fromNamespaceAndPath("retold", "earth_guardian_relocates_fluids_without_stalling"), + new FunctionGameTestInstance(BuiltinTestFunctions.ALWAYS_PASS, data) { + @Override + public void run(GameTestHelper helper) { + relocateFluids(helper); + } + }); + event.registerTest(Identifier.fromNamespaceAndPath("retold", "earth_guardian_batches_excavation_with_protection"), + new FunctionGameTestInstance(BuiltinTestFunctions.ALWAYS_PASS, data) { + @Override + public void run(GameTestHelper helper) { + batchExcavation(helper); + } + }); + event.registerTest(Identifier.fromNamespaceAndPath("retold", "earth_guardian_builds_conserved_trailing_walls"), + new FunctionGameTestInstance(BuiltinTestFunctions.ALWAYS_PASS, data) { + @Override + public void run(GameTestHelper helper) { + trailingWalls(helper); + } + }); + } + + private static BlockPos prepareFloor(GameTestHelper helper) { + BlockPos origin = helper.absolutePos(new BlockPos(8, 4, 8)); + for (int x = -8; x <= 16; x++) { + for (int z = -4; z <= 4; z++) { + for (int y = -1; y <= 5; y++) { + helper.getLevel().setBlock(origin.offset(x, y, z), y == -1 + ? Blocks.STONE.defaultBlockState() : Blocks.AIR.defaultBlockState(), 2); + } + } + } + return origin; + } + + private static void relocateFluids(GameTestHelper helper) { + var level = helper.getLevel(); + BlockPos origin = prepareFloor(helper); + var guardian = guardian(helper, origin); + BlockPos source = origin.east(6); + BlockPos destination = origin.east(10); + boolean oldGriefing = level.getGameRules().get(GameRules.MOB_GRIEFING); + level.getGameRules().set(GameRules.MOB_GRIEFING, true, level.getServer()); + try { + level.setBlock(source, Blocks.LAVA.defaultBlockState(), 2); + var protection = RetoldWorldProtection.register( + Identifier.fromNamespaceAndPath("retold", "earth_fluid_denial"), + context -> !context.pos().equals(source)); + try { + helper.assertTrue(!guardian.tryExcavateBlock(level, source), "Protected lava must remain untouched"); + } finally { + protection.close(); + } + level.getGameRules().set(GameRules.MOB_GRIEFING, false, level.getServer()); + helper.assertTrue(!guardian.tryExcavateBlock(level, source), "Griefing denial must also protect fluids"); + helper.assertValueEqual(guardian.terrainReserveSize(), 0, "Denied fluids must grant no material"); + level.getGameRules().set(GameRules.MOB_GRIEFING, true, level.getServer()); + var states = java.util.List.of( + Blocks.LAVA.defaultBlockState(), + Blocks.WATER.defaultBlockState(), + Blocks.LAVA.defaultBlockState().setValue(net.minecraft.world.level.block.LiquidBlock.LEVEL, 5), + Blocks.OAK_SLAB.defaultBlockState().setValue( + net.minecraft.world.level.block.state.properties.BlockStateProperties.WATERLOGGED, true)); + for (var state : states) { + level.setBlock(source, state, 2); + level.setBlock(destination, Blocks.AIR.defaultBlockState(), 2); + helper.assertTrue(guardian.tryExcavateBlock(level, source), "Fluid-bearing state must actually be excavated: " + state); + helper.assertTrue(level.getBlockState(source).isAir() && level.getFluidState(source).isEmpty(), + "Excavation must not leave a source/flowing/waterlogged fluid behind"); + helper.assertValueEqual(guardian.terrainReserveSize(), 1, "Exactly one complete state must enter the reserve"); + helper.assertTrue(!guardian.tryExcavateBlock(level, source), "The emptied source must not duplicate material"); + helper.assertTrue(guardian.tryPlaceReservedBlock(level, destination), "Stored fluid-bearing state must remain relocatable"); + helper.assertTrue(level.getBlockState(destination).equals(state), "Relocation must preserve the exact fluid-bearing state"); + helper.assertValueEqual(guardian.terrainReserveSize(), 0, "Successful placement must spend the state"); + } + helper.succeed(); + } finally { + guardian.discard(); + level.setBlock(source, Blocks.AIR.defaultBlockState(), 2); + level.setBlock(destination, Blocks.AIR.defaultBlockState(), 2); + level.getGameRules().set(GameRules.MOB_GRIEFING, oldGriefing, level.getServer()); + } + } + + private static EarthGuardian guardian(GameTestHelper helper, BlockPos origin) { + var guardian = helper.spawn(RetoldEntityTypes.EARTH_GUARDIAN.get(), + 8.5D, 4.0D, 8.5D, EntitySpawnReason.COMMAND); + guardian.setNoAi(true); + ServerPlayer source = (ServerPlayer) helper.makeMockServerPlayer(GameType.SURVIVAL); + guardian.getVibrationUser().onReceiveVibration(helper.getLevel(), origin.east(14), + GameEvent.STEP, source, null, 14.0F); + source.discard(); + return guardian; + } + + private static void batchExcavation(GameTestHelper helper) { + var level = helper.getLevel(); + BlockPos origin = prepareFloor(helper); + var guardian = guardian(helper, origin); + boolean oldGriefing = level.getGameRules().get(GameRules.MOB_GRIEFING); + level.getGameRules().set(GameRules.MOB_GRIEFING, true, level.getServer()); + for (int x = 2; x <= 4; x++) { + for (int y = 0; y < 4; y++) { + for (int z = -1; z <= 1; z++) { + level.setBlock(origin.offset(x, y, z), x == 3 + ? Blocks.BEDROCK.defaultBlockState() : Blocks.STONE.defaultBlockState(), 2); + } + } + } + try { + guardian.tickTerrainControl(level); + helper.assertValueEqual(guardian.terrainReserveSize(), 12, "One pulse must excavate a complete 3-by-4 slice, not one block"); + for (int y = 0; y < 4; y++) { + for (int z = -1; z <= 1; z++) { + helper.assertTrue(level.getBlockState(origin.offset(2, y, z)).isAir(), "The first full slice must be open"); + } + } + guardian.tickTerrainControl(level); + helper.assertValueEqual(guardian.terrainReserveSize(), 12, "Repeated same-tick calls must not exceed the pulse budget"); + guardian.tickCount += 10; + guardian.tickTerrainControl(level); + helper.assertValueEqual(guardian.terrainReserveSize(), 24, "The next half-second pulse must also excavate Bedrock"); + var protection = RetoldWorldProtection.register(Identifier.fromNamespaceAndPath("retold", "earth_batch_stop"), + context -> context.type() != RetoldWorldMutationType.MOB_BREAK || guardian.terrainReserveSize() < 28); + try { + guardian.tickCount += 10; + guardian.tickTerrainControl(level); + helper.assertValueEqual(guardian.terrainReserveSize(), 28, "A mid-pulse denial must stop excavation without extra material"); + } finally { + protection.close(); + } + level.getGameRules().set(GameRules.MOB_GRIEFING, false, level.getServer()); + guardian.tickCount += 10; + guardian.tickTerrainControl(level); + helper.assertValueEqual(guardian.terrainReserveSize(), 28, "Griefing denial must stop the complete batch"); + helper.succeed(); + } finally { + guardian.discard(); + level.getGameRules().set(GameRules.MOB_GRIEFING, oldGriefing, level.getServer()); + } + } + + private static void gather(GameTestHelper helper, EarthGuardian guardian, BlockPos origin, int count) { + for (int index = 0; index < count; index++) { + BlockPos donor = origin.offset(10 + index % 6, 4, index / 6 - 2); + helper.getLevel().setBlock(donor, Blocks.STONE.defaultBlockState(), 2); + helper.assertTrue(guardian.tryExcavateBlock(helper.getLevel(), donor), "Fixture material must be physically excavated"); + } + } + + private static void trailingWalls(GameTestHelper helper) { + var level = helper.getLevel(); + BlockPos origin = prepareFloor(helper); + var guardian = guardian(helper, origin); + boolean oldGriefing = level.getGameRules().get(GameRules.MOB_GRIEFING); + level.getGameRules().set(GameRules.MOB_GRIEFING, true, level.getServer()); + var blocker = helper.spawn(EntityTypes.ZOMBIE, 5.5D, 4.0D, 8.5D, EntitySpawnReason.COMMAND); + blocker.setNoAi(true); + blocker.setPos(blocker.position().add(0, 0, 3)); + BlockPos wall = origin.west(3); + try { + gather(helper, guardian, origin, 24); + guardian.tickTerrainControl(level); + helper.assertValueEqual(guardian.terrainReserveSize(), 15, "The production pulse must build a nine-block wall from stored material"); + for (int y = 0; y < 3; y++) { + for (int z = -1; z <= 1; z++) { + BlockPos pos = wall.offset(0, y, z); + helper.assertTrue(level.getBlockState(pos).is(Blocks.STONE), "The trailing wall must be a coherent 3-by-3 plane"); + } + } + gather(helper, guardian, origin, 12); + guardian.tickCount += 10; + guardian.tickTerrainControl(level); + helper.assertValueEqual(guardian.terrainReserveSize(), 27, "Wall creation must respect its separate two-second cadence"); + for (int y = 0; y < 3; y++) { + for (int z = -1; z <= 1; z++) { + level.setBlock(wall.offset(0, y, z), Blocks.AIR.defaultBlockState(), 2); + } + } + level.getGameRules().set(GameRules.MOB_GRIEFING, false, level.getServer()); + helper.assertValueEqual(EarthGuardianWalls.buildBehind(level, guardian, Direction.EAST), 0, "Griefing denial must prevent wall building"); + level.getGameRules().set(GameRules.MOB_GRIEFING, true, level.getServer()); + BlockPos protectedCell = wall.north().above(); + var protection = RetoldWorldProtection.register(Identifier.fromNamespaceAndPath("retold", "earth_wall_cell"), + context -> !context.pos().equals(protectedCell)); + blocker.setPos(net.minecraft.world.phys.Vec3.atBottomCenterOf(wall)); + try { + int placed = EarthGuardianWalls.buildBehind(level, guardian, Direction.EAST); + helper.assertValueEqual(placed, 6, "The wall must skip the protected cell and two occupied cells"); + helper.assertValueEqual(guardian.terrainReserveSize(), 27 - placed, "Only successfully placed wall cells may consume material"); + helper.assertTrue(level.getBlockState(protectedCell).isAir(), "The protected wall cell must stay empty"); + helper.assertTrue(level.getBlockState(wall).isAir() && level.getBlockState(wall.above()).isAir(), "Walls must not be placed inside entities"); + } finally { + protection.close(); + } + helper.succeed(); + } finally { + blocker.discard(); + guardian.discard(); + level.getGameRules().set(GameRules.MOB_GRIEFING, oldGriefing, level.getServer()); + } + } +} diff --git a/src/main/java/cz/xefensor/retold/worldgen/earth/RetoldEarthTraversalGameTests.java b/src/main/java/cz/xefensor/retold/worldgen/earth/RetoldEarthTraversalGameTests.java new file mode 100644 index 00000000..a0e9671d --- /dev/null +++ b/src/main/java/cz/xefensor/retold/worldgen/earth/RetoldEarthTraversalGameTests.java @@ -0,0 +1,265 @@ +package cz.xefensor.retold.worldgen.earth; + +import cz.xefensor.retold.registry.RetoldEntityTypes; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Holder; +import net.minecraft.gametest.framework.BuiltinTestFunctions; +import net.minecraft.gametest.framework.FunctionGameTestInstance; +import net.minecraft.gametest.framework.GameTestHelper; +import net.minecraft.gametest.framework.TestData; +import net.minecraft.gametest.framework.TestEnvironmentDefinition; +import net.minecraft.resources.Identifier; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.server.level.TicketType; +import net.minecraft.world.entity.EntitySpawnReason; +import net.minecraft.world.level.ChunkPos; +import net.minecraft.world.level.GameType; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.gameevent.GameEvent; +import net.minecraft.world.level.gamerules.GameRules; +import net.minecraft.world.phys.Vec3; +import net.neoforged.neoforge.event.RegisterGameTestsEvent; + +final class RetoldEarthTraversalGameTests { + private RetoldEarthTraversalGameTests() { + } + + static void register(RegisterGameTestsEvent event, Holder> environment) { + var pursuitData = new TestData<>(environment, Identifier.withDefaultNamespace("empty"), 2000, 0, true); + event.registerTest(Identifier.fromNamespaceAndPath("retold", "earth_guardian_follows_real_steps_into_tunnel"), + new FunctionGameTestInstance(BuiltinTestFunctions.ALWAYS_PASS, pursuitData) { + @Override + public void run(GameTestHelper helper) { + followRealSteps(helper); + } + }); + var policyData = new TestData<>(environment, Identifier.withDefaultNamespace("empty"), 40, 0, true); + event.registerTest(Identifier.fromNamespaceAndPath("retold", "earth_guardian_ramp_conserves_and_respects_protection"), + new FunctionGameTestInstance(BuiltinTestFunctions.ALWAYS_PASS, policyData) { + @Override + public void run(GameTestHelper helper) { + routePolicy(helper); + } + }); + for (int rise : new int[]{0, 14, -14}) { + String name = rise == 0 ? "low_tunnel" : rise > 0 ? "ascending_ramp" : "descending_ramp"; + // A solid-bank ramp includes hundreds of batched edits and conserved backfill. + var data = new TestData<>(environment, Identifier.withDefaultNamespace("empty"), 24000, 0, true); + event.registerTest(Identifier.fromNamespaceAndPath("retold", "earth_guardian_carves_" + name), + new FunctionGameTestInstance(BuiltinTestFunctions.ALWAYS_PASS, data) { + @Override + public void run(GameTestHelper helper) { + traverse(helper, rise); + } + }); + } + } + + private static void followRealSteps(GameTestHelper helper) { + var level = helper.getLevel(); + BlockPos origin = helper.absolutePos(new BlockPos(8, 4, 8)); + ChunkPos ticket = new ChunkPos(origin.getX() >> 4, origin.getZ() >> 4); + level.getChunkSource().addTicketWithRadius(TicketType.FORCED, ticket, 4); + boolean oldGriefing = level.getGameRules().get(GameRules.MOB_GRIEFING); + level.getGameRules().set(GameRules.MOB_GRIEFING, true, level.getServer()); + for (int x = -4; x <= 22; x++) { + for (int z = -5; z <= 5; z++) { + for (int y = -1; y <= 7; y++) { + boolean solid = y < 0 || (x >= 3 && (Math.abs(z) >= 2 || y >= 3)); + level.setBlock(origin.offset(x, y, z), solid + ? Blocks.STONE.defaultBlockState() : Blocks.AIR.defaultBlockState(), 2); + } + } + } + var guardian = helper.spawn(RetoldEntityTypes.EARTH_GUARDIAN.get(), + 8.5D, 4.0D, 8.5D, EntitySpawnReason.COMMAND); + ServerPlayer player = (ServerPlayer) helper.makeMockServerPlayer(GameType.SURVIVAL); + player.setPos(Vec3.atBottomCenterOf(origin.east(14))); + // VibrationInfo retains the live source reference. Do not register this clientless mock + // for vanilla entity tracking, which requires a real player network connection. + // Keep combat enabled but protect the remote player pad, isolating route construction + // from destruction of the fixture's destination. No direct vibration callback is used. + var protection = cz.xefensor.retold.api.world.RetoldWorldProtection.register( + Identifier.fromNamespaceAndPath("retold", "earth_real_steps_pad"), + context -> context.pos().getX() < origin.getX() + 12); + int[] heard = {0}; + helper.onEachTick(() -> { + if (!guardian.isAlive()) { + return; + } + if (guardian.tickCount % 20 == 0) { + player.setPos(Vec3.atBottomCenterOf(origin.offset(14 + (guardian.tickCount / 20) % 2, 0, 0))); + level.gameEvent(GameEvent.STEP, player.position(), GameEvent.Context.of(player)); + } + if (guardian.vibrationTarget() != null) { + heard[0]++; + } + }); + helper.startSequence() + .thenWaitUntil(() -> helper.assertTrue( + guardian.getX() > origin.getX() + 8, + "Real moving footsteps must draw the full-sized guardian into its carved tunnel" + + "; pos=" + guardian.position() + ", heard=" + heard[0] + + ", clue=" + guardian.vibrationTarget() + ", path=" + guardian.getNavigation().getPath() + + ", reserve=" + guardian.terrainReserveSize() + ", route=" + guardian.routeDescription())) + .thenExecute(() -> { + helper.assertTrue(heard[0] > 0, "Real event delivery must reach the listener"); + helper.assertTrue(level.getBlockState(origin.offset(5, 3, 0)).isAir(), "The tunnel ceiling must be physically widened"); + helper.assertTrue(guardian.getTarget() == null, "Hearing must not grant a sight target"); + protection.close(); + player.discard(); + guardian.discard(); + level.getGameRules().set(GameRules.MOB_GRIEFING, oldGriefing, level.getServer()); + level.getChunkSource().removeTicketWithRadius(TicketType.FORCED, ticket, 4); + }) + .thenSucceed(); + } + + private static void routePolicy(GameTestHelper helper) { + var level = helper.getLevel(); + BlockPos feet = helper.absolutePos(new BlockPos(8, 4, 8)); + for (int x = -3; x <= 5; x++) { + for (int z = -3; z <= 3; z++) { + for (int y = -1; y <= 5; y++) { + level.setBlock(feet.offset(x, y, z), y == -1 ? Blocks.STONE.defaultBlockState() + : Blocks.AIR.defaultBlockState(), 2); + } + } + } + var guardian = helper.spawn(RetoldEntityTypes.EARTH_GUARDIAN.get(), + 8.5D, 4.0D, 8.5D, EntitySpawnReason.COMMAND); + guardian.setNoAi(true); + var route = new EarthGuardianRoute(guardian); + BlockPos roof = feet.above(3); + BlockPos support = feet.east(2).north(); + BlockPos clue = feet.east(12).above(14); + level.setBlock(roof, Blocks.STONE.defaultBlockState(), 2); + boolean oldGriefing = level.getGameRules().get(GameRules.MOB_GRIEFING); + level.getGameRules().set(GameRules.MOB_GRIEFING, true, level.getServer()); + var denyBreak = cz.xefensor.retold.api.world.RetoldWorldProtection.register( + Identifier.fromNamespaceAndPath("retold", "earth_route_break"), + context -> !context.pos().equals(roof)); + try { + route.tick(level, clue); + helper.assertTrue(level.getBlockState(roof).is(Blocks.STONE) && guardian.terrainReserveSize() == 0, + "Protected headroom must not be excavated or grant reserve material"); + } finally { + denyBreak.close(); + } + try { + route.tick(level, clue); + helper.assertTrue(level.getBlockState(roof).isAir() && guardian.terrainReserveSize() == 1, + "One ceiling removal must produce exactly one reserve state"); + level.getGameRules().set(GameRules.MOB_GRIEFING, false, level.getServer()); + route.tick(level, clue); + helper.assertTrue(level.getBlockState(support).isAir() && guardian.terrainReserveSize() == 1, + "Disabling griefing during construction must prevent support placement"); + level.getGameRules().set(GameRules.MOB_GRIEFING, true, level.getServer()); + var denyPlace = cz.xefensor.retold.api.world.RetoldWorldProtection.register( + Identifier.fromNamespaceAndPath("retold", "earth_route_place"), + context -> !context.pos().equals(support)); + try { + route.tick(level, clue); + helper.assertTrue(level.getBlockState(support).isAir() && guardian.terrainReserveSize() == 1, + "Denied placement must not consume a reserved block"); + } finally { + denyPlace.close(); + } + route.tick(level, clue); + helper.assertTrue(level.getBlockState(support).is(Blocks.STONE) && guardian.terrainReserveSize() == 0, + "A ramp step must spend the exact excavated stone state"); + var output = net.minecraft.world.level.storage.TagValueOutput.createWithContext( + net.minecraft.util.ProblemReporter.DISCARDING, level.registryAccess()); + route.save(output); + var restored = new EarthGuardianRoute(guardian); + restored.load(net.minecraft.world.level.storage.TagValueInput.create( + net.minecraft.util.ProblemReporter.DISCARDING, level.registryAccess(), output.buildResult())); + restored.tick(level, feet.west(12).above(14)); + var reSaved = net.minecraft.world.level.storage.TagValueOutput.createWithContext( + net.minecraft.util.ProblemReporter.DISCARDING, level.registryAccess()); + restored.save(reSaved); + helper.assertValueEqual(reSaved.buildResult().getIntOr("retold_ramp_direction", -1), + net.minecraft.core.Direction.EAST.get2DDataValue(), + "Reload must retain the uphill heading instead of reversing onto the preceding steps"); + for (int index = 0; index < 140; index++) { + BlockPos donor = feet.offset(index % 14, 0, 10 + index / 14); + level.setBlock(donor, Blocks.STONE.defaultBlockState(), 2); + guardian.tryExcavateBlock(level, donor); + } + helper.assertValueEqual(guardian.terrainReserveSize(), 128, "The expanded reserve must remain bounded"); + var entityOutput = net.minecraft.world.level.storage.TagValueOutput.createWithContext( + net.minecraft.util.ProblemReporter.DISCARDING, level.registryAccess()); + guardian.addAdditionalSaveData(entityOutput); + guardian.readAdditionalSaveData(net.minecraft.world.level.storage.TagValueInput.create( + net.minecraft.util.ProblemReporter.DISCARDING, level.registryAccess(), entityOutput.buildResult())); + helper.assertValueEqual(guardian.terrainReserveSize(), 128, "Reload must preserve the complete reserve"); + helper.succeed(); + } finally { + guardian.discard(); + level.getGameRules().set(GameRules.MOB_GRIEFING, oldGriefing, level.getServer()); + } + } + + private static void traverse(GameTestHelper helper, int rise) { + var level = helper.getLevel(); + BlockPos origin = helper.absolutePos(new BlockPos(8, 22, 8)); + ChunkPos ticket = new ChunkPos(origin.getX() >> 4, origin.getZ() >> 4); + // Entity ticking covers fewer rings than mere chunk loading; the complete ramp can + // extend over forty blocks from its start, with varying chunk alignment between runs. + level.getChunkSource().addTicketWithRadius(TicketType.FORCED, ticket, 8); + boolean previousGriefing = level.getGameRules().get(GameRules.MOB_GRIEFING); + level.getGameRules().set(GameRules.MOB_GRIEFING, true, level.getServer()); + for (int x = -4; x <= 54; x++) { + for (int z = -4; z <= 4; z++) { + for (int y = -16; y <= 19; y++) { + boolean solid = y < 0 || (x >= 2 && y < rise) + || (rise == 0 && x >= 2 && x <= 6 && y == 3); + if (rise < 0 && x >= 22 && y >= rise && y < rise + 4) { + solid = false; + } + level.setBlock(origin.offset(x, y, z), solid + ? Blocks.STONE.defaultBlockState() : Blocks.AIR.defaultBlockState(), 2); + } + } + } + var guardian = helper.spawn(RetoldEntityTypes.EARTH_GUARDIAN.get(), + 8.5D, 22.0D, 8.5D, EntitySpawnReason.COMMAND); + ServerPlayer player = (ServerPlayer) helper.makeMockServerPlayer(GameType.SURVIVAL); + BlockPos clue = origin.offset(rise == 0 ? 30 : 24, rise, rise == 0 ? 0 : 6); + // Isolate walking from combat: the guarded attack pad is beside, not on, the ramp route. + var protection = cz.xefensor.retold.api.world.RetoldWorldProtection.register( + Identifier.fromNamespaceAndPath("retold", "earth_traversal_attack_pad"), + context -> rise == 0 || Math.abs(context.pos().getX() - clue.getX()) > 1 + || Math.abs(context.pos().getZ() - clue.getZ()) > 1); + player.setPos(Vec3.atBottomCenterOf(clue)); + helper.onEachTick(() -> { + if (guardian.isAlive()) { + guardian.getVibrationUser().onReceiveVibration(level, clue, GameEvent.BLOCK_DESTROY, player, null, 28.0F); + } + }); + helper.startSequence() + .thenWaitUntil(() -> helper.assertTrue( + rise == 0 ? guardian.getX() > origin.getX() + 8 + : Math.abs(guardian.getY() - clue.getY()) < 0.4D, + "Guardian must walk its excavated route: rise=" + rise + ", pos=" + guardian.position() + + ", ticks=" + guardian.tickCount + ", reserve=" + guardian.terrainReserveSize() + + ", health=" + guardian.getHealth() + ", removed=" + guardian.isRemoved() + + ", removal=" + guardian.getRemovalReason() + + ", damage=" + guardian.getLastDamageSource() + + ", path=" + guardian.getNavigation().getPath() + + ", route=" + guardian.routeDescription())) + .thenExecute(() -> { + helper.assertTrue(guardian.getTarget() == null, "Terrain pursuit must not grant sight targeting"); + if (rise == 0) { + helper.assertTrue(level.getBlockState(origin.offset(3, 3, 0)).isAir(), + "The low ceiling must actually be excavated for the 3.2-block guardian"); + } + guardian.discard(); + player.discard(); + protection.close(); + level.getGameRules().set(GameRules.MOB_GRIEFING, previousGriefing, level.getServer()); + level.getChunkSource().removeTicketWithRadius(TicketType.FORCED, ticket, 8); + }) + .thenSucceed(); + } +} diff --git a/src/main/resources/assets/retold/equipment/steel.json b/src/main/resources/assets/retold/equipment/steel.json new file mode 100644 index 00000000..a0c45255 --- /dev/null +++ b/src/main/resources/assets/retold/equipment/steel.json @@ -0,0 +1,7 @@ +{ + "layers": { + "humanoid": [{ "texture": "retold:steel" }], + "humanoid_baby": [{ "texture": "retold:steel" }], + "humanoid_leggings": [{ "texture": "retold:steel" }] + } +} diff --git a/src/main/resources/assets/retold/items/earth_guardian_spawn_egg.json b/src/main/resources/assets/retold/items/earth_guardian_spawn_egg.json new file mode 100644 index 00000000..7882759d --- /dev/null +++ b/src/main/resources/assets/retold/items/earth_guardian_spawn_egg.json @@ -0,0 +1,6 @@ +{ + "model": { + "type": "minecraft:model", + "model": "retold:item/earth_guardian_spawn_egg" + } +} diff --git a/src/main/resources/assets/retold/items/flint_spear.json b/src/main/resources/assets/retold/items/flint_spear.json index b7ff880c..32122fea 100644 --- a/src/main/resources/assets/retold/items/flint_spear.json +++ b/src/main/resources/assets/retold/items/flint_spear.json @@ -5,7 +5,7 @@ { "model": { "type": "minecraft:model", - "model": "minecraft:item/stone_spear" + "model": "retold:item/flint_spear" }, "when": [ "gui", @@ -17,7 +17,7 @@ ], "fallback": { "type": "minecraft:model", - "model": "minecraft:item/stone_spear_in_hand" + "model": "retold:item/flint_spear_in_hand" }, "property": "minecraft:display_context" }, diff --git a/src/main/resources/assets/retold/items/gale_core_spawn_egg.json b/src/main/resources/assets/retold/items/gale_core_spawn_egg.json index 99d25346..8918c166 100644 --- a/src/main/resources/assets/retold/items/gale_core_spawn_egg.json +++ b/src/main/resources/assets/retold/items/gale_core_spawn_egg.json @@ -1 +1,6 @@ -{ "model": { "type": "minecraft:model", "model": "retold:item/gale_core_spawn_egg" } } +{ + "model": { + "type": "minecraft:model", + "model": "retold:item/gale_core_spawn_egg" + } +} diff --git a/src/main/resources/assets/retold/items/nether_reactor_core.json b/src/main/resources/assets/retold/items/nether_reactor_core.json index faeb7985..fdf1ad72 100644 --- a/src/main/resources/assets/retold/items/nether_reactor_core.json +++ b/src/main/resources/assets/retold/items/nether_reactor_core.json @@ -1,6 +1,6 @@ { "model": { "type": "minecraft:model", - "model": "minecraft:item/magma_cream" + "model": "retold:item/nether_reactor_core" } } diff --git a/src/main/resources/assets/retold/items/steel_axe.json b/src/main/resources/assets/retold/items/steel_axe.json index 7a0b1b5b..cb14abdd 100644 --- a/src/main/resources/assets/retold/items/steel_axe.json +++ b/src/main/resources/assets/retold/items/steel_axe.json @@ -1,6 +1,6 @@ { "model": { "type": "minecraft:model", - "model": "minecraft:item/iron_axe" + "model": "retold:item/steel_axe" } } diff --git a/src/main/resources/assets/retold/items/steel_boots.json b/src/main/resources/assets/retold/items/steel_boots.json index 745d537f..8bb67e08 100644 --- a/src/main/resources/assets/retold/items/steel_boots.json +++ b/src/main/resources/assets/retold/items/steel_boots.json @@ -1,6 +1,6 @@ { "model": { "type": "minecraft:model", - "model": "minecraft:item/iron_boots" + "model": "retold:item/steel_boots" } } diff --git a/src/main/resources/assets/retold/items/steel_chestplate.json b/src/main/resources/assets/retold/items/steel_chestplate.json index f9546d18..4ab428fb 100644 --- a/src/main/resources/assets/retold/items/steel_chestplate.json +++ b/src/main/resources/assets/retold/items/steel_chestplate.json @@ -1,6 +1,6 @@ { "model": { "type": "minecraft:model", - "model": "minecraft:item/iron_chestplate" + "model": "retold:item/steel_chestplate" } } diff --git a/src/main/resources/assets/retold/items/steel_helmet.json b/src/main/resources/assets/retold/items/steel_helmet.json index e5608517..89724532 100644 --- a/src/main/resources/assets/retold/items/steel_helmet.json +++ b/src/main/resources/assets/retold/items/steel_helmet.json @@ -1,6 +1,6 @@ { "model": { "type": "minecraft:model", - "model": "minecraft:item/iron_helmet" + "model": "retold:item/steel_helmet" } } diff --git a/src/main/resources/assets/retold/items/steel_hoe.json b/src/main/resources/assets/retold/items/steel_hoe.json index 30e9eabd..5b81c887 100644 --- a/src/main/resources/assets/retold/items/steel_hoe.json +++ b/src/main/resources/assets/retold/items/steel_hoe.json @@ -1,6 +1,6 @@ { "model": { "type": "minecraft:model", - "model": "minecraft:item/iron_hoe" + "model": "retold:item/steel_hoe" } } diff --git a/src/main/resources/assets/retold/items/steel_ingot.json b/src/main/resources/assets/retold/items/steel_ingot.json index 7f93d174..14e41a28 100644 --- a/src/main/resources/assets/retold/items/steel_ingot.json +++ b/src/main/resources/assets/retold/items/steel_ingot.json @@ -1,6 +1,6 @@ { "model": { "type": "minecraft:model", - "model": "minecraft:item/iron_ingot" + "model": "retold:item/steel_ingot" } } diff --git a/src/main/resources/assets/retold/items/steel_leggings.json b/src/main/resources/assets/retold/items/steel_leggings.json index b1a9de60..f102799b 100644 --- a/src/main/resources/assets/retold/items/steel_leggings.json +++ b/src/main/resources/assets/retold/items/steel_leggings.json @@ -1,6 +1,6 @@ { "model": { "type": "minecraft:model", - "model": "minecraft:item/iron_leggings" + "model": "retold:item/steel_leggings" } } diff --git a/src/main/resources/assets/retold/items/steel_pickaxe.json b/src/main/resources/assets/retold/items/steel_pickaxe.json index 56450cc3..33a6efe7 100644 --- a/src/main/resources/assets/retold/items/steel_pickaxe.json +++ b/src/main/resources/assets/retold/items/steel_pickaxe.json @@ -1,6 +1,6 @@ { "model": { "type": "minecraft:model", - "model": "minecraft:item/iron_pickaxe" + "model": "retold:item/steel_pickaxe" } } diff --git a/src/main/resources/assets/retold/items/steel_shovel.json b/src/main/resources/assets/retold/items/steel_shovel.json index 33b8afe7..e6b7b585 100644 --- a/src/main/resources/assets/retold/items/steel_shovel.json +++ b/src/main/resources/assets/retold/items/steel_shovel.json @@ -1,6 +1,6 @@ { "model": { "type": "minecraft:model", - "model": "minecraft:item/iron_shovel" + "model": "retold:item/steel_shovel" } } diff --git a/src/main/resources/assets/retold/items/steel_spear.json b/src/main/resources/assets/retold/items/steel_spear.json index a1e4a8d1..4efeafd6 100644 --- a/src/main/resources/assets/retold/items/steel_spear.json +++ b/src/main/resources/assets/retold/items/steel_spear.json @@ -5,7 +5,7 @@ { "model": { "type": "minecraft:model", - "model": "minecraft:item/iron_spear" + "model": "retold:item/steel_spear" }, "when": [ "gui", @@ -17,7 +17,7 @@ ], "fallback": { "type": "minecraft:model", - "model": "minecraft:item/iron_spear_in_hand" + "model": "retold:item/steel_spear_in_hand" }, "property": "minecraft:display_context" }, diff --git a/src/main/resources/assets/retold/items/steel_sword.json b/src/main/resources/assets/retold/items/steel_sword.json index 89ce1080..cf37fc5b 100644 --- a/src/main/resources/assets/retold/items/steel_sword.json +++ b/src/main/resources/assets/retold/items/steel_sword.json @@ -1,6 +1,6 @@ { "model": { "type": "minecraft:model", - "model": "minecraft:item/iron_sword" + "model": "retold:item/steel_sword" } } diff --git a/src/main/resources/assets/retold/lang/en_us.json b/src/main/resources/assets/retold/lang/en_us.json index 579082c6..5df0243a 100644 --- a/src/main/resources/assets/retold/lang/en_us.json +++ b/src/main/resources/assets/retold/lang/en_us.json @@ -67,6 +67,7 @@ "entity.retold.aender_boat": "Aender Boat", "entity.retold.aender_chest_boat": "Aender Chest Boat", "entity.retold.gale_core": "Gale Core", + "entity.retold.earth_guardian": "Earth Guardian", "entity.retold.wildfire": "Wildfire", "filled_map.retold.air_temple": "Air Temple Explorer Map", "item.retold.air_element": "Air Element", @@ -90,6 +91,7 @@ "item.retold.raw_aenderite": "Raw Aenderite", "item.retold.aenderite_ingot": "Aenderite Ingot", "item.retold.gale_core_spawn_egg": "Gale Core Spawn Egg", + "item.retold.earth_guardian_spawn_egg": "Earth Guardian Spawn Egg", "item.retold.nether_reactor_core": "Nether Reactor Core", "item.retold.wildfire_spawn_egg": "Wildfire Spawn Egg", "item.retold.water_element": "Water Element", diff --git a/src/main/resources/assets/retold/models/block/aender_hanging_sign_attached_rot_0.json b/src/main/resources/assets/retold/models/block/aender_hanging_sign_attached_rot_0.json index 9fad70b7..6c6b67d6 100644 --- a/src/main/resources/assets/retold/models/block/aender_hanging_sign_attached_rot_0.json +++ b/src/main/resources/assets/retold/models/block/aender_hanging_sign_attached_rot_0.json @@ -2,6 +2,6 @@ "parent": "minecraft:block/template_attached_hanging_sign_rot_0", "textures": { "all": "retold:block/aender_hanging_sign", - "particle": "minecraft:block/stripped_oak_log" + "particle": "retold:block/stripped_aender_log" } } \ No newline at end of file diff --git a/src/main/resources/assets/retold/models/block/aender_hanging_sign_attached_rot_1.json b/src/main/resources/assets/retold/models/block/aender_hanging_sign_attached_rot_1.json index 243b5d06..0ba34e7f 100644 --- a/src/main/resources/assets/retold/models/block/aender_hanging_sign_attached_rot_1.json +++ b/src/main/resources/assets/retold/models/block/aender_hanging_sign_attached_rot_1.json @@ -2,6 +2,6 @@ "parent": "minecraft:block/template_attached_hanging_sign_rot_1", "textures": { "all": "retold:block/aender_hanging_sign", - "particle": "minecraft:block/stripped_oak_log" + "particle": "retold:block/stripped_aender_log" } } \ No newline at end of file diff --git a/src/main/resources/assets/retold/models/block/aender_hanging_sign_attached_rot_2.json b/src/main/resources/assets/retold/models/block/aender_hanging_sign_attached_rot_2.json index 73a676ee..0c082161 100644 --- a/src/main/resources/assets/retold/models/block/aender_hanging_sign_attached_rot_2.json +++ b/src/main/resources/assets/retold/models/block/aender_hanging_sign_attached_rot_2.json @@ -2,6 +2,6 @@ "parent": "minecraft:block/template_attached_hanging_sign_rot_2", "textures": { "all": "retold:block/aender_hanging_sign", - "particle": "minecraft:block/stripped_oak_log" + "particle": "retold:block/stripped_aender_log" } } \ No newline at end of file diff --git a/src/main/resources/assets/retold/models/block/aender_hanging_sign_attached_rot_3.json b/src/main/resources/assets/retold/models/block/aender_hanging_sign_attached_rot_3.json index 813b9249..33379d65 100644 --- a/src/main/resources/assets/retold/models/block/aender_hanging_sign_attached_rot_3.json +++ b/src/main/resources/assets/retold/models/block/aender_hanging_sign_attached_rot_3.json @@ -2,6 +2,6 @@ "parent": "minecraft:block/template_attached_hanging_sign_rot_3", "textures": { "all": "retold:block/aender_hanging_sign", - "particle": "minecraft:block/stripped_oak_log" + "particle": "retold:block/stripped_aender_log" } } \ No newline at end of file diff --git a/src/main/resources/assets/retold/models/block/aender_hanging_sign_rot_0.json b/src/main/resources/assets/retold/models/block/aender_hanging_sign_rot_0.json index d14b8a2a..50b4665b 100644 --- a/src/main/resources/assets/retold/models/block/aender_hanging_sign_rot_0.json +++ b/src/main/resources/assets/retold/models/block/aender_hanging_sign_rot_0.json @@ -2,6 +2,6 @@ "parent": "minecraft:block/template_hanging_sign_rot_0", "textures": { "all": "retold:block/aender_hanging_sign", - "particle": "minecraft:block/stripped_oak_log" + "particle": "retold:block/stripped_aender_log" } } \ No newline at end of file diff --git a/src/main/resources/assets/retold/models/block/aender_hanging_sign_rot_1.json b/src/main/resources/assets/retold/models/block/aender_hanging_sign_rot_1.json index 6c5bada3..a02e6934 100644 --- a/src/main/resources/assets/retold/models/block/aender_hanging_sign_rot_1.json +++ b/src/main/resources/assets/retold/models/block/aender_hanging_sign_rot_1.json @@ -2,6 +2,6 @@ "parent": "minecraft:block/template_hanging_sign_rot_1", "textures": { "all": "retold:block/aender_hanging_sign", - "particle": "minecraft:block/stripped_oak_log" + "particle": "retold:block/stripped_aender_log" } } \ No newline at end of file diff --git a/src/main/resources/assets/retold/models/block/aender_hanging_sign_rot_2.json b/src/main/resources/assets/retold/models/block/aender_hanging_sign_rot_2.json index 51c0a480..666b3c9e 100644 --- a/src/main/resources/assets/retold/models/block/aender_hanging_sign_rot_2.json +++ b/src/main/resources/assets/retold/models/block/aender_hanging_sign_rot_2.json @@ -2,6 +2,6 @@ "parent": "minecraft:block/template_hanging_sign_rot_2", "textures": { "all": "retold:block/aender_hanging_sign", - "particle": "minecraft:block/stripped_oak_log" + "particle": "retold:block/stripped_aender_log" } } \ No newline at end of file diff --git a/src/main/resources/assets/retold/models/block/aender_hanging_sign_rot_3.json b/src/main/resources/assets/retold/models/block/aender_hanging_sign_rot_3.json index d6bfef9c..c7ab998e 100644 --- a/src/main/resources/assets/retold/models/block/aender_hanging_sign_rot_3.json +++ b/src/main/resources/assets/retold/models/block/aender_hanging_sign_rot_3.json @@ -2,6 +2,6 @@ "parent": "minecraft:block/template_hanging_sign_rot_3", "textures": { "all": "retold:block/aender_hanging_sign", - "particle": "minecraft:block/stripped_oak_log" + "particle": "retold:block/stripped_aender_log" } } \ No newline at end of file diff --git a/src/main/resources/assets/retold/models/block/aender_stabilizer.json b/src/main/resources/assets/retold/models/block/aender_stabilizer.json index 3e0a7f7f..59b4aa72 100644 --- a/src/main/resources/assets/retold/models/block/aender_stabilizer.json +++ b/src/main/resources/assets/retold/models/block/aender_stabilizer.json @@ -1,6 +1,6 @@ { "parent": "minecraft:block/cube_all", "textures": { - "all": "minecraft:block/amethyst_block" + "all": "retold:block/aender_stabilizer" } -} \ No newline at end of file +} diff --git a/src/main/resources/assets/retold/models/block/aender_wall_hanging_sign.json b/src/main/resources/assets/retold/models/block/aender_wall_hanging_sign.json index 655f6fbd..946032e9 100644 --- a/src/main/resources/assets/retold/models/block/aender_wall_hanging_sign.json +++ b/src/main/resources/assets/retold/models/block/aender_wall_hanging_sign.json @@ -2,6 +2,6 @@ "parent": "minecraft:block/template_wall_hanging_sign", "textures": { "all": "retold:block/aender_hanging_sign", - "particle": "minecraft:block/stripped_oak_log" + "particle": "retold:block/stripped_aender_log" } } \ No newline at end of file diff --git a/src/main/resources/assets/retold/models/block/dev_aender_portal_frame.json b/src/main/resources/assets/retold/models/block/dev_aender_portal_frame.json index bd036e7d..35c0a388 100644 --- a/src/main/resources/assets/retold/models/block/dev_aender_portal_frame.json +++ b/src/main/resources/assets/retold/models/block/dev_aender_portal_frame.json @@ -1,6 +1,6 @@ { "parent": "minecraft:block/cube_all", "textures": { - "all": "retold:block/aender_stone" + "all": "retold:block/dev_aender_portal_frame" } } diff --git a/src/main/resources/assets/retold/models/item/aender_door.json b/src/main/resources/assets/retold/models/item/aender_door.json index b7565ab6..2b8d0c2d 100644 --- a/src/main/resources/assets/retold/models/item/aender_door.json +++ b/src/main/resources/assets/retold/models/item/aender_door.json @@ -1 +1 @@ -{ "parent": "minecraft:item/generated", "textures": { "layer0": "retold:block/aender_door_bottom" } } +{ "parent": "minecraft:item/generated", "textures": { "layer0": "retold:item/aender_door" } } diff --git a/src/main/resources/assets/retold/models/item/aender_hanging_sign.json b/src/main/resources/assets/retold/models/item/aender_hanging_sign.json index 3ab4a15a..a32c6bf9 100644 --- a/src/main/resources/assets/retold/models/item/aender_hanging_sign.json +++ b/src/main/resources/assets/retold/models/item/aender_hanging_sign.json @@ -1 +1 @@ -{ "parent": "minecraft:item/generated", "textures": { "layer0": "retold:block/aender_hanging_sign" } } +{ "parent": "minecraft:item/generated", "textures": { "layer0": "retold:item/aender_hanging_sign" } } diff --git a/src/main/resources/assets/retold/models/item/aender_sign.json b/src/main/resources/assets/retold/models/item/aender_sign.json index 03ed38de..86022a48 100644 --- a/src/main/resources/assets/retold/models/item/aender_sign.json +++ b/src/main/resources/assets/retold/models/item/aender_sign.json @@ -1 +1 @@ -{ "parent": "minecraft:item/generated", "textures": { "layer0": "retold:block/aender_sign" } } +{ "parent": "minecraft:item/generated", "textures": { "layer0": "retold:item/aender_sign" } } diff --git a/src/main/resources/assets/retold/models/item/earth_guardian_spawn_egg.json b/src/main/resources/assets/retold/models/item/earth_guardian_spawn_egg.json new file mode 100644 index 00000000..a3ac4db5 --- /dev/null +++ b/src/main/resources/assets/retold/models/item/earth_guardian_spawn_egg.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "retold:item/earth_guardian_spawn_egg" + } +} diff --git a/src/main/resources/assets/retold/models/item/flint_multi_tool.json b/src/main/resources/assets/retold/models/item/flint_multi_tool.json index 9be78681..d7c93186 100644 --- a/src/main/resources/assets/retold/models/item/flint_multi_tool.json +++ b/src/main/resources/assets/retold/models/item/flint_multi_tool.json @@ -1,6 +1,6 @@ { "parent": "minecraft:item/handheld", "textures": { - "layer0": "minecraft:item/flint" + "layer0": "retold:item/flint_multi_tool" } } diff --git a/src/main/resources/assets/retold/models/item/flint_spear.json b/src/main/resources/assets/retold/models/item/flint_spear.json new file mode 100644 index 00000000..0d92756d --- /dev/null +++ b/src/main/resources/assets/retold/models/item/flint_spear.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "retold:item/flint_spear" + } +} diff --git a/src/main/resources/assets/retold/models/item/flint_spear_in_hand.json b/src/main/resources/assets/retold/models/item/flint_spear_in_hand.json new file mode 100644 index 00000000..c6ae5a2d --- /dev/null +++ b/src/main/resources/assets/retold/models/item/flint_spear_in_hand.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/spear_in_hand", + "textures": { + "layer0": "retold:item/flint_spear_in_hand" + } +} diff --git a/src/main/resources/assets/retold/models/item/nether_reactor_core.json b/src/main/resources/assets/retold/models/item/nether_reactor_core.json new file mode 100644 index 00000000..2ea5e262 --- /dev/null +++ b/src/main/resources/assets/retold/models/item/nether_reactor_core.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "retold:item/nether_reactor_core" + } +} diff --git a/src/main/resources/assets/retold/models/item/steel_axe.json b/src/main/resources/assets/retold/models/item/steel_axe.json new file mode 100644 index 00000000..3e123b77 --- /dev/null +++ b/src/main/resources/assets/retold/models/item/steel_axe.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/handheld", + "textures": { + "layer0": "retold:item/steel_axe" + } +} diff --git a/src/main/resources/assets/retold/models/item/steel_boots.json b/src/main/resources/assets/retold/models/item/steel_boots.json new file mode 100644 index 00000000..e7098983 --- /dev/null +++ b/src/main/resources/assets/retold/models/item/steel_boots.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "retold:item/steel_boots" + } +} diff --git a/src/main/resources/assets/retold/models/item/steel_chestplate.json b/src/main/resources/assets/retold/models/item/steel_chestplate.json new file mode 100644 index 00000000..86bb2802 --- /dev/null +++ b/src/main/resources/assets/retold/models/item/steel_chestplate.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "retold:item/steel_chestplate" + } +} diff --git a/src/main/resources/assets/retold/models/item/steel_helmet.json b/src/main/resources/assets/retold/models/item/steel_helmet.json new file mode 100644 index 00000000..61ed714c --- /dev/null +++ b/src/main/resources/assets/retold/models/item/steel_helmet.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "retold:item/steel_helmet" + } +} diff --git a/src/main/resources/assets/retold/models/item/steel_hoe.json b/src/main/resources/assets/retold/models/item/steel_hoe.json new file mode 100644 index 00000000..4ef54644 --- /dev/null +++ b/src/main/resources/assets/retold/models/item/steel_hoe.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/handheld", + "textures": { + "layer0": "retold:item/steel_hoe" + } +} diff --git a/src/main/resources/assets/retold/models/item/steel_ingot.json b/src/main/resources/assets/retold/models/item/steel_ingot.json new file mode 100644 index 00000000..7da33abe --- /dev/null +++ b/src/main/resources/assets/retold/models/item/steel_ingot.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "retold:item/steel_ingot" + } +} diff --git a/src/main/resources/assets/retold/models/item/steel_leggings.json b/src/main/resources/assets/retold/models/item/steel_leggings.json new file mode 100644 index 00000000..f671a0d3 --- /dev/null +++ b/src/main/resources/assets/retold/models/item/steel_leggings.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "retold:item/steel_leggings" + } +} diff --git a/src/main/resources/assets/retold/models/item/steel_pickaxe.json b/src/main/resources/assets/retold/models/item/steel_pickaxe.json new file mode 100644 index 00000000..75d618be --- /dev/null +++ b/src/main/resources/assets/retold/models/item/steel_pickaxe.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/handheld", + "textures": { + "layer0": "retold:item/steel_pickaxe" + } +} diff --git a/src/main/resources/assets/retold/models/item/steel_shovel.json b/src/main/resources/assets/retold/models/item/steel_shovel.json new file mode 100644 index 00000000..979a507d --- /dev/null +++ b/src/main/resources/assets/retold/models/item/steel_shovel.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/handheld", + "textures": { + "layer0": "retold:item/steel_shovel" + } +} diff --git a/src/main/resources/assets/retold/models/item/steel_spear.json b/src/main/resources/assets/retold/models/item/steel_spear.json new file mode 100644 index 00000000..3c1de1f0 --- /dev/null +++ b/src/main/resources/assets/retold/models/item/steel_spear.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "retold:item/steel_spear" + } +} diff --git a/src/main/resources/assets/retold/models/item/steel_spear_in_hand.json b/src/main/resources/assets/retold/models/item/steel_spear_in_hand.json new file mode 100644 index 00000000..a65ba399 --- /dev/null +++ b/src/main/resources/assets/retold/models/item/steel_spear_in_hand.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/spear_in_hand", + "textures": { + "layer0": "retold:item/steel_spear_in_hand" + } +} diff --git a/src/main/resources/assets/retold/models/item/steel_sword.json b/src/main/resources/assets/retold/models/item/steel_sword.json new file mode 100644 index 00000000..b4acc8b3 --- /dev/null +++ b/src/main/resources/assets/retold/models/item/steel_sword.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/handheld", + "textures": { + "layer0": "retold:item/steel_sword" + } +} diff --git a/src/main/resources/assets/retold/textures/block/aender_cactus_side.png b/src/main/resources/assets/retold/textures/block/aender_cactus_side.png index 595844d9..7bf05712 100644 Binary files a/src/main/resources/assets/retold/textures/block/aender_cactus_side.png and b/src/main/resources/assets/retold/textures/block/aender_cactus_side.png differ diff --git a/src/main/resources/assets/retold/textures/block/aender_cactus_top.png b/src/main/resources/assets/retold/textures/block/aender_cactus_top.png index 36364f75..7fb6a0a4 100644 Binary files a/src/main/resources/assets/retold/textures/block/aender_cactus_top.png and b/src/main/resources/assets/retold/textures/block/aender_cactus_top.png differ diff --git a/src/main/resources/assets/retold/textures/block/aender_chronolith.png b/src/main/resources/assets/retold/textures/block/aender_chronolith.png index dd0b0044..22c8a5f5 100644 Binary files a/src/main/resources/assets/retold/textures/block/aender_chronolith.png and b/src/main/resources/assets/retold/textures/block/aender_chronolith.png differ diff --git a/src/main/resources/assets/retold/textures/block/aender_door_bottom.png b/src/main/resources/assets/retold/textures/block/aender_door_bottom.png index d6c009c7..080f8d5a 100644 Binary files a/src/main/resources/assets/retold/textures/block/aender_door_bottom.png and b/src/main/resources/assets/retold/textures/block/aender_door_bottom.png differ diff --git a/src/main/resources/assets/retold/textures/block/aender_door_top.png b/src/main/resources/assets/retold/textures/block/aender_door_top.png index e41242fe..37419338 100644 Binary files a/src/main/resources/assets/retold/textures/block/aender_door_top.png and b/src/main/resources/assets/retold/textures/block/aender_door_top.png differ diff --git a/src/main/resources/assets/retold/textures/block/aender_grass_block_side.png b/src/main/resources/assets/retold/textures/block/aender_grass_block_side.png index 18d9c391..e0d04f06 100644 Binary files a/src/main/resources/assets/retold/textures/block/aender_grass_block_side.png and b/src/main/resources/assets/retold/textures/block/aender_grass_block_side.png differ diff --git a/src/main/resources/assets/retold/textures/block/aender_grass_block_side.png.mcmeta b/src/main/resources/assets/retold/textures/block/aender_grass_block_side.png.mcmeta deleted file mode 100644 index 70c46a5c..00000000 --- a/src/main/resources/assets/retold/textures/block/aender_grass_block_side.png.mcmeta +++ /dev/null @@ -1,6 +0,0 @@ -{ - "animation": { - "frametime": 8, - "interpolate": true - } -} diff --git a/src/main/resources/assets/retold/textures/block/aender_grass_block_top.png b/src/main/resources/assets/retold/textures/block/aender_grass_block_top.png index ef0d2b59..96683724 100644 Binary files a/src/main/resources/assets/retold/textures/block/aender_grass_block_top.png and b/src/main/resources/assets/retold/textures/block/aender_grass_block_top.png differ diff --git a/src/main/resources/assets/retold/textures/block/aender_grass_block_top.png.mcmeta b/src/main/resources/assets/retold/textures/block/aender_grass_block_top.png.mcmeta deleted file mode 100644 index 70c46a5c..00000000 --- a/src/main/resources/assets/retold/textures/block/aender_grass_block_top.png.mcmeta +++ /dev/null @@ -1,6 +0,0 @@ -{ - "animation": { - "frametime": 8, - "interpolate": true - } -} diff --git a/src/main/resources/assets/retold/textures/block/aender_hanging_sign.png b/src/main/resources/assets/retold/textures/block/aender_hanging_sign.png index ecd13796..ca0263a9 100644 Binary files a/src/main/resources/assets/retold/textures/block/aender_hanging_sign.png and b/src/main/resources/assets/retold/textures/block/aender_hanging_sign.png differ diff --git a/src/main/resources/assets/retold/textures/block/aender_leaves.png b/src/main/resources/assets/retold/textures/block/aender_leaves.png index 2ff3eee2..b9dfba03 100644 Binary files a/src/main/resources/assets/retold/textures/block/aender_leaves.png and b/src/main/resources/assets/retold/textures/block/aender_leaves.png differ diff --git a/src/main/resources/assets/retold/textures/block/aender_leaves.png.mcmeta b/src/main/resources/assets/retold/textures/block/aender_leaves.png.mcmeta deleted file mode 100644 index de9dddbb..00000000 --- a/src/main/resources/assets/retold/textures/block/aender_leaves.png.mcmeta +++ /dev/null @@ -1,6 +0,0 @@ -{ - "animation": { - "frametime": 7, - "interpolate": true - } -} diff --git a/src/main/resources/assets/retold/textures/block/aender_log.png b/src/main/resources/assets/retold/textures/block/aender_log.png index 45de7467..ff88a1d5 100644 Binary files a/src/main/resources/assets/retold/textures/block/aender_log.png and b/src/main/resources/assets/retold/textures/block/aender_log.png differ diff --git a/src/main/resources/assets/retold/textures/block/aender_log.png.mcmeta b/src/main/resources/assets/retold/textures/block/aender_log.png.mcmeta deleted file mode 100644 index 7e3d74a4..00000000 --- a/src/main/resources/assets/retold/textures/block/aender_log.png.mcmeta +++ /dev/null @@ -1,6 +0,0 @@ -{ - "animation": { - "frametime": 12, - "interpolate": true - } -} diff --git a/src/main/resources/assets/retold/textures/block/aender_log_top.png b/src/main/resources/assets/retold/textures/block/aender_log_top.png index c68ef519..bbca5d59 100644 Binary files a/src/main/resources/assets/retold/textures/block/aender_log_top.png and b/src/main/resources/assets/retold/textures/block/aender_log_top.png differ diff --git a/src/main/resources/assets/retold/textures/block/aender_log_top.png.mcmeta b/src/main/resources/assets/retold/textures/block/aender_log_top.png.mcmeta deleted file mode 100644 index 7e3d74a4..00000000 --- a/src/main/resources/assets/retold/textures/block/aender_log_top.png.mcmeta +++ /dev/null @@ -1,6 +0,0 @@ -{ - "animation": { - "frametime": 12, - "interpolate": true - } -} diff --git a/src/main/resources/assets/retold/textures/block/aender_sand.png b/src/main/resources/assets/retold/textures/block/aender_sand.png index c9b91a13..d9afaf9f 100644 Binary files a/src/main/resources/assets/retold/textures/block/aender_sand.png and b/src/main/resources/assets/retold/textures/block/aender_sand.png differ diff --git a/src/main/resources/assets/retold/textures/block/aender_sandstone.png b/src/main/resources/assets/retold/textures/block/aender_sandstone.png index e9f85d86..ada0b028 100644 Binary files a/src/main/resources/assets/retold/textures/block/aender_sandstone.png and b/src/main/resources/assets/retold/textures/block/aender_sandstone.png differ diff --git a/src/main/resources/assets/retold/textures/block/aender_sandstone_top.png b/src/main/resources/assets/retold/textures/block/aender_sandstone_top.png index 4a66b732..411b3a2a 100644 Binary files a/src/main/resources/assets/retold/textures/block/aender_sandstone_top.png and b/src/main/resources/assets/retold/textures/block/aender_sandstone_top.png differ diff --git a/src/main/resources/assets/retold/textures/block/aender_sapling.png b/src/main/resources/assets/retold/textures/block/aender_sapling.png index 4c5ee033..11762784 100644 Binary files a/src/main/resources/assets/retold/textures/block/aender_sapling.png and b/src/main/resources/assets/retold/textures/block/aender_sapling.png differ diff --git a/src/main/resources/assets/retold/textures/block/aender_sign.png b/src/main/resources/assets/retold/textures/block/aender_sign.png index b546d4c4..4dc33923 100644 Binary files a/src/main/resources/assets/retold/textures/block/aender_sign.png and b/src/main/resources/assets/retold/textures/block/aender_sign.png differ diff --git a/src/main/resources/assets/retold/textures/block/aender_soil.png b/src/main/resources/assets/retold/textures/block/aender_soil.png index d35accf7..93cde9b9 100644 Binary files a/src/main/resources/assets/retold/textures/block/aender_soil.png and b/src/main/resources/assets/retold/textures/block/aender_soil.png differ diff --git a/src/main/resources/assets/retold/textures/block/aender_soil.png.mcmeta b/src/main/resources/assets/retold/textures/block/aender_soil.png.mcmeta deleted file mode 100644 index e5ba996b..00000000 --- a/src/main/resources/assets/retold/textures/block/aender_soil.png.mcmeta +++ /dev/null @@ -1,6 +0,0 @@ -{ - "animation": { - "frametime": 10, - "interpolate": true - } -} diff --git a/src/main/resources/assets/retold/textures/block/aender_stabilizer.png b/src/main/resources/assets/retold/textures/block/aender_stabilizer.png new file mode 100644 index 00000000..c69d0dd5 Binary files /dev/null and b/src/main/resources/assets/retold/textures/block/aender_stabilizer.png differ diff --git a/src/main/resources/assets/retold/textures/block/aender_stone.png b/src/main/resources/assets/retold/textures/block/aender_stone.png index d0489253..b9c12598 100644 Binary files a/src/main/resources/assets/retold/textures/block/aender_stone.png and b/src/main/resources/assets/retold/textures/block/aender_stone.png differ diff --git a/src/main/resources/assets/retold/textures/block/aender_stone.png.mcmeta b/src/main/resources/assets/retold/textures/block/aender_stone.png.mcmeta deleted file mode 100644 index e5ba996b..00000000 --- a/src/main/resources/assets/retold/textures/block/aender_stone.png.mcmeta +++ /dev/null @@ -1,6 +0,0 @@ -{ - "animation": { - "frametime": 10, - "interpolate": true - } -} diff --git a/src/main/resources/assets/retold/textures/block/aender_trapdoor.png b/src/main/resources/assets/retold/textures/block/aender_trapdoor.png index eeb7efaf..0ef86297 100644 Binary files a/src/main/resources/assets/retold/textures/block/aender_trapdoor.png and b/src/main/resources/assets/retold/textures/block/aender_trapdoor.png differ diff --git a/src/main/resources/assets/retold/textures/block/aenderite_ore.png b/src/main/resources/assets/retold/textures/block/aenderite_ore.png index 921b9498..4902bdc3 100644 Binary files a/src/main/resources/assets/retold/textures/block/aenderite_ore.png and b/src/main/resources/assets/retold/textures/block/aenderite_ore.png differ diff --git a/src/main/resources/assets/retold/textures/block/aenderite_ore.png.mcmeta b/src/main/resources/assets/retold/textures/block/aenderite_ore.png.mcmeta deleted file mode 100644 index e5ba996b..00000000 --- a/src/main/resources/assets/retold/textures/block/aenderite_ore.png.mcmeta +++ /dev/null @@ -1,6 +0,0 @@ -{ - "animation": { - "frametime": 10, - "interpolate": true - } -} diff --git a/src/main/resources/assets/retold/textures/block/dev_aender_portal_frame.png b/src/main/resources/assets/retold/textures/block/dev_aender_portal_frame.png new file mode 100644 index 00000000..5553abf2 Binary files /dev/null and b/src/main/resources/assets/retold/textures/block/dev_aender_portal_frame.png differ diff --git a/src/main/resources/assets/retold/textures/block/stripped_aender_log.png b/src/main/resources/assets/retold/textures/block/stripped_aender_log.png index b83eae24..ea0991aa 100644 Binary files a/src/main/resources/assets/retold/textures/block/stripped_aender_log.png and b/src/main/resources/assets/retold/textures/block/stripped_aender_log.png differ diff --git a/src/main/resources/assets/retold/textures/block/stripped_aender_log_top.png b/src/main/resources/assets/retold/textures/block/stripped_aender_log_top.png index 617f68b8..844f1aea 100644 Binary files a/src/main/resources/assets/retold/textures/block/stripped_aender_log_top.png and b/src/main/resources/assets/retold/textures/block/stripped_aender_log_top.png differ diff --git a/src/main/resources/assets/retold/textures/entity/boat/aender.png b/src/main/resources/assets/retold/textures/entity/boat/aender.png index 1cebe493..21550500 100644 Binary files a/src/main/resources/assets/retold/textures/entity/boat/aender.png and b/src/main/resources/assets/retold/textures/entity/boat/aender.png differ diff --git a/src/main/resources/assets/retold/textures/entity/chest_boat/aender.png b/src/main/resources/assets/retold/textures/entity/chest_boat/aender.png index 02f76d00..8c597926 100644 Binary files a/src/main/resources/assets/retold/textures/entity/chest_boat/aender.png and b/src/main/resources/assets/retold/textures/entity/chest_boat/aender.png differ diff --git a/src/main/resources/assets/retold/textures/entity/earth_guardian.png b/src/main/resources/assets/retold/textures/entity/earth_guardian.png new file mode 100644 index 00000000..fbe042fd Binary files /dev/null and b/src/main/resources/assets/retold/textures/entity/earth_guardian.png differ diff --git a/src/main/resources/assets/retold/textures/entity/equipment/humanoid/steel.png b/src/main/resources/assets/retold/textures/entity/equipment/humanoid/steel.png new file mode 100644 index 00000000..dbe9c586 Binary files /dev/null and b/src/main/resources/assets/retold/textures/entity/equipment/humanoid/steel.png differ diff --git a/src/main/resources/assets/retold/textures/entity/equipment/humanoid_baby/steel.png b/src/main/resources/assets/retold/textures/entity/equipment/humanoid_baby/steel.png new file mode 100644 index 00000000..1ea3397a Binary files /dev/null and b/src/main/resources/assets/retold/textures/entity/equipment/humanoid_baby/steel.png differ diff --git a/src/main/resources/assets/retold/textures/entity/equipment/humanoid_leggings/steel.png b/src/main/resources/assets/retold/textures/entity/equipment/humanoid_leggings/steel.png new file mode 100644 index 00000000..ed4d16aa Binary files /dev/null and b/src/main/resources/assets/retold/textures/entity/equipment/humanoid_leggings/steel.png differ diff --git a/src/main/resources/assets/retold/textures/entity/gale_core.png b/src/main/resources/assets/retold/textures/entity/gale_core.png new file mode 100644 index 00000000..d70c898c Binary files /dev/null and b/src/main/resources/assets/retold/textures/entity/gale_core.png differ diff --git a/src/main/resources/assets/retold/textures/item/aender_boat.png b/src/main/resources/assets/retold/textures/item/aender_boat.png index 7689ab15..009661e7 100644 Binary files a/src/main/resources/assets/retold/textures/item/aender_boat.png and b/src/main/resources/assets/retold/textures/item/aender_boat.png differ diff --git a/src/main/resources/assets/retold/textures/item/aender_chest_boat.png b/src/main/resources/assets/retold/textures/item/aender_chest_boat.png index a63e9c44..71ba56ca 100644 Binary files a/src/main/resources/assets/retold/textures/item/aender_chest_boat.png and b/src/main/resources/assets/retold/textures/item/aender_chest_boat.png differ diff --git a/src/main/resources/assets/retold/textures/item/aender_door.png b/src/main/resources/assets/retold/textures/item/aender_door.png new file mode 100644 index 00000000..44600956 Binary files /dev/null and b/src/main/resources/assets/retold/textures/item/aender_door.png differ diff --git a/src/main/resources/assets/retold/textures/item/aender_eye_spawn_egg.png b/src/main/resources/assets/retold/textures/item/aender_eye_spawn_egg.png index 2dbe607f..9d0ca373 100644 Binary files a/src/main/resources/assets/retold/textures/item/aender_eye_spawn_egg.png and b/src/main/resources/assets/retold/textures/item/aender_eye_spawn_egg.png differ diff --git a/src/main/resources/assets/retold/textures/item/aender_hanging_sign.png b/src/main/resources/assets/retold/textures/item/aender_hanging_sign.png new file mode 100644 index 00000000..669e2169 Binary files /dev/null and b/src/main/resources/assets/retold/textures/item/aender_hanging_sign.png differ diff --git a/src/main/resources/assets/retold/textures/item/aender_sign.png b/src/main/resources/assets/retold/textures/item/aender_sign.png new file mode 100644 index 00000000..e0ca9d4f Binary files /dev/null and b/src/main/resources/assets/retold/textures/item/aender_sign.png differ diff --git a/src/main/resources/assets/retold/textures/item/aenderite_ingot.png b/src/main/resources/assets/retold/textures/item/aenderite_ingot.png index c6686c01..d5c37dc4 100644 Binary files a/src/main/resources/assets/retold/textures/item/aenderite_ingot.png and b/src/main/resources/assets/retold/textures/item/aenderite_ingot.png differ diff --git a/src/main/resources/assets/retold/textures/item/earth_guardian_spawn_egg.png b/src/main/resources/assets/retold/textures/item/earth_guardian_spawn_egg.png new file mode 100644 index 00000000..24eab70a Binary files /dev/null and b/src/main/resources/assets/retold/textures/item/earth_guardian_spawn_egg.png differ diff --git a/src/main/resources/assets/retold/textures/item/flint_multi_tool.png b/src/main/resources/assets/retold/textures/item/flint_multi_tool.png new file mode 100644 index 00000000..cd3b1da4 Binary files /dev/null and b/src/main/resources/assets/retold/textures/item/flint_multi_tool.png differ diff --git a/src/main/resources/assets/retold/textures/item/flint_spear.png b/src/main/resources/assets/retold/textures/item/flint_spear.png new file mode 100644 index 00000000..b7030513 Binary files /dev/null and b/src/main/resources/assets/retold/textures/item/flint_spear.png differ diff --git a/src/main/resources/assets/retold/textures/item/flint_spear_in_hand.png b/src/main/resources/assets/retold/textures/item/flint_spear_in_hand.png new file mode 100644 index 00000000..5f033d30 Binary files /dev/null and b/src/main/resources/assets/retold/textures/item/flint_spear_in_hand.png differ diff --git a/src/main/resources/assets/retold/textures/item/gale_core_spawn_egg.png b/src/main/resources/assets/retold/textures/item/gale_core_spawn_egg.png index 82bfa837..c131dc75 100644 Binary files a/src/main/resources/assets/retold/textures/item/gale_core_spawn_egg.png and b/src/main/resources/assets/retold/textures/item/gale_core_spawn_egg.png differ diff --git a/src/main/resources/assets/retold/textures/item/nether_reactor_core.png b/src/main/resources/assets/retold/textures/item/nether_reactor_core.png new file mode 100644 index 00000000..f06f963b Binary files /dev/null and b/src/main/resources/assets/retold/textures/item/nether_reactor_core.png differ diff --git a/src/main/resources/assets/retold/textures/item/raw_aenderite.png b/src/main/resources/assets/retold/textures/item/raw_aenderite.png index 1bf76930..54f6d634 100644 Binary files a/src/main/resources/assets/retold/textures/item/raw_aenderite.png and b/src/main/resources/assets/retold/textures/item/raw_aenderite.png differ diff --git a/src/main/resources/assets/retold/textures/item/steel_axe.png b/src/main/resources/assets/retold/textures/item/steel_axe.png new file mode 100644 index 00000000..a687c012 Binary files /dev/null and b/src/main/resources/assets/retold/textures/item/steel_axe.png differ diff --git a/src/main/resources/assets/retold/textures/item/steel_boots.png b/src/main/resources/assets/retold/textures/item/steel_boots.png new file mode 100644 index 00000000..6ff3195c Binary files /dev/null and b/src/main/resources/assets/retold/textures/item/steel_boots.png differ diff --git a/src/main/resources/assets/retold/textures/item/steel_chestplate.png b/src/main/resources/assets/retold/textures/item/steel_chestplate.png new file mode 100644 index 00000000..47bf6a7a Binary files /dev/null and b/src/main/resources/assets/retold/textures/item/steel_chestplate.png differ diff --git a/src/main/resources/assets/retold/textures/item/steel_helmet.png b/src/main/resources/assets/retold/textures/item/steel_helmet.png new file mode 100644 index 00000000..5885b9cf Binary files /dev/null and b/src/main/resources/assets/retold/textures/item/steel_helmet.png differ diff --git a/src/main/resources/assets/retold/textures/item/steel_hoe.png b/src/main/resources/assets/retold/textures/item/steel_hoe.png new file mode 100644 index 00000000..5609194f Binary files /dev/null and b/src/main/resources/assets/retold/textures/item/steel_hoe.png differ diff --git a/src/main/resources/assets/retold/textures/item/steel_ingot.png b/src/main/resources/assets/retold/textures/item/steel_ingot.png new file mode 100644 index 00000000..3b6d569a Binary files /dev/null and b/src/main/resources/assets/retold/textures/item/steel_ingot.png differ diff --git a/src/main/resources/assets/retold/textures/item/steel_leggings.png b/src/main/resources/assets/retold/textures/item/steel_leggings.png new file mode 100644 index 00000000..42098b7f Binary files /dev/null and b/src/main/resources/assets/retold/textures/item/steel_leggings.png differ diff --git a/src/main/resources/assets/retold/textures/item/steel_pickaxe.png b/src/main/resources/assets/retold/textures/item/steel_pickaxe.png new file mode 100644 index 00000000..150265e1 Binary files /dev/null and b/src/main/resources/assets/retold/textures/item/steel_pickaxe.png differ diff --git a/src/main/resources/assets/retold/textures/item/steel_shovel.png b/src/main/resources/assets/retold/textures/item/steel_shovel.png new file mode 100644 index 00000000..57e823be Binary files /dev/null and b/src/main/resources/assets/retold/textures/item/steel_shovel.png differ diff --git a/src/main/resources/assets/retold/textures/item/steel_spear.png b/src/main/resources/assets/retold/textures/item/steel_spear.png new file mode 100644 index 00000000..0976c1f3 Binary files /dev/null and b/src/main/resources/assets/retold/textures/item/steel_spear.png differ diff --git a/src/main/resources/assets/retold/textures/item/steel_spear_in_hand.png b/src/main/resources/assets/retold/textures/item/steel_spear_in_hand.png new file mode 100644 index 00000000..9fd847fa Binary files /dev/null and b/src/main/resources/assets/retold/textures/item/steel_spear_in_hand.png differ diff --git a/src/main/resources/assets/retold/textures/item/steel_sword.png b/src/main/resources/assets/retold/textures/item/steel_sword.png new file mode 100644 index 00000000..d06740d0 Binary files /dev/null and b/src/main/resources/assets/retold/textures/item/steel_sword.png differ diff --git a/src/main/resources/data/minecraft/worldgen/structure/jungle_pyramid.json b/src/main/resources/data/minecraft/worldgen/structure/jungle_pyramid.json new file mode 100644 index 00000000..42528f06 --- /dev/null +++ b/src/main/resources/data/minecraft/worldgen/structure/jungle_pyramid.json @@ -0,0 +1,6 @@ +{ + "type": "retold:earth_jungle_temple", + "biomes": "#minecraft:has_structure/jungle_temple", + "spawn_overrides": {}, + "step": "surface_structures" +} diff --git a/src/main/resources/data/retold/loot_modifiers/remove_lodestone.json b/src/main/resources/data/retold/loot_modifiers/remove_lodestone.json new file mode 100644 index 00000000..a3d6a761 --- /dev/null +++ b/src/main/resources/data/retold/loot_modifiers/remove_lodestone.json @@ -0,0 +1,12 @@ +{ + "type": "retold:remove_lodestone", + "conditions": [ + { + "condition": "minecraft:any_of", + "terms": [ + { "condition": "neoforge:loot_table_id", "loot_table_id": "minecraft:chests/ruined_portal" }, + { "condition": "neoforge:loot_table_id", "loot_table_id": "minecraft:chests/bastion_bridge" } + ] + } + ] +} diff --git a/src/main/resources/data/retold/loot_table/chests/earth_labyrinth.json b/src/main/resources/data/retold/loot_table/chests/earth_labyrinth.json new file mode 100644 index 00000000..9d36174a --- /dev/null +++ b/src/main/resources/data/retold/loot_table/chests/earth_labyrinth.json @@ -0,0 +1,19 @@ +{ + "type": "minecraft:chest", + "pools": [ + { + "rolls": { "type": "minecraft:uniform", "min": 2, "max": 4 }, + "entries": [ + { "type": "minecraft:item", "name": "minecraft:iron_ingot", "weight": 4 }, + { "type": "minecraft:item", "name": "minecraft:gold_ingot", "weight": 3 }, + { "type": "minecraft:item", "name": "minecraft:emerald", "weight": 2 }, + { "type": "minecraft:item", "name": "minecraft:diamond", "weight": 1 } + ] + }, + { + "rolls": 1, + "entries": [{ "type": "minecraft:item", "name": "minecraft:bread" }], + "functions": [{ "function": "minecraft:set_count", "count": { "type": "minecraft:uniform", "min": 2, "max": 4 } }] + } + ] +} diff --git a/src/main/resources/data/retold/loot_table/chests/earth_labyrinth_dispenser.json b/src/main/resources/data/retold/loot_table/chests/earth_labyrinth_dispenser.json new file mode 100644 index 00000000..3e87ed4b --- /dev/null +++ b/src/main/resources/data/retold/loot_table/chests/earth_labyrinth_dispenser.json @@ -0,0 +1,10 @@ +{ + "type": "minecraft:chest", + "pools": [ + { + "rolls": 1, + "entries": [{ "type": "minecraft:item", "name": "minecraft:arrow" }], + "functions": [{ "function": "minecraft:set_count", "count": { "type": "minecraft:uniform", "min": 8, "max": 16 } }] + } + ] +} diff --git a/src/main/resources/data/retold/loot_table/entities/earth_guardian.json b/src/main/resources/data/retold/loot_table/entities/earth_guardian.json new file mode 100644 index 00000000..f18f26f2 --- /dev/null +++ b/src/main/resources/data/retold/loot_table/entities/earth_guardian.json @@ -0,0 +1,9 @@ +{ + "type": "minecraft:entity", + "pools": [ + { + "rolls": 1, + "entries": [{ "type": "minecraft:item", "name": "minecraft:lodestone" }] + } + ] +} diff --git a/src/main/resources/data/retold/mob_profiles/earth_guardian.json b/src/main/resources/data/retold/mob_profiles/earth_guardian.json new file mode 100644 index 00000000..7363bb85 --- /dev/null +++ b/src/main/resources/data/retold/mob_profiles/earth_guardian.json @@ -0,0 +1,13 @@ +{ + "entity": "retold:earth_guardian", + "profile": { + "type": "apex_or_boss", + "managed": false, + "predator": false, + "pack_social": false, + "territory_guard": true, + "hunger_interval_ticks": 0, + "eat_threshold": 101, + "hunt_threshold": 101 + } +} diff --git a/src/main/resources/data/retold/tags/entity_type/factions/bosses.json b/src/main/resources/data/retold/tags/entity_type/factions/bosses.json index 53960919..9ec4a764 100644 --- a/src/main/resources/data/retold/tags/entity_type/factions/bosses.json +++ b/src/main/resources/data/retold/tags/entity_type/factions/bosses.json @@ -1,6 +1,7 @@ { "replace": false, "values": [ - "minecraft:ender_dragon" + "minecraft:ender_dragon", + "retold:earth_guardian" ] } diff --git a/src/test/java/cz/xefensor/retold/client/assets/RetoldAssetResourcesTest.java b/src/test/java/cz/xefensor/retold/client/assets/RetoldAssetResourcesTest.java new file mode 100644 index 00000000..a0bcfdcb --- /dev/null +++ b/src/test/java/cz/xefensor/retold/client/assets/RetoldAssetResourcesTest.java @@ -0,0 +1,276 @@ +package cz.xefensor.retold.client.assets; + +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; +import org.junit.jupiter.api.Test; + +import javax.imageio.ImageIO; +import java.awt.image.BufferedImage; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.stream.Stream; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; + +/** Checks resource contracts without starting Minecraft or depending on generation artifacts. */ +class RetoldAssetResourcesTest { + private static final String ASSETS = "assets/retold/"; + private static final List RESOURCE_ROOTS = List.of( + Path.of("src/main/resources"), Path.of("src/generated/resources") + ); + private static final Set INVENTORY_CONTEXTS = Set.of("gui", "ground", "fixed", "on_shelf"); + private static final Map> ATLAS_SIZES = Map.of( + "block/aender_sign", List.of(32, 32), + "block/aender_hanging_sign", List.of(32, 32), + "entity/boat/aender", List.of(128, 64), + "entity/chest_boat/aender", List.of(128, 128), + "entity/earth_guardian", List.of(128, 64), + "entity/gale_core", List.of(32, 32), + "entity/equipment/humanoid/steel", List.of(64, 32), + "entity/equipment/humanoid_leggings/steel", List.of(64, 32), + "entity/equipment/humanoid_baby/steel", List.of(64, 64) + ); + + @Test + void localModelParentsTexturesAndItemReferencesArePackaged() throws IOException { + for (String path : resources("models", ".json")) { + JsonObject model = json(path); + Set ancestors = new HashSet<>(); + String current = path; + while (current != null) { + assertTrue(ancestors.add(current), "Model parent cycle at " + current); + JsonObject ancestor = json(current); + String parent = ancestor.has("parent") ? ancestor.get("parent").getAsString() : ""; + current = localReference(parent, "models/", ".json"); + if (current != null) { + requireResource(current, path); + } + } + if (model.has("textures")) { + for (JsonElement texture : model.getAsJsonObject("textures").asMap().values()) { + String reference = texture.getAsString(); + if (!reference.equals("retold:block/aender_portal")) { + requireLocalReference(reference, "textures/", ".png", path); + } + } + } + } + for (String folder : List.of("items", "blockstates")) { + for (String path : resources(folder, ".json")) { + checkModelReferences(json(path), path); + } + } + // This texture is produced by a registered atlas source rather than a packaged PNG. + JsonElement portalSources = json("assets/minecraft/atlases/blocks.json").get("sources"); + assertTrue(portalSources.getAsJsonArray().asList().stream().anyMatch(element -> { + JsonObject source = element.getAsJsonObject(); + return source.has("target") && source.get("target").getAsString().equals("retold:block/aender_portal") + && source.get("type").getAsString().equals("retold:aender_portal_recolor") + && source.get("source").getAsString().equals("minecraft:block/nether_portal"); + }), "The generated Aender portal sprite must retain its atlas source"); + } + + @Test + void steelEquipmentLayersResolveToAtlasesWithNativeUvDimensions() throws IOException { + JsonObject layers = json(ASSETS + "equipment/steel.json").getAsJsonObject("layers"); + assertEquals(Set.of("humanoid", "humanoid_leggings", "humanoid_baby"), layers.keySet()); + for (String layerType : layers.keySet()) { + assertFalse(layers.getAsJsonArray(layerType).isEmpty(), "Empty Steel layer " + layerType); + for (JsonElement element : layers.getAsJsonArray(layerType)) { + String texture = element.getAsJsonObject().get("texture").getAsString(); + String resource = localReference(texture, "textures/entity/equipment/" + layerType + "/", ".png"); + assertNotNull(resource, "Steel must use Retold's equipment atlas for " + layerType); + BufferedImage image = image(resource); + assertEquals(64, image.getWidth(), resource); + assertEquals(layerType.equals("humanoid_baby") ? 64 : 32, image.getHeight(), resource); + checkAlpha(image, resource, true); + // Front-face regions from the 26.2 HumanoidModel armor meshes. Baby limbs have + // independent UVs; an adult atlas stretched to 64x64 leaves some of them invisible. + int[][] faces = switch (layerType) { + case "humanoid" -> new int[][]{{8, 8, 8, 8}, {20, 20, 8, 12}, {44, 20, 4, 12}, {4, 20, 4, 12}}; + case "humanoid_leggings" -> new int[][]{{20, 20, 8, 12}, {4, 20, 4, 12}}; + case "humanoid_baby" -> new int[][]{{8, 8, 9, 8}, {3, 20, 6, 5}, {33, 20, 2, 5}, {33, 28, 2, 5}, + {21, 20, 3, 4}, {21, 27, 3, 4}, {3, 28, 3, 1}, {3, 32, 3, 1}, {2, 39, 6, 2}}; + default -> throw new AssertionError("Unexpected equipment layer " + layerType); + }; + for (int[] face : faces) { + assertTrue(hasOpaquePixel(image, face), resource + " has an empty armor face at " + face[0] + ", " + face[1]); + } + } + } + } + + @Test + void refreshedPixelTexturesHaveNativeDimensionsAndBinaryAlpha() throws IOException { + for (String path : resources("textures", ".png")) { + String texture = path.substring((ASSETS + "textures/").length(), path.length() - 4); + if (!isRefreshedTexture(texture)) { + continue; + } + BufferedImage image = image(path); + List size = ATLAS_SIZES.getOrDefault(texture, + texture.endsWith("_spear_in_hand") ? List.of(32, 32) : List.of(16, 16)); + assertEquals(size.getFirst(), image.getWidth(), path); + assertEquals(size.getLast(), image.getHeight(), path); + checkAlpha(image, path, texture.startsWith("item/")); + // Static material faces must not accidentally keep metadata from the old animation strips. + assertNull(getClass().getClassLoader().getResource(path + ".mcmeta"), path); + } + for (String texture : ATLAS_SIZES.keySet()) { + requireResource(ASSETS + "textures/" + texture + ".png", "Native atlas dimensions"); + } + } + + @Test + void spearsUseInventorySpritesAndFullLengthHeldModelsInEveryDisplayContext() throws IOException { + Set contexts = Set.of("gui", "ground", "fixed", "on_shelf", "head", + "thirdperson_lefthand", "thirdperson_righthand", "firstperson_lefthand", "firstperson_righthand"); + for (String spear : List.of("flint_spear", "steel_spear")) { + JsonObject definition = json(ASSETS + "items/" + spear + ".json"); + JsonObject selector = definition.getAsJsonObject("model"); + assertEquals("minecraft:select", selector.get("type").getAsString(), spear); + assertEquals("minecraft:display_context", selector.get("property").getAsString(), spear); + for (String context : contexts) { + JsonObject selected = selector.getAsJsonObject("fallback"); + for (JsonElement element : selector.getAsJsonArray("cases")) { + JsonObject entry = element.getAsJsonObject(); + JsonElement when = entry.get("when"); + boolean matches = when.isJsonArray() + ? when.getAsJsonArray().asList().stream().anyMatch(value -> value.getAsString().equals(context)) + : when.getAsString().equals(context); + if (matches) { + selected = entry.getAsJsonObject("model"); + break; + } + } + String expected = "retold:item/" + spear + (INVENTORY_CONTEXTS.contains(context) ? "" : "_in_hand"); + assertEquals("minecraft:model", selected.get("type").getAsString(), spear + ": " + context); + assertEquals(expected, selected.get("model").getAsString(), spear + ": " + context); + } + assertEquals(1.95, definition.get("swap_animation_scale").getAsDouble(), 0.0001, spear); + JsonObject held = json(ASSETS + "models/item/" + spear + "_in_hand.json"); + assertEquals("minecraft:item/spear_in_hand", held.get("parent").getAsString(), spear); + assertEquals("retold:item/" + spear + "_in_hand", held.getAsJsonObject("textures").get("layer0").getAsString(), spear); + } + } + + private static boolean isRefreshedTexture(String texture) { + String name = texture.substring(texture.lastIndexOf('/') + 1); + return ATLAS_SIZES.containsKey(texture) || name.startsWith("aender") || name.startsWith("stripped_aender") + || name.startsWith("steel_") || name.startsWith("flint_") || name.equals("dev_aender_portal_frame") + || name.equals("nether_reactor_core") || name.equals("earth_guardian_spawn_egg") || name.equals("gale_core_spawn_egg") + || name.equals("raw_aenderite"); + } + + private static void checkAlpha(BufferedImage image, String path, boolean cutout) { + boolean transparent = false; + boolean opaque = false; + for (int y = 0; y < image.getHeight(); y++) { + for (int x = 0; x < image.getWidth(); x++) { + int alpha = image.getRGB(x, y) >>> 24; + assertTrue(alpha == 0 || alpha == 255, path + " has filtered alpha at " + x + ", " + y); + transparent |= alpha == 0; + opaque |= alpha == 255; + } + } + assertTrue(opaque, "Empty texture " + path); + if (cutout) { + assertTrue(transparent, "Cutout texture has an opaque background: " + path); + } + } + + private static boolean hasOpaquePixel(BufferedImage image, int[] region) { + for (int y = region[1]; y < region[1] + region[3]; y++) { + for (int x = region[0]; x < region[0] + region[2]; x++) { + if (image.getRGB(x, y) >>> 24 == 255) { + return true; + } + } + } + return false; + } + + private static void checkModelReferences(JsonElement element, String owner) { + if (element.isJsonArray()) { + element.getAsJsonArray().forEach(child -> checkModelReferences(child, owner)); + } else if (element.isJsonObject()) { + for (Map.Entry entry : element.getAsJsonObject().entrySet()) { + if ((entry.getKey().equals("model") || entry.getKey().equals("base")) && entry.getValue().isJsonPrimitive()) { + requireLocalReference(entry.getValue().getAsString(), "models/", ".json", owner); + } else { + checkModelReferences(entry.getValue(), owner); + } + } + } + } + + private static void requireLocalReference(String reference, String folder, String extension, String owner) { + String path = localReference(reference, folder, extension); + if (path != null) { + requireResource(path, owner); + } + } + + private static String localReference(String reference, String folder, String extension) { + if (!reference.startsWith("retold:")) { + return null; + } + String name = reference.substring("retold:".length()); + assertTrue(name.matches("[a-z0-9_.-]+(/[a-z0-9_.-]+)*") && !name.contains(".."), "Invalid Retold identifier " + reference); + return ASSETS + folder + name + extension; + } + + private static void requireResource(String path, String owner) { + assertNotNull(RetoldAssetResourcesTest.class.getClassLoader().getResource(path), owner + " references missing " + path); + } + + private static InputStream open(String path) { + InputStream stream = RetoldAssetResourcesTest.class.getClassLoader().getResourceAsStream(path); + assertNotNull(stream, "Missing packaged resource " + path); + return stream; + } + + private static JsonObject json(String path) throws IOException { + try (InputStreamReader reader = new InputStreamReader(open(path), StandardCharsets.UTF_8)) { + return JsonParser.parseReader(reader).getAsJsonObject(); + } + } + + private static BufferedImage image(String path) throws IOException { + try (InputStream stream = open(path)) { + BufferedImage image = ImageIO.read(stream); + assertNotNull(image, "Invalid PNG " + path); + return image; + } + } + + private static List resources(String folder, String extension) throws IOException { + Set paths = new HashSet<>(); + for (Path root : RESOURCE_ROOTS) { + Path directory = root.resolve(ASSETS + folder); + if (Files.isDirectory(directory)) { + try (Stream files = Files.walk(directory)) { + files.filter(path -> path.toString().endsWith(extension)) + .map(root::relativize) + .map(path -> path.toString().replace('\\', '/')) + .forEach(paths::add); + } + } + } + assertFalse(paths.isEmpty(), "No resources discovered in " + folder); + return paths.stream().sorted().toList(); + } +} diff --git a/src/test/java/cz/xefensor/retold/worldgen/earth/EarthLabyrinthPlannerTest.java b/src/test/java/cz/xefensor/retold/worldgen/earth/EarthLabyrinthPlannerTest.java new file mode 100644 index 00000000..1798ef32 --- /dev/null +++ b/src/test/java/cz/xefensor/retold/worldgen/earth/EarthLabyrinthPlannerTest.java @@ -0,0 +1,178 @@ +package cz.xefensor.retold.worldgen.earth; + +import org.junit.jupiter.api.Test; + +import java.util.ArrayDeque; +import java.util.HashSet; +import java.util.Set; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; + +class EarthLabyrinthPlannerTest { + @Test + void pyramidSeedsAreStableAndPositionSpecific() { + long worldSeed = 0x5EEDBEEFL; + Set seeds = new HashSet<>(); + + for (int chunkZ = -4; chunkZ <= 4; chunkZ++) { + for (int chunkX = -4; chunkX <= 4; chunkX++) { + long first = EarthLabyrinthPlanner.seedForPyramid(worldSeed, chunkX, chunkZ); + long second = EarthLabyrinthPlanner.seedForPyramid(worldSeed, chunkX, chunkZ); + assertEquals(first, second); + seeds.add(first); + } + } + + assertEquals(81, seeds.size(), "Nearby pyramids must not share layout seeds"); + assertNotEquals( + EarthLabyrinthPlanner.seedForPyramid(worldSeed, 3, 7), + EarthLabyrinthPlanner.seedForPyramid(worldSeed + 1L, 3, 7) + ); + } + + @Test + void layoutsAreDeterministicButVaryAcrossPyramids() { + Set distinctLayouts = new HashSet<>(); + Set widths = new HashSet<>(); + + for (long seed = 0; seed < 64; seed++) { + EarthLabyrinthLayout first = EarthLabyrinthPlanner.generate(seed); + EarthLabyrinthLayout second = EarthLabyrinthPlanner.generate(seed); + + assertEquals(first, second, "The same pyramid seed must retain its labyrinth"); + distinctLayouts.add(first); + widths.add(first.footprintWidthBlocks()); + } + + assertTrue(distinctLayouts.size() > 56, "Pyramid seeds must produce varied topologies"); + assertEquals(Set.of(77, 101), widths); + assertNotEquals( + EarthLabyrinthPlanner.generate(10L), + EarthLabyrinthPlanner.generate(11L) + ); + } + + @Test + void everyCellIsReachableAcrossBothLevels() { + for (long seed = 0; seed < 512; seed++) { + EarthLabyrinthLayout layout = EarthLabyrinthPlanner.generate(seed); + Set reachable = reachableFrom( + layout, + layout.entrance() + ); + + assertEquals( + layout.sideCells() * layout.sideCells() * EarthLabyrinthLayout.LEVEL_COUNT, + reachable.size(), + "Every generated maze cell must be connected to its entrance" + ); + assertTrue( + reachable.contains(layout.guardianChamber()), + "The guardian chamber must always be reachable" + ); + } + } + + @Test + void layoutsKeepFixedAnchorsMultipleStairsAndLoops() { + for (long seed = 0; seed < 512; seed++) { + EarthLabyrinthLayout layout = EarthLabyrinthPlanner.generate(seed); + int side = layout.sideCells(); + int cellCount = side * side * EarthLabyrinthLayout.LEVEL_COUNT; + + assertEquals( + new EarthLabyrinthLayout.Cell(side / 2, 0, 0), + layout.entrance() + ); + assertEquals( + new EarthLabyrinthLayout.Cell(side / 2, side / 2, 1), + layout.guardianChamber() + ); + assertEquals( + EarthLabyrinthLayout.CellKind.ENTRANCE, + layout.kindAt(layout.entrance()) + ); + assertEquals( + EarthLabyrinthLayout.CellKind.GUARDIAN_CHAMBER, + layout.kindAt(layout.guardianChamber()) + ); + assertTrue(layout.verticalPassageCount() >= 4L); + assertTrue(layout.verticalPassageCount() <= 5L); + for (EarthLabyrinthLayout.Passage passage : layout.passages()) { + if (!passage.isVertical()) { + continue; + } + + EarthLabyrinthLayout.Cell lower = passage.first().level() == 1 + ? passage.first() + : passage.second(); + assertTrue( + Math.abs(lower.x() - layout.guardianChamber().x()) + > EarthLabyrinthDimensions.GUARDIAN_ARENA_CELL_RADIUS + || Math.abs(lower.z() - layout.guardianChamber().z()) + > EarthLabyrinthDimensions.GUARDIAN_ARENA_CELL_RADIUS, + "Vertical links must stay outside the guardian arena" + ); + } + assertTrue( + layout.passages().size() >= cellCount, + "Extra passages and stairs must give every labyrinth at least one loop" + ); + assertTrue(layout.footprintWidthBlocks() >= 77); + assertTrue(layout.footprintWidthBlocks() <= 101); + } + } + + @Test + void everyPassageIsUniqueAdjacentAndInsideTheLayout() { + for (long seed = 0; seed < 256; seed++) { + EarthLabyrinthLayout layout = EarthLabyrinthPlanner.generate(seed); + Set unique = new HashSet<>(layout.passages()); + + assertEquals(layout.passages().size(), unique.size()); + + for (EarthLabyrinthLayout.Passage passage : layout.passages()) { + assertInside(layout, passage.first()); + assertInside(layout, passage.second()); + + int distance = Math.abs(passage.first().x() - passage.second().x()) + + Math.abs(passage.first().z() - passage.second().z()) + + Math.abs(passage.first().level() - passage.second().level()); + assertEquals(1, distance); + } + } + } + + private static Set reachableFrom( + EarthLabyrinthLayout layout, + EarthLabyrinthLayout.Cell start + ) { + Set reachable = new HashSet<>(); + ArrayDeque queue = new ArrayDeque<>(); + reachable.add(start); + queue.add(start); + + while (!queue.isEmpty()) { + EarthLabyrinthLayout.Cell current = queue.remove(); + + for (EarthLabyrinthLayout.Cell neighbor : layout.neighbors(current)) { + if (reachable.add(neighbor)) { + queue.add(neighbor); + } + } + } + + return reachable; + } + + private static void assertInside( + EarthLabyrinthLayout layout, + EarthLabyrinthLayout.Cell cell + ) { + assertTrue(cell.x() >= 0 && cell.x() < layout.sideCells()); + assertTrue(cell.z() >= 0 && cell.z() < layout.sideCells()); + assertTrue(cell.level() >= 0 && cell.level() < EarthLabyrinthLayout.LEVEL_COUNT); + } +} diff --git a/src/test/java/cz/xefensor/retold/worldgen/earth/EarthLabyrinthRoomsTest.java b/src/test/java/cz/xefensor/retold/worldgen/earth/EarthLabyrinthRoomsTest.java new file mode 100644 index 00000000..776cbd4e --- /dev/null +++ b/src/test/java/cz/xefensor/retold/worldgen/earth/EarthLabyrinthRoomsTest.java @@ -0,0 +1,36 @@ +package cz.xefensor.retold.worldgen.earth; + +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; + +class EarthLabyrinthRoomsTest { + @Test + void roomsAreStableBoundedSideBranchesAwayFromCriticalAnchors() { + for (long seed = 0; seed < 512; seed++) { + EarthLabyrinthLayout layout = EarthLabyrinthPlanner.generate(seed); + var rooms = EarthLabyrinthRooms.plan(layout, seed); + assertEquals(rooms, EarthLabyrinthRooms.plan(layout, seed)); + assertTrue(rooms.size() <= 12); + for (int level = 0; level < 2; level++) { + int floor = level; + assertTrue(rooms.stream().anyMatch(room -> room.cell().level() == floor + && room.kind() == EarthLabyrinthRooms.Kind.TREASURE), "Treasure on each floor: " + seed); + assertTrue(rooms.stream().anyMatch(room -> room.cell().level() == floor + && room.kind() == EarthLabyrinthRooms.Kind.ARROW_TRAP)); + } + for (var room : rooms) { + assertEquals(EarthLabyrinthLayout.CellKind.PASSAGE, layout.kindAt(room.cell())); + assertEquals(1, layout.neighbors(room.cell()).size()); + var mouth = layout.neighbors(room.cell()).getFirst(); + assertEquals(room.cell().x() - mouth.x(), room.backX()); + assertEquals(room.cell().z() - mouth.z(), room.backZ()); + if (room.cell().level() == 1) { + assertTrue(Math.abs(room.cell().x() - layout.guardianChamber().x()) > 4 + || Math.abs(room.cell().z() - layout.guardianChamber().z()) > 4); + } + } + } + } +} diff --git a/src/testClient/java/cz/xefensor/retold/client/render/RetoldBossModelChecks.java b/src/testClient/java/cz/xefensor/retold/client/render/RetoldBossModelChecks.java new file mode 100644 index 00000000..3d7e320a --- /dev/null +++ b/src/testClient/java/cz/xefensor/retold/client/render/RetoldBossModelChecks.java @@ -0,0 +1,199 @@ +package cz.xefensor.retold.client.render; + +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.math.Axis; +import cz.xefensor.retold.worldgen.earth.EarthGuardianLifecycle; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.monster.breeze.BreezeModel; +import net.minecraft.client.renderer.entity.state.BreezeRenderState; +import org.joml.Vector3f; + +/** Offline checks against the installed client models; no game, display, or renderer is started. */ +public final class RetoldBossModelChecks { + private RetoldBossModelChecks() { + } + + public static void main(String[] args) { + guardianUsesSynchronizedProgressAndResetsBetweenEntities(); + guardianSilhouetteMatchesItsHeightAndCullingBounds(); + galeLayersFollowVanillaPosesRegardlessOfSubmissionOrder(); + } + + private static void guardianUsesSynchronizedProgressAndResetsBetweenEntities() { + ModelPart root = EarthGuardianModel.createBodyLayer().bakeRoot(); + EarthGuardianModel model = new EarthGuardianModel(root); + EarthGuardianRenderState state = new EarthGuardianRenderState(); + model.setupAnim(state); + float dormantHead = root.getChild("head").xRot; + state.lifecycle = EarthGuardianLifecycle.AWAKENING; + state.ageInTicks = 10_000.0F; + model.setupAnim(state); + close(dormantHead, root.getChild("head").xRot, "Awakening starts at the statue pose"); + state.awakeningProgress = 0.5F; + model.setupAnim(state); + require(root.getChild("head").xRot > 0.0F && root.getChild("head").xRot < dormantHead, + "Late observers use synchronized encounter progress instead of entity age"); + state.awakeningProgress = 1.0F; + model.setupAnim(state); + close(0.0F, root.getChild("head").xRot, "Awakening reaches the roaming pose"); + + state.lifecycle = EarthGuardianLifecycle.ROAMING; + state.walkAnimationSpeed = 0.8F; + state.walkAnimationPos = 3.0F; + state.attackTicksRemaining = 5.0F; + model.setupAnim(state); + float raisedArm = root.getChild("right_arm").xRot; + state.attackTicksRemaining = 1.0F; + model.setupAnim(state); + require(Math.abs(raisedArm - root.getChild("right_arm").xRot) > 0.1F, + "Existing melee synchronization drives distinct arm poses"); + model.setupAnim(new EarthGuardianRenderState()); + close(dormantHead, root.getChild("head").xRot, "The next statue resets its head"); + close(0.0F, root.getChild("left_leg").xRot, "The next statue resets its stride"); + } + + private static void guardianSilhouetteMatchesItsHeightAndCullingBounds() { + ModelPart root = EarthGuardianModel.createBodyLayer().bakeRoot(); + EarthGuardianModel model = new EarthGuardianModel(root); + EarthGuardianRenderState state = new EarthGuardianRenderState(); + state.lifecycle = EarthGuardianLifecycle.ROAMING; + model.setupAnim(state); + float top = boundsAndUvs(root)[1]; + closeWithin(3.2F, (1.501F - top) * 1.18F, 0.12F, + "The standing statue fits the established boss height"); + for (int ticks = 1; ticks <= 10; ticks++) { + state.attackTicksRemaining = ticks; + model.setupAnim(state); + float[] bounds = boundsAndUvs(root); + require((1.501F - bounds[1]) * 1.18F <= 4.45F, + "Raised arms remain inside the expanded vertical culling bounds"); + for (int yaw = 0; yaw < 360; yaw += 45) { + float[] rotated = boundsAndUvs(root, yaw); + float horizontalExtent = Math.max( + Math.max(Math.abs(rotated[0]), Math.abs(rotated[3])), + Math.max(Math.abs(rotated[2]), Math.abs(rotated[5])) + ) * 1.18F; + require(horizontalExtent <= 2.3F, + "Melee arms remain inside both horizontal culling bounds at body yaw " + yaw); + } + } + } + + private static void galeLayersFollowVanillaPosesRegardlessOfSubmissionOrder() { + ModelPart root = GaleCoreModel.createBodyLayer().bakeRoot(); + GaleCoreModel model = new GaleCoreModel(root); + ModelPart armorRoot = GaleCoreArmorModel.createBodyLayer().bakeRoot(); + GaleCoreArmorModel armor = new GaleCoreArmorModel(armorRoot, + new GaleCoreModel(GaleCoreModel.createBodyLayer().bakeRoot())); + BreezeModel reference = new BreezeModel(BreezeModel.createBodyLayer().bakeRoot()); + for (int animation = 0; animation < 7; animation++) { + BreezeRenderState state = breezeState(animation); + // Armor is intentionally posed before the visible body, just as deferred submissions may be. + armor.setupAnim(state); + model.setupAnim(state); + reference.setupAnim(state); + require(model.head().storePose().equals(reference.head().storePose()), + "The Gale Core retains the installed Breeze head keyframes"); + require(!model.rods().visible, "Original plates replace the vanilla rods"); + ModelPart body = armorRoot.getChild("body"); + require(body.storePose().equals(model.body().storePose()), "Armor follows animated body transforms"); + require(body.getChild("head").storePose().equals(model.head().storePose()), + "The shallow circlet follows animated head transforms"); + require(body.getChild("core").storePose().equals(model.heavyCoreAnchor().storePose()), + "Floating plates and the reward share an anchor"); + verifyRewardAlignment(model); + boundsAndUvs(root); + boundsAndUvs(armorRoot); + BreezeModel wind = new BreezeModel(BreezeModel.createWindLayer().bakeRoot()); + BreezeModel eyes = new BreezeModel(BreezeModel.createEyesLayer().bakeRoot()); + wind.setupAnim(state); + eyes.setupAnim(state); + boundsAndUvs(wind.root()); + boundsAndUvs(eyes.root()); + } + BreezeRenderState idle = breezeState(0); + model.setupAnim(idle); + armor.setupAnim(idle); + close(0.0F, model.body().xRot, "The next idle Gale Core resets its body pose"); + close(0.0F, model.head().xRot, "The next idle Gale Core resets its head pose"); + float top = boundsAndUvs(armorRoot)[1]; + closeWithin(3.98F, (1.501F - top) * 2.25F, 0.15F, + "Commander accents preserve the established boss height"); + } + + private static BreezeRenderState breezeState(int animation) { + BreezeRenderState state = new BreezeRenderState(); + state.ageInTicks = 40.0F; + state.idle.start(0); + switch (animation) { + case 1 -> state.inhale.start(35); + case 2 -> state.shoot.start(35); + case 3 -> state.slide.start(35); + case 4 -> state.slideBack.start(35); + case 5 -> state.longJump.start(35); + case 6 -> state.shoot.start(20); + default -> { } + } + return state; + } + + private static void verifyRewardAlignment(GaleCoreModel model) { + PoseStack reward = new PoseStack(); + GaleCoreHeavyCoreLayer.applyCorePose(reward, model.body(), model.heavyCoreAnchor()); + Vector3f center = reward.last().pose().transformPosition(0.5F, 0.25F, 0.5F, new Vector3f()); + PoseStack expected = new PoseStack(); + model.body().translateAndRotate(expected); + model.heavyCoreAnchor().translateAndRotate(expected); + Vector3f anchor = expected.last().pose().transformPosition(0.0F, 0.0F, 0.0F, new Vector3f()); + close(0.0F, center.distance(anchor), "The installed Heavy Core stays centered during movement and attacks"); + Vector3f blockUp = reward.last().pose().transformDirection(0.0F, 1.0F, 0.0F, new Vector3f()); + Vector3f modelUp = expected.last().pose().transformDirection(0.0F, -1.0F, 0.0F, new Vector3f()); + close(0.0F, blockUp.distance(modelUp), "The Heavy Core stays upright relative to its animated body"); + } + + private static float[] boundsAndUvs(ModelPart root) { + return boundsAndUvs(root, 0.0F); + } + + private static float[] boundsAndUvs(ModelPart root, float bodyYaw) { + float[] bounds = {Float.POSITIVE_INFINITY, Float.POSITIVE_INFINITY, Float.POSITIVE_INFINITY, + Float.NEGATIVE_INFINITY, Float.NEGATIVE_INFINITY, Float.NEGATIVE_INFINITY}; + PoseStack transformed = new PoseStack(); + transformed.mulPose(Axis.YP.rotationDegrees(bodyYaw)); + root.visit(transformed, (pose, path, index, cube) -> { + for (ModelPart.Polygon face : cube.polygons) { + for (ModelPart.Vertex vertex : face.vertices()) { + require(vertex.u() >= 0.0F && vertex.u() <= 1.0F + && vertex.v() >= 0.0F && vertex.v() <= 1.0F, + path + " texture coordinates stay inside their atlas"); + Vector3f point = pose.pose().transformPosition( + vertex.worldX(), vertex.worldY(), vertex.worldZ(), new Vector3f()); + require(Float.isFinite(point.x()) && Float.isFinite(point.y()) && Float.isFinite(point.z()), + path + " produces finite geometry"); + bounds[0] = Math.min(bounds[0], point.x()); + bounds[1] = Math.min(bounds[1], point.y()); + bounds[2] = Math.min(bounds[2], point.z()); + bounds[3] = Math.max(bounds[3], point.x()); + bounds[4] = Math.max(bounds[4], point.y()); + bounds[5] = Math.max(bounds[5], point.z()); + } + } + }); + require(Float.isFinite(bounds[0]), "A model layer contains geometry"); + return bounds; + } + + private static void close(float expected, float actual, String message) { + closeWithin(expected, actual, 0.00001F, message); + } + + private static void closeWithin(float expected, float actual, float tolerance, String message) { + require(Math.abs(expected - actual) <= tolerance, message + ": " + actual + " versus " + expected); + } + + private static void require(boolean valid, String message) { + if (!valid) { + throw new AssertionError(message); + } + } +} diff --git a/tools/.gitignore b/tools/.gitignore new file mode 100644 index 00000000..c18dd8d8 --- /dev/null +++ b/tools/.gitignore @@ -0,0 +1 @@ +__pycache__/ diff --git a/tools/export_klei_field_guide.py b/tools/export_klei_field_guide.py new file mode 100644 index 00000000..ab03e745 --- /dev/null +++ b/tools/export_klei_field_guide.py @@ -0,0 +1,233 @@ +#!/usr/bin/env python3 +"""Export the eight-page companion and package the existing, unmodified development JAR. + +Requires Python Markdown, PySide6, and pypdf. Runs locally without fetching fonts or images. +The output directory is ignored by Git; the original handbook and JAR are never edited. +""" + +import argparse +import base64 +from datetime import datetime, timezone +import hashlib +from html import escape +from html.parser import HTMLParser +import json +import mimetypes +from pathlib import Path +import re +import shutil +import subprocess +import tomllib +from urllib.parse import unquote +import zipfile + +import markdown + +from render_klei_pdf import render_pdf + + +ROOT = Path(__file__).resolve().parents[1] +SOURCE = ROOT / "docs/klei-field-guide.md" +OUTPUT = ROOT / "output/klei-field-guide" +STEM = "Retold-Field-Guide" +MEDIA_EXTENSIONS = {".png", ".jpg", ".jpeg", ".webp", ".mp4", ".webm"} + + +def digest(path): + return hashlib.sha256(path.read_bytes()).hexdigest() + + +def properties(): + return dict(re.findall(r"^([a-z_]+)=(.+)$", (ROOT / "gradle.properties").read_text(), re.M)) + + +class References(HTMLParser): + def __init__(self): + super().__init__() + self.ids = [] + self.links = [] + self.images = [] + + def handle_starttag(self, tag, attributes): + attributes = dict(attributes) + if "id" in attributes: + self.ids.append(attributes["id"]) + if tag == "a": + self.links.append(attributes.get("href", "")) + if tag == "img": + self.images.append(attributes.get("src", "")) + + +def package_identity(settings): + jar = ROOT / f"build/libs/retold-{settings['mod_version']}.jar" + if not jar.is_file(): + raise ValueError(f"Missing development build: {jar.relative_to(ROOT)}") + inputs = [ROOT / name for name in ("build.gradle", "settings.gradle", "gradle.properties")] + inputs += [p for directory in ("src/main", "src/generated", "gradle") + for p in (ROOT / directory).rglob("*") if p.is_file() and not p.name.endswith("~")] + newer = [str(p.relative_to(ROOT)) for p in inputs if p.stat().st_mtime > jar.stat().st_mtime] + if newer: + raise ValueError("Build inputs newer than the JAR; check/rebuild before sharing: " + ", ".join(newer[:8])) + compiled = sorted((ROOT / "build/classes/java/main").rglob("*.class")) + if not compiled: + raise ValueError("No compiled classes available for the static JAR comparison") + resources = [p for p in (ROOT / "src/main/resources").rglob("*") + if p.is_file() and not p.name.endswith("~") and p.suffix != ".bbmodel"] + with zipfile.ZipFile(jar) as archive: + metadata = tomllib.loads(archive.read("META-INF/neoforge.mods.toml").decode()) + mod = next(mod for mod in metadata["mods"] if mod["modId"] == "retold") + if mod["version"] != settings["mod_version"]: + raise ValueError("JAR mod version differs from gradle.properties") + minecraft = next(dep for dep in metadata["dependencies"]["retold"] if dep["modId"] == "minecraft") + if minecraft["versionRange"] != settings["minecraft_version_range"]: + raise ValueError("JAR Minecraft target differs from gradle.properties") + for files, root in ((compiled, ROOT / "build/classes/java/main"), + (resources, ROOT / "src/main/resources")): + for path in files: + entry = path.relative_to(root).as_posix() + if entry not in archive.namelist() or archive.read(entry) != path.read_bytes(): + raise ValueError(f"JAR differs from current compiled/resource input: {entry}") + revision = subprocess.check_output(["git", "rev-parse", "HEAD"], cwd=ROOT, text=True).strip() + dirty = bool(subprocess.check_output(["git", "status", "--porcelain"], cwd=ROOT, text=True).strip()) + return jar, { + "retold": settings["mod_version"], "minecraft": settings["minecraft_version"], + "neoforge": settings["neo_version"], "java": "25", "artifact": jar.name, + "artifact_sha256": digest(jar), + "artifact_file_modified_utc": datetime.fromtimestamp(jar.stat().st_mtime, timezone.utc).isoformat(), + "source_revision": revision, "source_worktree_dirty": dirty, + "compiled_classes_compared": len(compiled), "source_resources_compared": len(resources), + "guide_source_sha256": digest(SOURCE), + "validation": "Static metadata, timestamps, compiled-class and resource byte comparisons; no new build or gameplay run.", + } + + +def inline_images(html): + def replace(match): + path = (ROOT / "docs" / unquote(match.group(1))).resolve() + if not path.is_relative_to(ROOT / "docs/media") or not path.is_file(): + raise ValueError(f"Image must be an existing local docs/media file: {match.group(1)}") + media_type = mimetypes.guess_type(path.name)[0] + return 'src="data:' + media_type + ';base64,' + base64.b64encode(path.read_bytes()).decode() + '"' + return re.sub(r'src="([^"]+)"', replace, html) + + +def render(version): + parts = re.split(r"", SOURCE.read_text()) + if parts[0].strip() or len(parts) != 17: + raise ValueError("Guide must contain exactly eight explicit page markers") + pages, navigation = [], [] + for number, (slug, text) in enumerate(zip(parts[1::2], parts[2::2]), 1): + content = markdown.markdown(text, extensions=["tables", "fenced_code", "toc", "md_in_html"]) + content = inline_images(content) + content = content.replace('href="player-guide.md', 'href="Retold-Player-Guide.html') + pages.append( + f'
' + 'RETOLDA LIVING-WORLD FIELD GUIDE
' + f'
{content}
' + f'XEFENSOR · {escape(version)} ALPHAReference: ' + 'handbook / ' + 'PDF' + f'{number:02d} / 08
' + ) + navigation.append(f'{number:02d} {escape(slug.replace("-", " "))}') + template = (ROOT / "docs/internal/klei-field-guide.template.html").read_text() + return template.replace("@@NAV@@", "".join(navigation)).replace("@@PAGES@@", "\n".join(pages)) + + +def validate_links(path): + parser = References() + parser.feed(path.read_text()) + if len(parser.ids) != len(set(parser.ids)): + raise ValueError("Duplicate guide anchors") + for link in parser.links: + if link.startswith(("https:", "http:", "mailto:")): + continue # External links are preserved, not network-verified. + name, _, fragment = link.partition("#") + destination = path.parent / unquote(name) if name else path + if not destination.is_file(): + raise ValueError(f"Broken local guide link: {link}") + if fragment: + target = References() + target.feed(destination.read_text()) + if unquote(fragment) not in target.ids: + raise ValueError(f"Broken guide anchor: {link}") + if not parser.images or any(not src.startswith("data:image/") for src in parser.images): + raise ValueError("Guide images must be embedded for offline use") + return len(parser.links) + + +def main(): + cli = argparse.ArgumentParser(description=__doc__) + cli.add_argument("--include-media", action="store_true", help="Include existing top-level gameplay media in the ZIP") + args = cli.parse_args() + settings = properties() + for value in (settings["mod_version"], settings["minecraft_version"], settings["neo_version"]): + if value not in SOURCE.read_text(): + raise ValueError(f"Guide does not identify the configured version: {value}") + jar, identity = package_identity(settings) + OUTPUT.mkdir(parents=True, exist_ok=True) + html_path = OUTPUT / f"{STEM}.html" + html_path.write_text(render(settings["mod_version"])) + shutil.copyfile(jar, OUTPUT / jar.name) + for suffix in ("html", "pdf"): + name = f"Retold-Player-Guide.{suffix}" + shutil.copyfile(ROOT / "output/player-guide" / name, OUTPUT / name) + for name in ("LICENSE", "LICENSE-CODE.md", "LICENSE-ASSETS.md", "ASSET_CREDITS.md"): + shutil.copyfile(ROOT / name, OUTPUT / name) + (OUTPUT / "BUILD.json").write_text(json.dumps(identity, indent=2) + "\n") + links = validate_links(html_path) + pdf = OUTPUT / f"{STEM}.pdf" + render_pdf(html_path.read_text(), pdf, settings["mod_version"]) + from pypdf import PdfReader + reader = PdfReader(pdf) + if len(reader.pages) != 8: + raise ValueError(f"Expected eight PDF pages, got {len(reader.pages)}; inspect page overflow") + for number, page in enumerate(reader.pages, 1): + text = " ".join(page.extract_text().split()) + if f"{number:02d} / 08" not in text: + raise ValueError(f"Missing page footer on PDF page {number}") + (OUTPUT / "START-HERE.txt").write_text( + "RETOLD — FOR KLEI\n\n" + f"Build: {jar.name} (development snapshot)\n" + f"Minecraft Java {settings['minecraft_version']} / NeoForge {settings['neo_version']} / Java 25\n\n" + "Put the JAR in your matching NeoForge instance’s mods folder. Start a fresh world.\n" + "Multiplayer requires the same JAR on the server and every client.\n\n" + "Open Retold-Field-Guide.pdf or Retold-Field-Guide.html. Page 2 covers Survival;\n" + "page 7 has three Creative experiments. The full Player Guide is an optional\n" + "reference with progression spoilers. Keep these files together for local links.\n\n" + "Retold is experimental. AI assistance is used for development and some development\n" + "artwork is generated; see the included asset credits. BUILD.json identifies this\n" + "exact JAR; SHA256SUMS lists the included files. This package does not contain\n" + "Minecraft, Java, or the NeoForge installer.\n\n" + "Project: https://github.com/xefensor/Retold\n" + "Contact: alex@alexejtusl.cz\n" + ) + notes = (ROOT / "docs/internal/klei-outreach.md").read_text() + message = notes.split("", 1)[1].split("", 1)[0].strip() + (ROOT / "output/klei-message.txt").write_text(message + "\n") + names = [f"{STEM}.html", f"{STEM}.pdf", jar.name, "Retold-Player-Guide.html", "Retold-Player-Guide.pdf", + "LICENSE", "LICENSE-CODE.md", "LICENSE-ASSETS.md", "ASSET_CREDITS.md", "BUILD.json", "START-HERE.txt"] + if args.include_media: + names += sorted(p.name for p in OUTPUT.iterdir() if p.is_file() and p.suffix.lower() in MEDIA_EXTENSIONS + and not p.name.startswith("page-preview-")) + names = sorted(set(names)) + (OUTPUT / "SHA256SUMS").write_text("".join(f"{digest(OUTPUT / name)} {name}\n" for name in names)) + names.append("SHA256SUMS") + archive_path = ROOT / "output/Retold-for-Klei.zip" + with zipfile.ZipFile(archive_path, "w", compression=zipfile.ZIP_DEFLATED) as archive: + for name in sorted(names): + archive.write(OUTPUT / name, "Retold-for-Klei/" + name) + with zipfile.ZipFile(archive_path) as archive: + if archive.testzip() is not None: + raise ValueError("ZIP integrity check failed") + if hashlib.sha256(archive.read("Retold-for-Klei/" + jar.name)).hexdigest() != identity["artifact_sha256"]: + raise ValueError("Packaged JAR checksum differs from the original") + print(f"Exported eight PDF pages; validated {links} local/external link references (external URLs not fetched).") + print(f"Compared {identity['compiled_classes_compared']} compiled classes and {identity['source_resources_compared']} source resources with the JAR.") + print(f"Guide: {pdf.relative_to(ROOT)}") + print(f"Package: {archive_path.relative_to(ROOT)} ({archive_path.stat().st_size:,} bytes)") + print("Introduction draft: output/klei-message.txt") + + +if __name__ == "__main__": + main() diff --git a/tools/render_klei_pdf.py b/tools/render_klei_pdf.py new file mode 100644 index 00000000..641941cc --- /dev/null +++ b/tools/render_klei_pdf.py @@ -0,0 +1,198 @@ +"""Offline PDF rendering for the companion; Qt handles text layout, pypdf adds navigation. + +The shared HTML content is adapted to Qt's documented rich-text HTML subset: +https://doc.qt.io/qt-6/richtext-html-subset.html +No web engine, browser subprocess, game client, or display server is used. +""" + +from html import escape +from html.parser import HTMLParser +import os +from pathlib import Path +import re +import tempfile + + +PRINT_CSS = """ +body { color: #253b32; font-family: 'Atkinson Hyperlegible Next', 'DejaVu Sans'; } +p { margin-top: 0px; margin-bottom: 11px; line-height: 140%; } +h1 { font-family: 'DejaVu Serif'; color: #345e46; font-size: 64pt; margin-top: 0px; margin-bottom: 3px; } +h2 { font-family: 'DejaVu Serif'; color: #345e46; font-size: 27pt; margin-top: 0px; margin-bottom: 20px; } +h3 { color: #345e46; font-size: 12pt; margin-top: 18px; margin-bottom: 7px; } +.eyebrow { color: #a26444; font-size: 8pt; font-weight: bold; margin-bottom: 15px; } +.subtitle { font-family: 'DejaVu Serif'; color: #345e46; font-size: 21pt; margin-bottom: 28px; } +.edition { color: #657469; font-size: 8pt; margin-top: 16px; } +.caption { color: #657469; font-size: 7.8pt; line-height: 130%; margin-top: 6px; } +.closing { color: #345e46; margin-top: 20px; } +li { margin-bottom: 5px; } +table { margin-top: 8px; margin-bottom: 12px; } +th { background-color: #f0f4ea; color: #345e46; text-align: left; font-size: 9.5pt; } +td { font-size: 9.5pt; } +.note td { background-color: #f0f4ea; font-size: 9.5pt; } +a { color: #315f45; text-decoration: underline; } +pre { background-color: #f0f4ea; font-family: 'DejaVu Sans Mono'; font-size: 8pt; } +code { font-family: 'DejaVu Sans Mono'; font-size: 8.5pt; } +.recipes td { font-size: 8.5pt; } +""" + + +class PrintMarkup(HTMLParser): + """Translate only the three layout widgets into Qt-supported tables.""" + + def __init__(self): + super().__init__() + self.output = [] + self.stack = [] + + def handle_starttag(self, tag, attributes): + attrs = dict(attributes) + category = attrs.get("class", "") + parent = self.stack[-1][1] if self.stack else "" + closing = f"" + if tag == "div" and category in ("flow", "timeline", "recipe-grid"): + css = "recipes" if category == "recipe-grid" else "flow" + start, closing = f'', "
" + elif parent in ("flow", "timeline", "recipe-grid"): + start, closing = '', "" + elif tag == "aside": + start, closing = '
', "
" + elif tag == "figure": + start, closing = "
", "
" + elif tag == "figcaption": + start, closing = '

', "

" + else: + if tag == "table": + attrs.update(width="100%", cellspacing="0", cellpadding="7", border="0") + if tag == "img": + attrs.update(width="416", height="234") + start = "<" + tag + "".join(f' {key}="{escape(value or "", quote=True)}"' for key, value in attrs.items()) + ">" + if tag == "img": + start = '

' + start + "

" + self.output.append(start) + if tag not in ("img", "br", "hr", "meta", "link"): + self.stack.append((tag, category, closing)) + + def handle_endtag(self, tag): + if self.stack and self.stack[-1][0] == tag: + self.output.append(self.stack.pop()[2]) + + def handle_data(self, data): + self.output.append(escape(data)) + + +def anchor_rectangles(document, left, top, page_height): + """Get hyperlink hit areas from actual text lines, including wrapped anchors.""" + block = document.begin() + while block.isValid(): + bounds = document.documentLayout().blockBoundingRect(block) + layout = block.layout() + iterator = block.begin() + while not iterator.atEnd(): + fragment = iterator.fragment() + href = fragment.charFormat().anchorHref() if fragment.isValid() else "" + if href: + start = fragment.position() - block.position() + end = start + fragment.length() + for number in range(layout.lineCount()): + line = layout.lineAt(number) + first = max(start, line.textStart()) + last = min(end, line.textStart() + line.textLength()) + if first >= last: + continue + x1, x2 = line.cursorToX(first)[0], line.cursorToX(last)[0] + x = left + bounds.x() + min(x1, x2) + y = top + bounds.y() + line.y() + # PDF coordinates are points from the lower left; Qt uses 96-DPI pixels. + rect = (x * .75, (page_height - y - line.height()) * .75, + (x + abs(x2 - x1)) * .75, (page_height - y) * .75) + yield href, rect + iterator += 1 + block = block.next() + + +def render_pdf(html, destination, version): + os.environ.setdefault("QT_QPA_PLATFORM", "offscreen") + from PySide6.QtCore import QMarginsF, QPointF, QRectF, Qt + from PySide6.QtGui import QColor, QFont, QGuiApplication, QPainter, QPageSize, QPdfWriter, QTextCursor, QTextDocument, QTextFormat + from pypdf import PdfReader, PdfWriter + from pypdf.annotations import Link + + application = QGuiApplication.instance() or QGuiApplication([]) + pages = re.findall(r'
.*?
(.*?)
body_height: + raise ValueError(f"PDF page {index + 1} ({slug}) overflows: {document.size().height():.1f} > {body_height:.1f} pixels") + links += [(index, href, rect) for href, rect in anchor_rectangles(document, left, top, writer.height())] + painter.save() + painter.translate(left, top) + document.drawContents(painter) + painter.restore() + painter.setPen(QColor("#d3dccf")) + painter.drawLine(left, writer.height() - 66, writer.width() - left, writer.height() - 66) + painter.setPen(QColor("#657469")) + painter.setFont(QFont("DejaVu Sans", 7)) + painter.drawText(QPointF(left, writer.height() - 43), f"XEFENSOR · {version} ALPHA") + painter.drawText(QRectF(left, writer.height() - 57, body_width, 20), Qt.AlignRight, f"{index + 1:02d} / 08") + print(f"PDF page {index + 1}: {document.size().height():.0f}/{body_height} pixels") + finally: + painter.end() + output = PdfWriter(clone_from=PdfReader(raw_pdf)) + # Qt emits unresolved named destinations for manual page frames. Replace its + # link annotations with rectangles tied to our actual eight-page mapping. + output.remove_annotations(subtypes="/Link") + for index, href, rect in links: + annotation = Link(rect=rect, target_page_index=targets[href[1:]]) if href.startswith("#") else Link(rect=rect, url=href) + output.add_annotation(index, annotation) + for title, index in targets.items(): + output.add_outline_item(f"{index + 1:02d} · {title.replace('-', ' ').title()}", index) + output.add_metadata({"/Title": "Retold — A living-world field guide", "/Author": "Xefensor"}) + output.write(destination) + # Retain the Qt application until after the documents and paint devices have finished. + _ = application