Add native Ender Chest and double Shulker Shell loot rules #86

Merged
unimatrix merged 3 commits from fix/network-loot-release-20261205 into main 2026-12-05 19:43:02 +01:00
6 changed files with 122 additions and 0 deletions

View file

@ -0,0 +1,45 @@
name: Network Native Loot Datapack
on:
workflow_dispatch:
push:
branches: ['fix/network-loot-release-*']
jobs:
network-loot:
runs-on: dune-ci
steps:
- name: Check out exact revision
shell: bash
env:
REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -euo pipefail
git init .
git -c http.extraheader="AUTHORIZATION: basic $(printf 'x-access-token:%s' "$REPO_TOKEN" | base64 -w0)" fetch --depth=1 https://www.dunerealms.com/git/unimatrix/plugins.git "$GITHUB_SHA"
git checkout --detach FETCH_HEAD
- name: Package exact reviewed loot files
shell: bash
run: |
set -euo pipefail
mkdir network-loot
python3 tools/plugin_network_loot.py DuneTerrain/network-loot-datapack network-loot/dunerealms-network-loot.zip
python3 - <<'PY'
import json, zipfile
from pathlib import Path
with zipfile.ZipFile('network-loot/dunerealms-network-loot.zip') as archive:
for name in archive.namelist():
assert archive.read(name)==Path('DuneTerrain/network-loot-datapack',name).read_bytes()
chest=json.loads(archive.read('data/minecraft/loot_table/blocks/ender_chest.json'))
shell=json.loads(archive.read('data/minecraft/loot_table/entities/shulker.json'))
assert chest['pools'][0]['entries']==[{'type':'minecraft:item','name':'minecraft:ender_chest'}]
assert chest['pools'][0]['conditions']==[{'condition':'minecraft:survives_explosion'}]
assert shell['pools'][0]['entries'][0]['functions']==[{'function':'minecraft:set_count','count':2}]
PY
cp tools/{plugin_network_loot.py,plugin_wild_update.py} network-loot/
cp DuneTerrain/docs/network-loot-datapack.md network-loot/ACTIVATION.md
printf '%s\n' "$GITHUB_SHA" > network-loot/SOURCE_COMMIT
(cd network-loot && sha256sum -- *.zip *.py ACTIVATION.md SOURCE_COMMIT > SHA256SUMS)
- uses: actions/upload-artifact@v3
with:
name: DuneRealms-Network-Native-Loot
path: network-loot
if-no-files-found: error

View file

@ -0,0 +1,26 @@
# Native Ender Chest and Shulker Shell loot
The pack changes only the two named vanilla loot tables. Normal survival mining
with the required tool returns one Ender Chest without requiring Silk Touch;
native creative/protection checks still own block breaking. Registered custom
DuneChest storage retains its separate existing handler and original item data.
Each shulker drops two shells. No quest, account, XP or money state is changed.
Target: the retained Paper 26.2.135 data format 107.1. The source definitions were
exercised on that exact native runtime in a disposable world. Future Paper
upgrades require their own pack compatibility and native loot checks.
Install one copy in each backend's actual primary `level-name` world datapacks
directory. It governs that server's dimensions through the shared loot manager.
Before installation, inspect every enabled pack and any plugin handlers for
conflicting overrides. Preserve existing packs and their priorities.
Activate only at an approved clean server restart. Do **not** use Bukkit reload
or `minecraft:reload` on the current production stack: the latter replaces the
native RecipeManager, while retained JARVIS recipe/origin registrations listen
to ServerLoadEvent. A successful vanilla-only loot reload is insufficient proof
that the network's custom recipes survive.
Verify exact canonical source/checksums, pack discovery/enabled state, clean
startup, and preservation of the retained recipes and unrelated files. Do not
spawn live test items or perform real banking/quest transactions as a check.

View file

@ -0,0 +1,11 @@
{
"type": "minecraft:block",
"pools": [
{
"rolls": 1,
"conditions": [{"condition": "minecraft:survives_explosion"}],
"entries": [{"type": "minecraft:item", "name": "minecraft:ender_chest"}]
}
],
"random_sequence": "minecraft:blocks/ender_chest"
}

View file

@ -0,0 +1,16 @@
{
"type": "minecraft:entity",
"pools": [
{
"rolls": 1,
"entries": [
{
"type": "minecraft:item",
"name": "minecraft:shulker_shell",
"functions": [{"function": "minecraft:set_count", "count": 2}]
}
]
}
],
"random_sequence": "minecraft:entities/shulker"
}

View file

@ -0,0 +1,7 @@
{
"pack": {
"description": "DuneRealms Ender Chest and Shulker Shell drops",
"min_format": [107, 1],
"max_format": [107, 1]
}
}

View file

@ -0,0 +1,17 @@
"""Package only the reviewed native loot definitions; never edits a game world."""
import argparse
import json
from pathlib import Path
from plugin_wild_update import write_archive
FILES={'pack.mcmeta','data/minecraft/loot_table/blocks/ender_chest.json','data/minecraft/loot_table/entities/shulker.json'}
def build(root,output):
actual={p.relative_to(root).as_posix() for p in root.rglob('*') if p.is_file()}
if actual!=FILES or any(p.is_symlink() for p in root.rglob('*')):raise ValueError('Unexpected loot pack files')
entries={name:(root/name).read_bytes() for name in sorted(FILES)}
for data in entries.values():json.loads(data)
with output.open('xb') as stream:stream.write(write_archive(entries))
if __name__=='__main__':
p=argparse.ArgumentParser(description=__doc__);p.add_argument('root',type=Path);p.add_argument('output',type=Path);build(**vars(p.parse_args()))