forked from unimatrix/web
Fresh production baseline [skip ci]
This commit is contained in:
commit
0a11a18274
1 changed files with 229644 additions and 0 deletions
21
tools/patch-jerboa-motion.py
Normal file
21
tools/patch-jerboa-motion.py
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
"""Replace only fauna runtime classes in the hash-pinned current terrain JAR."""
|
||||
import pathlib,sys,hashlib,zipfile,json
|
||||
source,classes,output=map(pathlib.Path,sys.argv[1:4]);expected=sys.argv[4]
|
||||
assert not output.exists() and hashlib.sha256(source.read_bytes()).hexdigest()==expected
|
||||
allowed=['com/example/duneterrain/'+name+'.class' for name in ('JerboaMobs','FaunaModels')]
|
||||
with zipfile.ZipFile(source) as original:
|
||||
entries={name:original.read(name) for name in original.namelist()}
|
||||
assert len(entries)==len(original.namelist())
|
||||
before=dict(entries)
|
||||
for name in allowed:
|
||||
assert name in entries
|
||||
data=(classes/name).read_bytes();assert data[:4]==b'\xca\xfe\xba\xbe' and int.from_bytes(data[6:8],'big')==65
|
||||
entries[name]=data
|
||||
entries['plugin.yml']=entries['plugin.yml'].decode().replace('version: 1.0.12-arrakeen1-fauna2-trails1','version: 1.0.12-arrakeen1-fauna3-trails1').encode()
|
||||
assert entries['plugin.yml']!=before['plugin.yml']
|
||||
with zipfile.ZipFile(output,'x',zipfile.ZIP_DEFLATED) as target:
|
||||
for name,data in entries.items():target.writestr(name,data)
|
||||
with zipfile.ZipFile(output) as target:
|
||||
changed=[name for name in before if target.read(name)!=before[name]]
|
||||
assert set(changed)==set(allowed+['plugin.yml'])
|
||||
print(json.dumps({'sha256':hashlib.sha256(output.read_bytes()).hexdigest(),'changed':changed,'worldGenerationChanged':False}))
|
||||
Loading…
Reference in a new issue

Staff