Register jerboa display textures in the modern item atlas #17
3 changed files with 48 additions and 9 deletions
11
docs/JERBOA-ITEM-ATLAS-20261129.md
Normal file
11
docs/JERBOA-ITEM-ATLAS-20261129.md
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
# Jerboa display texture registration
|
||||
|
||||
The actual deployed central pack (SHA-256 `61931cc463933706fb391ce8aaff78138ff1377241e062aac000aa144242a10d`) contains all four jerboa item definitions, 3D models and `assets/dunerealms/textures/entity/jerboa.png`. The actual retained Terrain `FaunaModels` emits PAPER ItemDisplays with `dunerealms:entity/jerboa`, `_curled`, `_walk_left` and `_walk_right` item models. The owner's client log explicitly reports the shared `dunerealms:entity/jerboa` texture missing from these models.
|
||||
|
||||
The missing dependency is registration in the modern **item atlas**, not an absent PNG. The old builder scanned only `models/item/`; these models live under `models/entity/`. Their texture is outside the automatically discovered `item/` and `block/` directories, and the deployed item atlas had an empty explicit source list. File-reference closure alone did not catch this renderer dependency.
|
||||
|
||||
Resolve model references from the actual modern item definitions regardless of the target model directory. Register reachable custom sprites outside the automatic directories and reject missing item-atlas registrations in the build. The current pack adds exactly one explicit sprite, `dunerealms:entity/jerboa`, covering all four animations. The tiny-worm model uses existing vanilla block textures and requires no new custom sprite.
|
||||
|
||||
No artwork, PNG, model geometry, item identity, native entity behavior, GUI source, backend JAR, font or transport is changed. Chukka is a native Chicken in the actual retained implementation; it has no custom display-model emission. The suspected chicken appearance is not established as another missing model and is not silently given a new global entity reskin.
|
||||
|
||||
Validation: full pack closure/deterministic build, existing equipment/font/vanilla coverage, and a failing-then-passing fixture for an item definition targeting `models/entity/`. Compare the built ZIP against the prior pack: only `assets/minecraft/atlases/items.json` should differ. Actual client acceptance still requires the new pack to load and the missing-jerboa warning to disappear; source tests are not an in-game visual claim. Deploy using the existing immutable pack publisher and source-pinned pack configuration, retaining all working runtime JAR hashes.
|
||||
|
|
@ -144,6 +144,29 @@ def vanilla_catalog(files,vanilla):
|
|||
return {'definitions':definitions,'modelReferences':references,'staticTextureReferences':len(static),'nativeGeneratedTrimSprites':len(generated),'specialRendererModels':'preserved'}
|
||||
|
||||
|
||||
def required_item_sprites(files, vanilla):
|
||||
"""Modern item definitions may point at models/entity or any other model directory."""
|
||||
sprites=set(); audit=Closure(files,vanilla)
|
||||
for key,payload in files.items():
|
||||
if '/items/' not in key or not key.endswith('.json'): continue
|
||||
definition=json.loads(payload)
|
||||
for model in [*strings_named(definition,'model'), *strings_named(definition,'base')]:
|
||||
textures,_=audit.model(path_for(model,'models'))
|
||||
for ref in textures.values():
|
||||
if isinstance(ref,dict):ref=ref['sprite']
|
||||
if not ref.startswith('#'):
|
||||
ns,leaf=resource(ref)
|
||||
if ns!='minecraft' and not leaf.startswith(('item/','block/')):sprites.add(ns+':'+leaf)
|
||||
return sprites
|
||||
|
||||
|
||||
def validate_item_atlas(files, vanilla):
|
||||
sources=json.loads(files.get('assets/minecraft/atlases/items.json',b'{"sources":[]}'))['sources']
|
||||
published={source.get('sprite',source['resource']) for source in sources if source['type'].split(':')[-1]=='single'}
|
||||
missing=required_item_sprites(files,vanilla)-published
|
||||
if missing:raise ValueError('Item atlas missing custom sprites: '+', '.join(sorted(missing)))
|
||||
|
||||
|
||||
def build(output, source_commit, vanilla, source_root=SOURCE):
|
||||
if not re.fullmatch('[a-f0-9]{40}',source_commit):raise ValueError('Exact source SHA required')
|
||||
lock=json.loads((source_root/'inputs.lock.json').read_text(encoding='utf-8'))
|
||||
|
|
@ -158,15 +181,7 @@ def build(output, source_commit, vanilla, source_root=SOURCE):
|
|||
# Compatibility alias removes the historical dangling default-font reference without replacing source artwork.
|
||||
files['assets/dunerealms/font/imperial_menus.json']=encoded({'providers':[{'type':'reference','id':'dunerealms:card_art'},{'type':'reference','id':'dunerealms:lore_panels'}]})
|
||||
# Item-only sprites outside the vanilla item directory need explicit registration; register in ONE atlas.
|
||||
sprites=set(); audit=Closure(files,vanilla)
|
||||
for key in files:
|
||||
if '/models/item/' in key and key.endswith('.json'):
|
||||
textures,_=audit.model(key)
|
||||
for ref in textures.values():
|
||||
if isinstance(ref,dict):ref=ref['sprite']
|
||||
if not ref.startswith('#'):
|
||||
ns,leaf=resource(ref)
|
||||
if ns!='minecraft' and not leaf.startswith(('item/','block/')):sprites.add(ns+':'+leaf)
|
||||
sprites=required_item_sprites(files,vanilla)
|
||||
files['assets/minecraft/atlases/items.json']=encoded({'sources':[{'type':'minecraft:single','resource':ref,'sprite':ref} for ref in sorted(sprites)]})
|
||||
transport_path=ROOT/'network/resource-pack/mcgui/transport-0.8.6.zip'
|
||||
if hashlib.sha256(transport_path.read_bytes()).hexdigest()!=lock['transportSha256']:raise ValueError('Transport input differs')
|
||||
|
|
@ -179,6 +194,7 @@ def build(output, source_commit, vanilla, source_root=SOURCE):
|
|||
files['pack.mcmeta']=encoded(meta)
|
||||
files['CREDITS-DuneRealms.txt']=b'DuneRealms central artwork: owner-supplied procedural source and assets. Vanilla material layer extends that generator, retaining Minecraft/Mojang silhouettes and UV relief where noted; futuristic ore/metal icons and masonry/furniture materials by DuneRealms. Existing custom card atlases, legacy custom item/entity artwork and MCGUI transport preserved. No Xeindom/XAE assets.\n'
|
||||
counts=Closure(files,vanilla).validate()
|
||||
validate_item_atlas(files,vanilla)
|
||||
vanilla_art['itemCatalog']=vanilla_catalog(files,vanilla)
|
||||
output=Path(output);output.parent.mkdir(parents=True,exist_ok=True)
|
||||
with zipfile.ZipFile(output,'w',compression=zipfile.ZIP_DEFLATED,compresslevel=9) as zipout:
|
||||
|
|
|
|||
|
|
@ -8,6 +8,14 @@ import plugin_resource_pack as pack
|
|||
|
||||
PNG=b'\x89PNG\r\n\x1a\n'+b'\0'*16
|
||||
class DependencyTests(unittest.TestCase):
|
||||
def test_item_display_entity_model_requires_an_explicit_item_atlas_sprite(self):
|
||||
files={'assets/test/items/entity/animal.json':pack.encoded({'model':{'type':'minecraft:model','model':'test:entity/animal'}}),
|
||||
'assets/test/models/entity/animal.json':pack.encoded({'textures':{'fur':'test:entity/animal','particle':'#fur'}}),
|
||||
'assets/test/textures/entity/animal.png':PNG}
|
||||
self.assertEqual(pack.required_item_sprites(files,{}),{'test:entity/animal'})
|
||||
with self.assertRaisesRegex(ValueError,'Item atlas missing'):pack.validate_item_atlas(files,{})
|
||||
files['assets/minecraft/atlases/items.json']=pack.encoded({'sources':[{'type':'minecraft:single','resource':'test:entity/animal','sprite':'test:entity/animal'}]})
|
||||
pack.validate_item_atlas(files,{})
|
||||
def test_historical_missing_default_font_is_rejected(self):
|
||||
files={'assets/minecraft/font/default.json':pack.encoded({'providers':[{'type':'reference','id':'dunerealms:imperial_menus'}]})}
|
||||
with self.assertRaisesRegex(ValueError,'Missing font'):pack.Closure(files,{}).validate()
|
||||
|
|
@ -57,6 +65,10 @@ class CompletePackTests(unittest.TestCase):
|
|||
expected_custom[path.relative_to(directory).as_posix()]=path.read_bytes()
|
||||
for key,payload in expected_custom.items():self.assertTrue(files.get(key)==payload,key)
|
||||
self.assertNotIn('assets/minecraft/font/default.json',files)
|
||||
sprites={source['sprite'] for source in json.loads(files['assets/minecraft/atlases/items.json'])['sources']}
|
||||
self.assertIn('dunerealms:entity/jerboa',sprites)
|
||||
self.assertIn('assets/dunerealms/items/entity/tiny_worm.json',files)
|
||||
pack.validate_item_atlas(files,self.vanilla)
|
||||
transport=pack.read_zip(pack.ROOT/'network/resource-pack/mcgui/transport-0.8.6.zip')
|
||||
for name,payload in transport.items():
|
||||
if name!='pack.mcmeta':self.assertEqual(files[name],payload)
|
||||
|
|
|
|||
Loading…
Reference in a new issue

Staff