Add sweeping twinblade and animated seven-hit combat gauntlets

This commit is contained in:
2026-09-13 10:13:18 +03:00
commit 4ff0ed89b5
167 changed files with 6650 additions and 0 deletions
+77
View File
@@ -0,0 +1,77 @@
"""Build deterministic vanilla item pose models and an original pixel crescent texture.
The gauntlet geometry/textures are imported separately and remain unchanged.
Only Minecraft JSON display transforms are authored here (no client mod required).
"""
from pathlib import Path
import json, math
from PIL import Image
ROOT=Path(__file__).resolve().parents[1]/'src/main/resources'
D=ROOT/'defaults/resources/assets/astraweapons'
def write(path,value):
path.parent.mkdir(parents=True,exist_ok=True)
path.write_text(json.dumps(value,ensure_ascii=False,indent=2)+'\n',encoding='utf-8')
def model(name):return {'type':'minecraft:model','model':name}
def main():
# Vertical PNG strip gives the crescent a five-tick expanding/tapering sweep.
for fiery in (False,True):
size=128; image=Image.new('RGBA',(size,size*5))
for frame in range(5):
for y in range(size):
for x in range(size):
dx=(x+.5-size/2)/(size/2); dz=(y+.5-size/2)/(size/2)
r=math.hypot(dx,dz);angle=math.atan2(dx,dz)
# Local +Z front half circle. Thin bright edge with a broader transparent tail.
if dz>=0 and .58+frame*.035<r<.91+frame*.012 and abs(angle)<=math.pi/2:
band=max(0,1-abs(r-(.85+frame*.012))/.16)
sweep=max(0,1-abs(angle-(-1.0+frame*.5))/2.25)
# Use an opaque core: vanilla item cutout discards a translucent-only crescent.
alpha=255 if band*sweep > .18+frame*.09 else 0
image.putpixel((x,y+frame*size),(255,184,79,alpha) if fiery else (222,208,255,alpha))
name='slash_fire' if fiery else 'slash'
(D/'textures/item').mkdir(parents=True,exist_ok=True)
image.save(D/f'textures/item/{name}.png')
write(D/f'textures/item/{name}.png.mcmeta',{'animation':{'frametime':1,'interpolate':False}})
write(D/f'models/effect/{name}.json',{'textures':{'slash':f'astraweapons:item/{name}','particle':f'astraweapons:item/{name}'},'elements':[
{'from':[0,8,0],'to':[16,8,16],'shade':False,'faces':{
'up':{'texture':'#slash','uv':[0,0,16,16]},'down':{'texture':'#slash','uv':[0,0,16,16],'rotation':180}}}]})
write(D/f'items/{name}.json',{'model':model(f'astraweapons:effect/{name}')})
base=json.loads((D/'models/item/iron_gauntlet_3d.json').read_text())
twin=json.loads((ROOT/'defaults/resources/assets/astraplus/models/item/netherite_twinblade.json').read_text())
for pose in ('jab','hook','uppercut','lunge','twinblade'):
for frame in range(6):
t=frame/5
pulse=math.sin(math.pi*t)
displays={}
for side,sign in [('righthand',1),('lefthand',-1)]:
if pose=='twinblade':
yaw=[-15,-40,0,55,90,20][frame]
roll=[15,30,10,-30,-60,-15][frame]
for view in ('firstperson_','thirdperson_'):
src=twin['display'][view+side]
rot=src['rotation'].copy();trans=src['translation'].copy()
rot[1]+=sign*yaw;rot[2]+=sign*roll
trans[0]-=sign*6*pulse;trans[1]+=pulse;trans[2]-=2*pulse
displays[view+side]={'rotation':rot,'translation':trans,'scale':src['scale']}
else:
for view in ('firstperson_','thirdperson_'):
src=base['display'][view+side]
rot=src.get('rotation',[0,0,0]).copy(); trans=src.get('translation',[0,0,0]).copy()
if pose=='jab':trans[2]-=9*pulse;rot[0]-=18*pulse
elif pose=='hook':trans[0]-=sign*8*pulse;trans[2]-=5*pulse;rot[2]+=sign*60*pulse;rot[1]+=sign*50*pulse
elif pose=='uppercut':trans[1]+=3.5*pulse;trans[2]-=6*pulse;rot[0]-=35*pulse
else:trans[2]-=13*pulse;trans[1]-=2*pulse;rot[0]-=30*pulse
displays[view+side]={'rotation':rot,'translation':trans,'scale':src.get('scale',[1,1,1])}
name=f'{pose}_{frame}'
parent='astraplus:item/netherite_twinblade' if pose=='twinblade' else 'astraweapons:item/iron_gauntlet_3d'
write(D/f'models/animation/{name}.json',{'parent':parent,'display':displays,'textures':{'particle':'#layer0' if pose=='twinblade' else '#0'}})
gui='astraplus:internal/twinblade_gui' if pose=='twinblade' else 'astraweapons:item/iron_gauntlet_2d'
tree={'type':'minecraft:select','property':'minecraft:display_context','cases':[{'when':'gui','model':model(gui)}], 'fallback':model(f'astraweapons:animation/{name}')}
write(D/f'items/animation/{name}.json',{'hand_animation_on_swap':False,'model':tree})
write(D/'items/gauntlet_offhand.json',{'hand_animation_on_swap':False,'model':{'type':'minecraft:select','property':'minecraft:display_context',
'cases':[{'when':'gui','model':model('astraweapons:item/iron_gauntlet_2d')}], 'fallback':model('astraweapons:item/iron_gauntlet_3d')}})
index=sorted(str(f.relative_to(ROOT/'defaults')).replace('\\','/') for f in (ROOT/'defaults').rglob('*') if f.is_file())
(ROOT/'weapons-index.txt').write_text('\n'.join(index)+'\n',encoding='utf-8')
if __name__=='__main__':main()
+79
View File
@@ -0,0 +1,79 @@
param(
[string]$ServerDirectory = 'C:/Users/ScarPC/Documents/NeoForge Server 26.2',
[string]$Java = 'C:/Program Files/Java/jdk-26.0.2/bin/java.exe',
[int]$Port = 26705,
[string]$AstraPlusJar = 'C:/Users/ScarPC/Documents/Plugins/AstraPlus/build/libs/AstraPlus-0.5.67.jar'
)
$ErrorActionPreference = 'Stop'
$repo = Split-Path $PSScriptRoot -Parent
$version = [regex]::Match((Get-Content "$repo/build.gradle.kts" -Raw), '(?m)^version = "([^"]+)"').Groups[1].Value
$run = Join-Path $repo ('build/weapons-capture-' + (Get-Date -Format 'yyyyMMdd-HHmmss') + '-' + [guid]::NewGuid().ToString('N').Substring(0,6))
$serverRun = Join-Path $run 'server'
$clientRun = Join-Path $run 'client'
New-Item -ItemType Directory -Path "$serverRun/mods", "$clientRun/resourcepacks" -Force | Out-Null
Copy-Item -LiteralPath $AstraPlusJar, "$repo/build/libs/AstraWeapons-0.1.0.jar", "$repo/build/libs/AstraWeapons-0.1.0-verification.jar" -Destination "$serverRun/mods"
New-Item -ItemType Directory -Path "$serverRun/astraplus" -Force | Out-Null
$serverRoot = (Resolve-Path -LiteralPath $ServerDirectory).Path.Replace('\','/')
$argsText = (@(foreach ($line in (Get-Content "$ServerDirectory/libraries/net/neoforged/neoforge/26.2.0.79/win_args.txt")) {
if ($line -eq '-DlibraryDirectory=libraries') { '"-DlibraryDirectory=' + $serverRoot + '/libraries"' }
elseif ($line.StartsWith('libraries/')) { '"' + $line.Replace('libraries/', "$serverRoot/libraries/") + '"' }
else { $line }
}) -join "`n")
[IO.File]::WriteAllText("$serverRun/server-args.txt", $argsText, [Text.UTF8Encoding]::new($false))
[IO.File]::WriteAllText("$serverRun/eula.txt", 'eula=true')
[IO.File]::WriteAllText("$serverRun/server.properties", @"
server-ip=127.0.0.1
server-port=$Port
online-mode=false
difficulty=normal
level-type=minecraft:flat
generator-settings={"layers":[{"block":"minecraft:bedrock","height":1},{"block":"minecraft:dirt","height":2},{"block":"minecraft:grass_block","height":1}],"biome":"minecraft:plains"}
generate-structures=false
spawn-protection=0
view-distance=3
simulation-distance=3
max-tick-time=120000
use-native-transport=false
"@)
[IO.File]::WriteAllText("$clientRun/options.txt", @'
resourcePacks:["vanilla","file/AstraPlus.zip"]
incompatibleResourcePacks:[]
enableVsync:false
renderDistance:4
simulationDistance:5
maxFps:60
pauseOnLostFocus:false
skipMultiplayerWarning:true
onboardAccessibility:false
tutorialStep:none
soundCategory_master:0.0
fullscreen:false
'@)
Set-Content -LiteralPath "$repo/build/active-weapons-capture.txt" -Value $run
New-Item -ItemType Directory -Path "$serverRun/config" -Force | Out-Null
[IO.File]::WriteAllText("$serverRun/config/astraplus.json",'{"build":{"onStartup":false},"astraPacks":{"enabled":false,"rebuildAfterExport":false}}')
$serverProcess = Start-Process -FilePath $Java -ArgumentList @('-Xms256M','-Xmx3G','-Dastraweapons.isolatedVerification=true','-Dastraweapons.capture=true','@server-args.txt','nogui') -WorkingDirectory $serverRun -WindowStyle Hidden -PassThru -RedirectStandardOutput "$serverRun/stdout.log" -RedirectStandardError "$serverRun/stderr.log"
try {
$deadline = [DateTime]::UtcNow.AddMinutes(5)
while (!(Test-Path -LiteralPath "$serverRun/capture-ready.txt")) {
if ($serverProcess.HasExited) { throw "Capture fixture exited before ready: $serverRun" }
if ([DateTime]::UtcNow -gt $deadline) { throw "Capture fixture startup timed out: $serverRun" }
Start-Sleep -Seconds 1
}
Copy-Item -LiteralPath "$serverRun/astraplus/output/AstraPlus.zip" -Destination "$clientRun/resourcepacks/AstraPlus.zip"
Write-Output "Isolated server ready; launching client: $run"
$env:JAVA_HOME = Split-Path (Split-Path $Java -Parent) -Parent
Push-Location $repo
try {
& .\gradlew.bat runWeaponsCaptureClient "-PcaptureClientDirectory=$clientRun" "-PcaptureServerDirectory=$serverRun" "-PcapturePort=$Port" "-PastraPlusJar=$AstraPlusJar" --offline --console=plain *> "$run/client-launch.log"
if ($LASTEXITCODE -ne 0) { throw "Client launch failed: $run/client-launch.log" }
} finally { Pop-Location }
$result = Get-Content -LiteralPath "$clientRun/weapons-client-result.txt" -Raw
if (!$result.StartsWith('PASS:')) { throw "Client verification failed: $result ($run)" }
Write-Output $result
Write-Output "Screenshots: $clientRun/screenshots"
} finally {
# Graceful fixture shutdown uses only the unique disposable directory created above.
[IO.File]::WriteAllText("$serverRun/capture-finished.txt", 'Harness completed')
if (!$serverProcess.HasExited -and !$serverProcess.WaitForExit(15000)) { Stop-Process -Id $serverProcess.Id }
}
+28
View File
@@ -0,0 +1,28 @@
"""Copy exact Dungeons wave files listed in the Minecraft Wiki Gauntlets sound table.
Input is an existing local UEViewer audio export, not a download or a game installation.
Original OGG bytes and per-file SHA-256 provenance are retained.
"""
from pathlib import Path
import argparse,hashlib,json,shutil
ROOT=Path(__file__).resolve().parents[1]
FAMILIES={'hit_light':'HitImpactLight','hit_medium':'HitImpactMedium','hit_kick':'HitImpactKick',
'hit_punch':'HitImpactPunch','swing_short':'SwingShort','swing_medium':'SwingMedium','swing_kick':'SwingKick','swing_scream':'SwingScream'}
def main():
parser=argparse.ArgumentParser();parser.add_argument('export',type=Path);args=parser.parse_args()
assets=ROOT/'src/main/resources/defaults/resources/assets/astraweapons'; dest=assets/'sounds/gauntlets';dest.mkdir(parents=True,exist_ok=True)
events={};manifest=[]
for event,family in FAMILIES.items():
files=sorted(args.export.rglob('sfx_item_gauntlets'+family+'-*_soundWave.ogg'))
if not files:raise RuntimeError('Missing original sounds: '+family)
names=[]
for source in files:
data=source.read_bytes();assert data[:4]==b'OggS',source
target=dest/source.name.lower();shutil.copyfile(source,target)
names.append('astraweapons:gauntlets/'+target.stem)
manifest.append({'file':target.relative_to(assets).as_posix(),'original':source.name,
'sha256':hashlib.sha256(data).hexdigest(),'reference':'https://minecraft.wiki/w/File:'+source.name[0].upper()+source.name[1:]})
events['gauntlets.'+event]={'sounds':names,'subtitle':'subtitles.astraweapons.gauntlets.'+event}
(assets/'sounds.json').write_text(json.dumps(events,indent=2)+'\n',encoding='utf-8')
(ROOT/'src/main/resources/gauntlet-audio-provenance.json').write_text(json.dumps(manifest,indent=2)+'\n',encoding='utf-8')
if __name__=='__main__':main()
+63
View File
@@ -0,0 +1,63 @@
param([string]$ServerDirectory = 'C:/Users/ScarPC/Documents/NeoForge Server 26.2')
$ErrorActionPreference='Stop'
Add-Type -AssemblyName System.IO.Compression.FileSystem
$repo=Split-Path $PSScriptRoot -Parent
$mods=(Resolve-Path -LiteralPath (Join-Path $ServerDirectory 'mods')).Path
$jobs=@(
@{Id='astraplus';Jar=(Join-Path (Split-Path $repo -Parent) 'AstraPlus/build/libs/AstraPlus-0.5.67.jar')},
@{Id='astraweapons';Jar=(Join-Path $repo 'build/libs/AstraWeapons-0.1.0.jar')}
)
function Get-ModIds([string]$Jar) {
$zip=[IO.Compression.ZipFile]::OpenRead($Jar)
try {
$entry=$zip.GetEntry('META-INF/neoforge.mods.toml')
if(!$entry){return @()}
$reader=[IO.StreamReader]::new($entry.Open())
try {$descriptor=$reader.ReadToEnd()}finally{$reader.Dispose()}
foreach($section in ($descriptor -split '\[\[mods\]\]' | Select-Object -Skip 1)) {
$body=($section -split '\[\[',2)[0]
$match=[regex]::Match($body,'(?m)^\s*modId\s*=\s*"([^"]+)"')
if($match.Success){$match.Groups[1].Value}
}
}finally{$zip.Dispose()}
}
$installed=@(Get-ChildItem -LiteralPath $mods -File -Filter '*.jar' | ForEach-Object {
[PSCustomObject]@{Path=$_.FullName;Name=$_.Name;Ids=@(Get-ModIds $_.FullName)}
})
foreach($job in $jobs) {
$source=(Resolve-Path -LiteralPath $job.Jar).Path
if(@(Get-ModIds $source) -notcontains $job.Id){throw "Incorrect built mod: $source"}
$job.Jar=$source
$job.Old=@($installed | Where-Object {$_.Ids -contains $job.Id})
$target=Join-Path $mods (Split-Path $source -Leaf)
if((Test-Path -LiteralPath $target) -and $target -notin $job.Old.Path){throw "Target filename belongs to a different mod: $target"}
foreach($old in $job.Old) {
$resolved=(Resolve-Path -LiteralPath $old.Path).Path
if((Split-Path $resolved -Parent) -ne $mods){throw "Installed JAR is outside mods root: $resolved"}
# Fail before moving anything if a running process locks either installed mod.
$stream=[IO.File]::Open($resolved,[IO.FileMode]::Open,[IO.FileAccess]::ReadWrite,[IO.FileShare]::None)
$stream.Dispose()
}
}
$archiveRoot=Join-Path $ServerDirectory 'old-mods'
$archive=Join-Path $archiveRoot (Get-Date -Format 'yyyyMMdd-HHmmss')
if(Test-Path -LiteralPath $archive){$archive+='-'+[guid]::NewGuid().ToString('N').Substring(0,6)}
New-Item -ItemType Directory -Path $archive | Out-Null
$receipt=@()
foreach($job in $jobs) {
$saved=@()
foreach($old in $job.Old) {
$destination=Join-Path $archive $old.Name
if(Test-Path -LiteralPath $destination){throw "Archive already contains $destination"}
Move-Item -LiteralPath $old.Path -Destination $destination
$saved+=$destination
}
$target=Join-Path $mods (Split-Path $job.Jar -Leaf)
Copy-Item -LiteralPath $job.Jar -Destination $target
$expected=(Get-FileHash -LiteralPath $job.Jar -Algorithm SHA256).Hash
$actual=(Get-FileHash -LiteralPath $target -Algorithm SHA256).Hash
if($expected -ne $actual){throw "Installed JAR SHA-256 mismatch: $target"}
$receipt+=[PSCustomObject]@{Mod=$job.Id;Installed=$target;SHA256=$actual;Archived=$saved}
}
$receipt | ConvertTo-Json -Depth 5 | Set-Content -LiteralPath (Join-Path $repo 'build/install-receipt.json') -Encoding utf8
$receipt | Format-List
+44
View File
@@ -0,0 +1,44 @@
param(
[string]$ServerDirectory = 'C:/Users/ScarPC/Documents/NeoForge Server 26.2',
[string]$Java = 'C:/Program Files/Java/jdk-26.0.2/bin/java.exe',
[string]$AstraPlusJar = 'C:/Users/ScarPC/Documents/Plugins/AstraPlus/build/libs/AstraPlus-0.5.67.jar',
[int]$Port = 26704
)
$ErrorActionPreference = 'Stop'
$repo = Split-Path $PSScriptRoot -Parent
$run = Join-Path $repo ('build/verify-' + (Get-Date -Format 'yyyyMMdd-HHmmss') + '-' + [guid]::NewGuid().ToString('N').Substring(0,6))
New-Item -ItemType Directory -Path "$run/mods", "$run/config" -Force | Out-Null
Copy-Item -LiteralPath $AstraPlusJar,"$repo/build/libs/AstraWeapons-0.1.0.jar","$repo/build/libs/AstraWeapons-0.1.0-verification.jar" -Destination "$run/mods"
$serverRoot = (Resolve-Path -LiteralPath $ServerDirectory).Path.Replace('\','/')
$argsText = (@(foreach ($line in (Get-Content "$ServerDirectory/libraries/net/neoforged/neoforge/26.2.0.79/win_args.txt")) {
if ($line -eq '-DlibraryDirectory=libraries') { '"-DlibraryDirectory=' + $serverRoot + '/libraries"' }
elseif ($line.StartsWith('libraries/')) { '"' + $line.Replace('libraries/', "$serverRoot/libraries/") + '"' }
else { $line }
}) -join "`n")
[IO.File]::WriteAllText("$run/server-args.txt",$argsText,[Text.UTF8Encoding]::new($false))
[IO.File]::WriteAllText("$run/eula.txt",'eula=true')
[IO.File]::WriteAllText("$run/config/astraplus.json",'{"build":{"onStartup":false},"astraPacks":{"enabled":false,"rebuildAfterExport":false}}')
[IO.File]::WriteAllText("$run/server.properties",@"
server-ip=127.0.0.1
server-port=$Port
online-mode=false
difficulty=normal
level-type=minecraft:flat
generator-settings={"layers":[{"block":"minecraft:bedrock","height":1},{"block":"minecraft:dirt","height":2},{"block":"minecraft:grass_block","height":1}],"biome":"minecraft:plains"}
generate-structures=false
spawn-protection=0
view-distance=2
simulation-distance=2
max-tick-time=120000
use-native-transport=false
"@)
Set-Content -LiteralPath "$repo/build/active-verification.txt" -Value $run
Push-Location $run
try {
& $Java '-Xms256M' '-Xmx3G' '-Dastraweapons.isolatedVerification=true' '@server-args.txt' nogui *> 'server.log'
if ($LASTEXITCODE -ne 0) { throw "Server failed: $run/server.log" }
$result = Get-Content -LiteralPath 'weapons-result.txt' -Raw
if (!$result.StartsWith('PASS:')) { throw "Verification failed: $result ($run)" }
Write-Output $result
} finally { Pop-Location }
Write-Output "Verified in $run"