commit 4ff0ed89b50c8c7c02749b691e390d11a79205f3 Author: ScarPC Date: Sun Sep 13 10:13:18 2026 +0300 Add sweeping twinblade and animated seven-hit combat gauntlets diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a685047 --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +.gradle/ +build/ +.idea/ +*.log +*.hprof +__pycache__/ diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..13dce4d --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,10 @@ +# AstraWeapons — серверный мод NeoForge + +- Minecraft 26.2, NeoForge 26.2.0.79, Java 25+. Серверный мод, ванильный клиент и ресурспак AstraPlus. +- Исходники оружия и его ресурсы принадлежат AstraWeapons. AstraPlus предоставляет общие контент, чары, модели и сборку пака. +- Сохранять идентификатор старого твинблейда `astraplus:netherite_twinblade` для совместимости миров и чар. +- После изменений выполнить сборку и проверки; установить JAR прямо в `C:\Users\ScarPC\Documents\NeoForge Server 26.2\mods`. +- Прежний JAR именно AstraWeapons переносить в уникальный `old-mods/YYYYMMDD-HHMMSS/`; архив не перезаписывать. Сравнить SHA-256 сборки и установленного JAR. +- Не использовать отложенную установку, не изменять миры, существующие настройки и Paper-сервер. +- Проверять diff, коммитить только изменения задачи. Push — только по запросу. Не коммитить build, .gradle, логи, тестовые миры и резервные копии; Gradle wrapper входит в репозиторий. +- В итоговом ответе указать установку, архив, коммит и ограничения проверок. diff --git a/README.md b/README.md new file mode 100644 index 0000000..d8752fb --- /dev/null +++ b/README.md @@ -0,0 +1,42 @@ +# AstraWeapons + +Серверный мод для Minecraft 26.2 / NeoForge 26.2.0.79 / Java 25+. +Требуется AstraPlus 0.5.67+. Клиенту нужны ванильный Minecraft 26.2 и ресурспак AstraPlus; AstraWeapons на клиент не устанавливается. + +Выдача: + +```text +/astraplus give @s astraplus:netherite_twinblade +/astraplus give @s astraweapons:gauntlets +``` + +Твинблейд перенесён из AstraPlus с сохранением ID, существующих предметов, моделей, определений и четырёх чар. +Полностью заряженная ЛКМ начинает замах на 2 тика, затем наносит 7 урона каждой допустимой цели в секторе 180° до 3 блоков. +«Размах» расширяет радиус до 4/5 блоков. Отмена атаки, стены, союзники, PvP, броня, щиты, криты и обычные чары учитываются. +Смена оружия/слота, выход, смерть и смена измерения отменяют незавершённый замах. +Вместо частиц используется временная vanilla item-display с анимированной текстурой дуги, в том числе огненный вариант при «Заговоре огня». +Положение оружия в руке проходит через шесть модельных кадров; геометрия попадания остаётся серверной. + +Боевые перчатки: базовый урон 3, скорость 4 атаки/с, откат 5 тиков (0,25 с), небольшая область ±28° до 2,2 блока. +Серия: левый → правый → левый → правый → левый хук → правый апперкот → правый выпад. +Урон без брони/критов/чар: **3 / 3 / 3 / 3 / 3 / 4,2 / 6**. Дальность выпада — 2,55 блока. +Промах расходует удар серии; пауза больше 24 тиков или смена оружия сбрасывают серию. +Слишком ранние клики не наносят урон, не продвигают серию и не продлевают откат. +Собственный тип урона пропускает обычную паузу между повреждениями, но не игнорирует щит, броню или отмену события урона. + +Пока перчатки выбраны, предмет из второй руки переносится в свободный слот инвентаря. Вторая рука физически пуста и получает только сетевую модель перчатки. +Нельзя использовать предмет второй руки, обменять руки клавишей F или положить туда предмет через интерфейс. +При полном инвентаре экипировка отклоняется: оба исходных предмета сохраняются обменом между руками, и игрок получает подсказку освободить слот. +Визуальные предметы не записываются в инвентарь, сохранения или выпадение; творческие пакеты с визуальными копиями отклоняются. +При снятии перчаток вторая рука снова доступна; перенесённый предмет остаётся в инвентаре. + +`config/astraweapons.json` создаётся при первом запуске. Начальные настройки твинблейда наследуются из прежнего `config/astraplus.json`, который не переписывается. +Недостающие ресурсы и определения устанавливаются в общие каталоги AstraPlus до загрузки чар/сборки пака. Существующие пользовательские файлы сохраняются. +После установки JAR нужен перезапуск сервера и принятие обновлённого ресурспака. При отключённой автоматической сборке выполните `/astraplus build`. + +Модели рук анимируются средствами ресурспака и сетевых пакетов; базовые движения рук самого ванильного персонажа сохраняются. +Авторы заимствованных моделей и звуков указаны в [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md), в JAR, ресурспаке и описании перчаток. + +Сборка: сначала `AstraPlus/gradlew build`, затем `gradlew build verificationJar` в AstraWeapons. +Проверка: `tools/verify-server.ps1` запускает отдельный тестовый мир; `tools/capture-client.ps1` проверяет модели/OGG реальным клиентом и сохраняет кадры рук. +Не устанавливайте JAR `*-verification.jar` на рабочий сервер. diff --git a/THIRD_PARTY_NOTICES.md b/THIRD_PARTY_NOTICES.md new file mode 100644 index 0000000..b922b17 --- /dev/null +++ b/THIRD_PARTY_NOTICES.md @@ -0,0 +1,15 @@ +# Third-party assets + +Gauntlet model and textures: **joshieman**, **Gallant Gauntlets 1.1.2** (Fabric, Minecraft 1.21.1). +Source supplied by the user: `gauntlets-1.1.2-1.21.1`. +Project: https://www.curseforge.com/minecraft/mc-mods/gauntlets/files/5800931 +Original geometry and iron textures are retained. Changes: resource namespace, vanilla 26.2 item presentation, and new display-transform animation frames by AstraDev. +The source metadata declares ARR. The bundled `LICENSE_gauntlets` is preserved verbatim; this attribution does not relicense the original assets. + +Gauntlet sounds: **Mojang Studios / Double Eleven / Microsoft**, **Minecraft Dungeons**. +Reference and sound filenames: https://minecraft.wiki/w/Dungeons:Gauntlets +Minecraft Wiki refused direct downloads (HTTP 403); the identical named original game wave assets were obtained from the user's local Dungeons installation. OGG data are unmodified. +`gauntlet-audio-provenance.json` lists source names, Wiki file references, and SHA-256 hashes. + +Twinblade texture/model: retained from the existing user-provided AstraPlus resource pack. Original credit information was not present in that resource. +Crescent hit texture and pose animation JSON: AstraDev, authored for AstraWeapons. diff --git a/build.gradle.kts b/build.gradle.kts new file mode 100644 index 0000000..aa8e8df --- /dev/null +++ b/build.gradle.kts @@ -0,0 +1,50 @@ +plugins { + java + id("net.neoforged.moddev") version "2.0.146" +} +group = "online.astradev" +version = "0.1.0" +repositories { mavenCentral() } +dependencies { + compileOnly(files(providers.gradleProperty("astraPlusJar").orElse("../AstraPlus/build/libs/AstraPlus-0.5.67.jar"))) + testImplementation("org.junit.jupiter:junit-jupiter:5.11.4") + testRuntimeOnly("org.junit.platform:junit-platform-launcher:1.11.4") +} +neoForge { + version = "26.2.0.79" + mods { create("astraweapons") { sourceSet(sourceSets.main.get()) } } +} +java { toolchain.languageVersion.set(JavaLanguageVersion.of(25)); withSourcesJar() } +tasks.withType().configureEach { options.encoding = "UTF-8"; options.release.set(25) } +tasks.processResources { + inputs.property("modVersion", project.version) + filesMatching("META-INF/neoforge.mods.toml") { expand("version" to project.version) } +} +tasks.test { useJUnitPlatform() } +sourceSets.test { + compileClasspath += sourceSets.main.get().compileClasspath + runtimeClasspath += sourceSets.main.get().compileClasspath +} +val verification = sourceSets.create("verification") { + compileClasspath += sourceSets.main.get().output + sourceSets.main.get().compileClasspath + runtimeClasspath += output + compileClasspath +} +tasks.register("verificationJar") { from(verification.output); archiveClassifier.set("verification") } +val clientVerification = sourceSets.create("clientVerification") { + compileClasspath += sourceSets.main.get().compileClasspath.filter { !it.name.startsWith("AstraPlus-") } + runtimeClasspath += output + compileClasspath + sourceSets.main.get().runtimeClasspath +} +neoForge { + mods { create("astraweapons_client_verify") { sourceSet(clientVerification) } } + runs { + create("weaponsCaptureClient") { + client(); sourceSet.set(clientVerification) + loadedMods.set(setOf(mods.getByName("astraweapons_client_verify"))) + gameDirectory.set(file(providers.gradleProperty("captureClientDirectory").orElse("build/capture-client").get())) + systemProperty("astraweapons.captureServer", providers.gradleProperty("captureServerDirectory").orElse("build/capture-server").get()) + systemProperty("astraweapons.capturePort", providers.gradleProperty("capturePort").orElse("26705").get()) + programArgument("--width"); programArgument("960");programArgument("--height"); programArgument("540") + programArgument("--username");programArgument("WeaponReview") + } + } +} diff --git a/docs/review/gauntlets.png b/docs/review/gauntlets.png new file mode 100644 index 0000000..9f754b4 Binary files /dev/null and b/docs/review/gauntlets.png differ diff --git a/docs/review/twinblade-slash.png b/docs/review/twinblade-slash.png new file mode 100644 index 0000000..26b5ebe Binary files /dev/null and b/docs/review/twinblade-slash.png differ diff --git a/docs/review/uppercut.png b/docs/review/uppercut.png new file mode 100644 index 0000000..cda5e7b Binary files /dev/null and b/docs/review/uppercut.png differ diff --git a/docs/twinblade.md b/docs/twinblade.md new file mode 100644 index 0000000..212ed57 --- /dev/null +++ b/docs/twinblade.md @@ -0,0 +1,83 @@ +# История твинблейда в AstraPlus до переноса + +Это архивное описание поведения версий AstraPlus 0.5.3–0.5.8. +Текущее поведение, текстурная дуга и замах описаны в [README AstraWeapons](../README.md). + +Выдать: `/astraplus give @s astraplus:netherite_twinblade`. + +Отдельный предмет на основе незеритового меча. Урон — 7 (у обычного незеритового меча 8), +скорость — 1,6 атаки/с. Прочность и обычные свойства незеритового меча наследуются. +В спокойном бою без брони, чар и критов это 11,2 против 12,8 урона/с. + +При полностью восстановленной ванильной атаке взмах поражает живые цели в переднем +полукруге: ±90° по горизонтали относительно взгляда. Проверяется досягаемость меча, +дополнительно ограниченная 3 блоками от глаз до хитбокса, и видимость цели. +Союзники, наблюдатели и игроки с запрещённым PvP исключены. +Взмах в воздух также работает; взмах при работе с блоком не вызывает атаку по области. + +Каждая цель получает отдельный полноценный удар мечом в тот же серверный тик. +Нет деления урона, отложенного второго попадания или сброса кадров неуязвимости. +Броня, щиты, чары, криты и события отмены урона работают через ванильную атаку. +Обычный вторичный sweep меча отключён только для этого предмета. +Незаряженное попадание — слабый одиночный удар с ванильным расходом заряда. +Дуга видна как тонкая полоса мелких частиц со звуком. Угол и радиус попадания не уменьшены. +Отбрасывание живых целей направлено вперёд по взмаху, включая дополнительную «Отдачу»; +ванильное сопротивление отбрасыванию сохраняется. Движимые неживые сущности (предметы, +транспорт, снаряды и обычные стойки) получают импульс вперёд без дополнительного урона. +Они не считаются противниками для бонусов зачарований. Маркерные стойки исключены. + +В 0.5.8 индикатор в иконке удалён вместе с обновлением его состояния. В слоте видна +только исходная текстура оружия. Готовность атаки по-прежнему определяется ванильным зарядом. + +## Зачарования + +Чары доступны на столе зачарований и в книгах, переносятся на твинблейд через наковальню. +На другие предметы, включая обычный незеритовый меч, не накладываются. + +| Чары | Уровни | Действие | +| --- | --- | --- | +| Размах (`astraplus:reach`) | I–II | +1/+2 блока досягаемости широкого взмаха: до 4/5 блоков. Угол 180°, полная зарядка, видимость и щиты сохраняются. Совместим с остальными чарами твинблейда. | +| Жатва (`astraplus:reaping`) | I–III | +10/20/30% урона всем целям дуги при двух и более подходящих противниках; одиночной цели бонуса нет. Третья цель процент не увеличивает. | +| Инерция (`astraplus:inertia`) | I–II | После двух и более успешных попаданий восстановление этого взмаха короче на 10/20%. Промах и одиночный удар сбрасывают ускорение; бонус не накапливается. | +| Зацеп (`astraplus:hook`) | I–II | Скорость задетых целей ниже на 15/25% в течение 10 тиков (0,5 с). Повторный удар обновляет срок, не складывая силу. Не запрещает атаки, прыжки или щит. | + +Жатва и Инерция несовместимы; Зацеп совместим с обеими. Полностью заблокированная щитом +или неуязвимая цель не открывает бонус Жатвы. Инерция и Зацеп учитывают успешные удары. +Острота, Небесная кара, Бич членистоногих, Заговор огня, Отдача, Добыча и прочие обычные +эффекты меча проходят через ванильную обработку для каждой цели. «Разящий клинок» +(`minecraft:sweeping_edge`) запрещён: для усиления собственной дуги используется Жатва. + +При запуске 0.5.3 автоматически добавляются отсутствующие файлы: + +- `astraplus/contents/astraplus/items/netherite_twinblade.json`; +- `astraplus/resources/assets/astraplus/models/item/netherite_twinblade.json`; +- `astraplus/resources/assets/astraplus/textures/item/netherite_twinblade.png`. + +В 0.5.6 стандартные масштабы GUI `[4,4,1]` и `[1,1,1]` исправляются на `[1.5,1.5,1]` +с центрированием `[1.9,1.9,0]`, чтобы сам клинок занимал большую часть слота; исходная модель сохраняется +в `astraplus/backups/twinblade-model-.json`. Остальные трансформации и определения +сохраняются. Предмет независим от остальных определений, +скриптов и модов. Текстура взята из предоставленного пака, трансформации отображения — +из `big_sword_generated.json`; всё перенесено в пространство `astraplus`, обычный меч +не меняется. Ресурсы попадают в стандартную сборку AstraPlus/AstraPacks. + +Визуальная дуга 0.5.6 содержит 57 небольших частиц вместо 19: она плотнее и заметнее, +без возвращения крупных частиц, закрывающих экран. Геометрия попаданий не меняется. + +С 0.5.7 GUI использует ту же предоставленную текстуру: UV-координаты исключают +прозрачные поля, а плоская грань с фронтальным освещением убирает объёмное затенение. +Рисунок и файл текстуры не изменяются. +В руке сохраняется предоставленная модель. Если в редакторе выбрана другая модель, +её GUI-изображение не заменяется. + +В 0.5.8 плотность эффекта увеличена до 148 частиц на взмах (вместо 57). +«Размах» расширяет только широкий удар, не увеличивая дальность работы с блоками. + +Проверки: `gradlew build verificationJar`; на изолированном сервере тестовый JAR +поддерживает `-Dastraplus.isolatedVerification=true -Dastraplus.twinbladeVerification=true`. +Успешный боевой тест пишет `twinblade-result.txt` и завершает тестовый сервер. + +Определения трёх чар доступны во вкладке «Зачарования» AstraPlusEditor 0.3.3. +Это экземпляры общей [системы пользовательских зачарований](enchantments.md), а не +встроенные условия только одного оружия. При пользовательских моделях несколько +хитбоксов одного моба объединяются в одну цель; повреждение и отбрасывание получает моб. diff --git a/docs/verification.md b/docs/verification.md new file mode 100644 index 0000000..f5ec9a8 --- /dev/null +++ b/docs/verification.md @@ -0,0 +1,20 @@ +# Проверка выпуска 0.1.0 + +Проверено 13 сентября 2026 на Minecraft 26.2 / NeoForge 26.2.0.79 вместе с AstraPlus 0.5.67. + +- JUnit: AstraPlus — 223, AstraWeapons — 7; ошибок и пропусков нет. +- Изолированный сервер: сектор твинблейда, задержка замаха, расход заряда, попадания по нескольким целям, щиты, старые чары, скрытые владельцы моделей. +- Перчатки: точный урон всех семи ударов, быстрые повторные попадания, защита от повторного пакета, малая область, сброс серии, щиты, сохранение предмета второй руки и отказ при полном инвентаре (включая две перчатки). +- Повторный запуск тестового мира прошёл: определения, чары и пакет ресурсов снова загрузились. +- Настоящий клиент без игровых модов AstraPlus/AstraWeapons загрузил 35 модельных деревьев без отсутствующих моделей/текстур; декодировал 23 исходных OGG и сохранил 21 кадр. +- На кадрах вручную проверены обе перчатки, апперкот, замах твинблейда и видимая текстурная дуга перед игроком. Для кадров длительность поз увеличена; игровая скорость задаётся боевыми обработчиками. + +Последняя серверная проверка: `build/verify-20260913-101207-71b862`. +Клиентская проверка: `build/weapons-capture-20260913-101106-8330f9`. +Полные журналы и временные миры исключены из Git. + +![Перчатки в обеих руках](review/gauntlets.png) +![Апперкот](review/uppercut.png) +![Твинблейд и текстурная дуга](review/twinblade-slash.png) + +Проверки выполнялись на отдельном сервере. Рабочий сервер не перезапускался; активация обновлённых модов и принятие нового ресурспака требуются после установки. diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..eddabd2 Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..00fba3d --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,10 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-9.7.1-bin.zip +networkTimeout=10000 +retries=0 +retryBackOffMs=500 +validateDistributionUrl=true +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionSha256Sum=acd53f1edaf02f1a8ff99879f8a34b302661a057d9b063ae9e35b552f804d20a diff --git a/gradlew b/gradlew new file mode 100644 index 0000000..249efbb --- /dev/null +++ b/gradlew @@ -0,0 +1,248 @@ +#!/bin/sh + +# +# Copyright © 2015 the original authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 +# + +############################################################################## +# +# gradlew start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh gradlew +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/3d91ce3b8caaf77ad09f381f43615b715b53f72c/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac +done + +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { + echo "$*" +} >&2 + +die () { + echo + echo "$*" + echo + exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; +esac + + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD=$JAVA_HOME/jre/sh/java + else + JAVACMD=$JAVA_HOME/bin/java + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD=java + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \ + "$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat new file mode 100644 index 0000000..a51ec4f --- /dev/null +++ b/gradlew.bat @@ -0,0 +1,82 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem +@rem SPDX-License-Identifier: Apache-2.0 +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem gradlew startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables, and ensure extensions are enabled +setlocal EnableExtensions + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +"%COMSPEC%" /c exit 1 + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +"%COMSPEC%" /c exit 1 + +:execute +@rem Setup the command line + + + +@rem Execute gradlew +@rem endlocal doesn't take effect until after the line is parsed and variables are expanded +@rem which allows us to clear the local environment before executing the java command +endlocal & "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* & call :exitWithErrorLevel + +:exitWithErrorLevel +@rem Use "%COMSPEC%" /c exit to allow operators to work properly in scripts +"%COMSPEC%" /c exit %ERRORLEVEL% diff --git a/settings.gradle.kts b/settings.gradle.kts new file mode 100644 index 0000000..589ecce --- /dev/null +++ b/settings.gradle.kts @@ -0,0 +1,2 @@ +pluginManagement { repositories { gradlePluginPortal(); maven("https://maven.neoforged.net/releases") } } +rootProject.name = "AstraWeapons" diff --git a/src/clientVerification/java/online/astradev/weapons/verification/client/WeaponsAudioCheck.java b/src/clientVerification/java/online/astradev/weapons/verification/client/WeaponsAudioCheck.java new file mode 100644 index 0000000..f6709ee --- /dev/null +++ b/src/clientVerification/java/online/astradev/weapons/verification/client/WeaponsAudioCheck.java @@ -0,0 +1,69 @@ +package online.astradev.weapons.verification.client; + +import com.google.gson.JsonArray; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.HashSet; +import java.util.concurrent.CompletableFuture; +import net.minecraft.client.Minecraft; +import net.minecraft.client.sounds.JOrbisAudioStream; +import net.minecraft.resources.Identifier; + +/** Decodes every shipped sample with the actual client codec, without blocking rendering. */ +final class WeaponsAudioCheck { + private WeaponsAudioCheck() {} + + static CompletableFuture start(Minecraft minecraft) { + var resources = minecraft.getResourceManager(); + Path report = minecraft.gameDirectory.toPath().resolve("weapons-audio-result.json"); + return CompletableFuture.supplyAsync(() -> { + try { + var sounds = resources.listResources("sounds", id -> id.getNamespace().equals("astraweapons") && id.getPath().endsWith(".ogg")); + if (sounds.isEmpty()) throw new IllegalStateException("Dungeons audio samples are absent"); + var referenced = new HashSet(); + try (var reader = resources.getResourceOrThrow(Identifier.parse("astraweapons:sounds.json")).openAsReader()) { + var catalog = JsonParser.parseReader(reader).getAsJsonObject(); + for (var entry : catalog.entrySet()) for (var sample : entry.getValue().getAsJsonObject().getAsJsonArray("sounds")) { + if (sample.isJsonObject() && sample.getAsJsonObject().has("type") + && sample.getAsJsonObject().get("type").getAsString().equals("event")) continue; + String value = sample.isJsonPrimitive() ? sample.getAsString() : sample.getAsJsonObject().get("name").getAsString(); + var name = Identifier.parse(value); + var file = Identifier.fromNamespaceAndPath(name.getNamespace(), "sounds/" + name.getPath() + ".ogg"); + if (!sounds.containsKey(file)) throw new IllegalStateException("Missing audio sample for " + entry.getKey() + ": " + file); + referenced.add(file); + } + } + var samples = new JsonArray(); + for (var entry : sounds.entrySet().stream().sorted(java.util.Map.Entry.comparingByKey()).toList()) { + try (var stream = new JOrbisAudioStream(entry.getValue().open())) { + var format = stream.getFormat(); + int channels = format.getChannels(); + if (channels != 1 && channels != 2) throw new IllegalStateException("Unsupported channels: " + entry.getKey()); + if (!Float.isFinite(format.getSampleRate()) || format.getSampleRate() <= 0) throw new IllegalStateException("Invalid sample rate: " + entry.getKey()); + long[] count = {0}; double[] energy = {0}, peak = {0}; + while (stream.readChunk(value -> { + if (!Float.isFinite(value)) throw new IllegalStateException("Non-finite audio: " + entry.getKey()); + count[0]++; energy[0] += (double)value * value; peak[0] = Math.max(peak[0], Math.abs(value)); + })) { /* Consume the complete bitstream, not just its Ogg header. */ } + if (count[0] == 0 || count[0] % channels != 0) throw new IllegalStateException("Empty or incomplete decoded audio: " + entry.getKey()); + var sample = new JsonObject(); sample.addProperty("file", entry.getKey().toString()); + sample.addProperty("channels", channels); sample.addProperty("sample_rate", format.getSampleRate()); + sample.addProperty("frames", count[0] / channels); + sample.addProperty("seconds", count[0] / (channels * (double)format.getSampleRate())); + sample.addProperty("rms", Math.sqrt(energy[0] / count[0])); sample.addProperty("peak", peak[0]); + sample.addProperty("referenced", referenced.contains(entry.getKey())); samples.add(sample); + } + } + var result = new JsonObject(); result.addProperty("status", "PASS"); + result.addProperty("codec", "Minecraft 26.2 JOrbisAudioStream"); + result.addProperty("decoded_files", samples.size()); result.addProperty("referenced_files", referenced.size()); + result.add("samples", samples); Files.writeString(report, result.toString()); + return samples.size(); + } catch (Exception failure) { + throw new java.util.concurrent.CompletionException("Dungeons audio decoding failed", failure); + } + }); + } +} diff --git a/src/clientVerification/java/online/astradev/weapons/verification/client/WeaponsCapture.java b/src/clientVerification/java/online/astradev/weapons/verification/client/WeaponsCapture.java new file mode 100644 index 0000000..e91909c --- /dev/null +++ b/src/clientVerification/java/online/astradev/weapons/verification/client/WeaponsCapture.java @@ -0,0 +1,97 @@ +package online.astradev.weapons.verification.client; + +import java.nio.file.*; +import com.google.gson.JsonParser; +import com.mojang.serialization.JsonOps; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.screens.*; +import net.minecraft.client.multiplayer.ServerData; +import net.minecraft.client.multiplayer.resolver.ServerAddress; +import net.minecraft.client.renderer.item.*; +import net.minecraft.resources.Identifier; +import net.neoforged.fml.common.Mod; +import net.neoforged.api.distmarker.Dist; +import net.neoforged.fml.ModList; +import net.neoforged.neoforge.common.NeoForge; +import net.neoforged.neoforge.client.event.ClientTickEvent; + +@Mod(value="astraweapons_client_verify",dist=Dist.CLIENT) +public final class WeaponsCapture { + private final Path server=Path.of(System.getProperty("astraweapons.captureServer")); + private boolean connecting,done; + private int age,stage,models,ticks; + private java.util.concurrent.CompletableFuture audio; + public WeaponsCapture() { NeoForge.EVENT_BUS.addListener(this::tick); } + private void tick(ClientTickEvent.Post event) { + if(done)return; + var mc=Minecraft.getInstance(); + try { + if(++ticks>6000)throw new IllegalStateException("Capture timeout"); + if(Files.exists(server.resolve("capture-failure.txt")))throw new IllegalStateException(Files.readString(server.resolve("capture-failure.txt"))); + if(!connecting) { + if(mc.gui.overlay()!=null || !mc.isGameLoadFinished())return; + if(ModList.get().isLoaded("astraplus") || ModList.get().isLoaded("astraweapons"))throw new IllegalStateException("Gameplay mods must not load on capture client"); + org.lwjgl.glfw.GLFW.glfwHideWindow(mc.getWindow().handle()); + for(var e:mc.getResourceManager().listResources("items",id->id.getPath().endsWith(".json") && + (id.getNamespace().equals("astraweapons") || id.toString().equals("astraplus:items/netherite_twinblade.json"))).entrySet()) { + try(var reader=e.getValue().openAsReader()) { ClientItem.CODEC.parse(JsonOps.INSTANCE,JsonParser.parseReader(reader)).getOrThrow(); } + String path=e.getKey().getPath(); + var id=Identifier.fromNamespaceAndPath(e.getKey().getNamespace(),path.substring(6,path.length()-5)); + inspect(mc.getModelManager().getItemModel(id),id,0); + models++; + } + if(models<35)throw new IllegalStateException("Incomplete weapons resource pack: "+models); + audio=WeaponsAudioCheck.start(mc); + var address="127.0.0.1:"+System.getProperty("astraweapons.capturePort","26705"); + ConnectScreen.startConnecting(mc.gui.screen(),mc,ServerAddress.parseString(address),new ServerData("Isolated weapons capture",address,ServerData.Type.OTHER),false,null); + connecting=true;return; + } + if(mc.gui.screen() instanceof DisconnectedScreen)throw new IllegalStateException("Disconnected during capture"); + if(mc.player==null || mc.level==null || mc.gui.overlay()!=null)return; + mc.gui.toastManager().clear(); + if(stage>6) { + if(!audio.isDone())return; + long count; + try(var files=Files.list(mc.gameDirectory.toPath().resolve("screenshots"))) {count=files.filter(f->f.getFileName().toString().startsWith("weapons-")).count();} + if(count<21)return; + finish("PASS: "+models+" client item codecs/baked models, "+audio.join()+" original audio samples, 21 hand/area screenshots");return; + } + if(!Files.exists(server.resolve("capture-stage-"+stage+".txt")))return; + ++age; + if(age==35||age==55||age==75) { + if(stage==6 && age>40) { + var displays=new com.google.gson.JsonArray(); + for(var e:mc.level.entitiesForRendering()) if(e instanceof net.minecraft.world.entity.Display.ItemDisplay d) { + var state=d.itemRenderState(); + if(state!=null) {var row=new com.google.gson.JsonObject();row.addProperty("model",String.valueOf(state.itemStack().get(net.minecraft.core.component.DataComponents.ITEM_MODEL)));row.addProperty("position",d.position().toString());row.addProperty("age",d.tickCount);displays.add(row);} + } + Files.writeString(mc.gameDirectory.toPath().resolve("slash-displays-"+age+".json"),displays.toString()); + if(displays.isEmpty())throw new IllegalStateException("No textured slash received by client"); + } + net.minecraft.client.Screenshot.grab(mc.gameDirectory,"weapons-"+stage+"-"+age+".png",mc.gameRenderer.mainRenderTarget(),1,ignored->{}); + } + if(age>=90) { Files.writeString(server.resolve("capture-ack-"+stage+".txt"),"done");stage++;age=0; } + } catch(Throwable error) { error.printStackTrace();finish("FAIL: "+error); } + } + private void finish(String result) { + done=true; + try { Files.writeString(Minecraft.getInstance().gameDirectory.toPath().resolve("weapons-client-result.txt"),result);Files.writeString(server.resolve("capture-finished.txt"),result); } + catch(Exception e){throw new RuntimeException(e);} + Minecraft.getInstance().stop(); + } + @SuppressWarnings("unchecked") + private static void inspect(ItemModel baked,Identifier id,int depth) throws Exception { + if(depth>6 || baked instanceof MissingItemModel)throw new IllegalStateException("Missing/nested model "+id); + if(baked instanceof SelectItemModel) { + var field=SelectItemModel.class.getDeclaredField("models");field.setAccessible(true); + var selector=(SelectItemModel.ModelSelector)field.get(baked); + for(var context:net.minecraft.world.item.ItemDisplayContext.values()) inspect(selector.get(context,null),id,depth+1); + } else if(baked instanceof CuboidItemModelWrapper) { + var field=CuboidItemModelWrapper.class.getDeclaredField("quads");field.setAccessible(true); + var quads=(net.minecraft.client.resources.model.geometry.QuadCollection)field.get(baked); + if(quads.getAll().isEmpty())throw new IllegalStateException("Empty model "+id); + for(var quad:quads.getAll()) if(quad.materialInfo().sprite().contents().name().equals( + net.minecraft.client.renderer.texture.MissingTextureAtlasSprite.getLocation()))throw new IllegalStateException("Missing baked texture "+id); + } + } +} diff --git a/src/clientVerification/resources/META-INF/neoforge.mods.toml b/src/clientVerification/resources/META-INF/neoforge.mods.toml new file mode 100644 index 0000000..692975b --- /dev/null +++ b/src/clientVerification/resources/META-INF/neoforge.mods.toml @@ -0,0 +1,7 @@ +modLoader="javafml" +loaderVersion="[11,)" +license="All Rights Reserved" +[[mods]] +modId="astraweapons_client_verify" +version="1.0.0" +displayName="Isolated vanilla weapons renderer" diff --git a/src/main/java/online/astradev/weapons/AstraWeapons.java b/src/main/java/online/astradev/weapons/AstraWeapons.java new file mode 100644 index 0000000..4a26ff3 --- /dev/null +++ b/src/main/java/online/astradev/weapons/AstraWeapons.java @@ -0,0 +1,51 @@ +package online.astradev.weapons; + +import net.neoforged.api.distmarker.Dist; +import net.neoforged.fml.common.Mod; +import net.neoforged.fml.loading.FMLPaths; +import net.neoforged.bus.api.EventPriority; +import net.neoforged.neoforge.common.NeoForge; +import net.neoforged.neoforge.event.server.ServerStoppingEvent; +import net.neoforged.neoforge.event.server.ServerAboutToStartEvent; +import net.neoforged.neoforge.event.tick.ServerTickEvent; +import online.astradev.weapons.behavior.*; +import online.astradev.weapons.resource.*; +import online.astradev.plus.api.*; + +@Mod(value="astraweapons", dist=Dist.DEDICATED_SERVER) +public final class AstraWeapons { + private static WeaponsConfig settings = new WeaponsConfig(); + public static WeaponsConfig settings() { return settings; } + public AstraWeapons() { + // Constructor precedes datapack discovery: enchantments must exist before registry loading. + try { WeaponsResources.install(FMLPaths.GAMEDIR.get()); } + catch (java.io.IOException e) { throw new IllegalStateException("Cannot install AstraWeapons content", e); } + ItemPresentation.register(TwinbladeCombat.ID, TwinbladeResources::itemModel); + ItemPresentation.register(GauntletCombat.ID, model -> WeaponsResources.gauntletModel(model)); + online.astradev.weapons.content.enchantment.TwinbladeEnchantments.registerRules(); + MeleeAttackHooks.register(new MeleeAttackHooks.Handler() { + public boolean active(net.minecraft.world.entity.player.Player p) { return TwinbladeCombat.striking(p) || GauntletCombat.striking(p); } + public boolean allowed(net.minecraft.world.entity.player.Player p, net.minecraft.world.entity.Entity t) { + return TwinbladeCombat.striking(p) ? TwinbladeCombat.attackAllowed(p,t) : GauntletCombat.attackAllowed(p,t); + } + public boolean hurt(net.minecraft.world.entity.player.Player p, net.minecraft.world.entity.Entity t, net.minecraft.world.damagesource.DamageSource s, float d) { + return TwinbladeCombat.striking(p) ? TwinbladeCombat.hurt(p,t,s,d) : GauntletCombat.hurt(p,t,s,d); + } + }); + NeoForge.EVENT_BUS.register(new TwinbladeCombat()); + NeoForge.EVENT_BUS.register(new GauntletCombat()); + NeoForge.EVENT_BUS.addListener(EventPriority.HIGHEST, this::start); + NeoForge.EVENT_BUS.addListener(this::tick); + NeoForge.EVENT_BUS.addListener(this::stop); + } + private void start(ServerAboutToStartEvent event) { + try { settings = WeaponsConfig.load(FMLPaths.GAMEDIR.get()); } + catch (java.io.IOException e) { throw new IllegalStateException("Cannot load AstraWeapons settings", e); } + } + private void tick(ServerTickEvent.Post event) { + TwinbladeCombat.tick(); GauntletCombat.tick(event.getServer()); WeaponPresentation.tick(event.getServer()); SlashDisplay.updateAll(); + } + private void stop(ServerStoppingEvent event) { + TwinbladeCombat.close(); GauntletCombat.close(); WeaponPresentation.close(event.getServer()); SlashDisplay.close(); + } +} diff --git a/src/main/java/online/astradev/weapons/WeaponsConfig.java b/src/main/java/online/astradev/weapons/WeaponsConfig.java new file mode 100644 index 0000000..106ffc2 --- /dev/null +++ b/src/main/java/online/astradev/weapons/WeaponsConfig.java @@ -0,0 +1,39 @@ +package online.astradev.weapons; + +import java.nio.file.Files; +import java.nio.file.Path; +import online.astradev.plus.config.PlusConfig; +import online.astradev.plus.io.PlusFiles; + +public final class WeaponsConfig { + public boolean twinblade = true, twinbladeSounds = true; + public double twinbladeReach = 3; + public int gauntletCooldownTicks = 5, comboResetTicks = 24; + public double gauntletReach = 2.2; + public static WeaponsConfig load(Path root) throws java.io.IOException { + Path path = root.resolve("config/astraweapons.json"); + if (!Files.exists(path)) { + var defaults = new WeaponsConfig(); + Path legacy = root.resolve("config/astraplus.json"); + if (Files.exists(legacy)) { + var json = PlusFiles.readJson(legacy, 1024 * 1024); + if (json.has("gameplay")) { + var g = json.getAsJsonObject("gameplay"); + if (g.has("twinblade")) defaults.twinblade = g.get("twinblade").getAsBoolean(); + if (g.has("twinbladeSounds")) defaults.twinbladeSounds = g.get("twinbladeSounds").getAsBoolean(); + if (g.has("twinbladeReach")) defaults.twinbladeReach = g.get("twinbladeReach").getAsDouble(); + } + } + defaults.validate(); + PlusFiles.write(path, PlusConfig.JSON.toJson(defaults).getBytes(java.nio.charset.StandardCharsets.UTF_8)); + } + var value = PlusConfig.JSON.fromJson(PlusFiles.readJson(path, 65536), WeaponsConfig.class); + value.validate(); return value; + } + private void validate() { + if (!Double.isFinite(twinbladeReach) || twinbladeReach <= 0 || twinbladeReach > 64 + || !Double.isFinite(gauntletReach) || gauntletReach <= 0 || gauntletReach > 3 + || gauntletCooldownTicks < 4 || gauntletCooldownTicks > 20 || comboResetTicks < gauntletCooldownTicks || comboResetTicks > 100) + throw new IllegalArgumentException("Invalid AstraWeapons combat settings"); + } +} diff --git a/src/main/java/online/astradev/weapons/behavior/Combo.java b/src/main/java/online/astradev/weapons/behavior/Combo.java new file mode 100644 index 0000000..4fc2073 --- /dev/null +++ b/src/main/java/online/astradev/weapons/behavior/Combo.java @@ -0,0 +1,13 @@ +package online.astradev.weapons.behavior; + +/** Seven deliberate strikes. A miss consumes a step; a pause or weapon change starts over. */ +public final class Combo { + private Combo() {} + public static double multiplier(int step) { return step == 5 ? 1.4 : step == 6 ? 2.0 : 1.0; } + public static boolean left(int step) { return step == 0 || step == 2 || step == 4; } + public static String pose(int step) { return step == 4 ? "hook" : step == 5 ? "uppercut" : step == 6 ? "lunge" : "jab"; } + public static boolean within(double fx, double fz, double dx, double dz) { + double distance = Math.hypot(dx, dz); + return distance < 0.25 || (fx * dx + fz * dz) / distance >= Math.cos(Math.toRadians(28)); + } +} diff --git a/src/main/java/online/astradev/weapons/behavior/GauntletCombat.java b/src/main/java/online/astradev/weapons/behavior/GauntletCombat.java new file mode 100644 index 0000000..ce36b94 --- /dev/null +++ b/src/main/java/online/astradev/weapons/behavior/GauntletCombat.java @@ -0,0 +1,133 @@ +package online.astradev.weapons.behavior; + +import java.util.*; +import net.minecraft.core.registries.Registries; +import net.minecraft.resources.*; +import net.minecraft.server.MinecraftServer; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.damagesource.*; +import net.minecraft.world.entity.*; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.*; +import net.minecraft.world.phys.Vec3; +import net.neoforged.bus.api.*; +import net.neoforged.neoforge.common.NeoForge; +import net.neoforged.neoforge.event.entity.player.*; +import online.astradev.plus.content.PlusContent; +import online.astradev.plus.content.enchantment.CustomEnchantments; +import online.astradev.plus.model.ModelCarrier; +import online.astradev.weapons.AstraWeapons; +import online.astradev.weapons.resource.WeaponPresentation; + +public final class GauntletCombat { + public static final String ID = "astraweapons:gauntlets"; + private static final ResourceKey DAMAGE = ResourceKey.create(Registries.DAMAGE_TYPE, Identifier.parse("astraweapons:gauntlet")); + private record Chain(ItemStack weapon, long last, int next, int slot, Object dimension) {} + private static final Map CHAINS = new HashMap<>(); + private static final Map BATCHES = new HashMap<>(); + private static final class Batch { + final Set accepted = new HashSet<>(); + final int step; + CustomEnchantments.Attack enchantments; + boolean hit; + Batch(int step) { this.step = step; } + } + public static boolean holds(Player p) { return p.getMainHandItem().is(Items.IRON_SWORD) && ID.equals(PlusContent.id(p.getMainHandItem())); } + public static boolean striking(Player p) { return BATCHES.containsKey(p.getUUID()); } + @SubscribeEvent(priority=EventPriority.LOWEST) + public void attack(AttackEntityEvent e) { + if (!e.isCanceled() && e.getEntity() instanceof ServerPlayer p && holds(p) && !striking(p)) { + e.setCanceled(true); strike(p, e.getTarget()); + } + } + @SubscribeEvent(priority=EventPriority.LOWEST) + public void sweep(SweepAttackEvent e) { if (holds(e.getEntity())) { e.setSweeping(false); e.setCanceled(true); } } + @SubscribeEvent(priority=EventPriority.HIGHEST) + public void useItem(PlayerInteractEvent.RightClickItem e) { + if (holds(e.getEntity()) && e.getHand() == InteractionHand.OFF_HAND) e.setCanceled(true); + } + @SubscribeEvent(priority=EventPriority.HIGHEST) + public void useBlock(PlayerInteractEvent.RightClickBlock e) { + if (holds(e.getEntity()) && e.getHand() == InteractionHand.OFF_HAND) e.setCanceled(true); + } + @SubscribeEvent(priority=EventPriority.HIGHEST) + public void useEntity(PlayerInteractEvent.EntityInteract e) { + if (holds(e.getEntity()) && e.getHand() == InteractionHand.OFF_HAND) e.setCanceled(true); + } + public static void strike(ServerPlayer p) { strike(p, null); } + private static void strike(ServerPlayer p, Entity primary) { + if (!holds(p) || striking(p) || p.isSpectator() || !p.isAlive() || !WeaponPresentation.reserveOffhand(p)) return; + var config = AstraWeapons.settings(); + long now = p.level().getGameTime(); + var chain = CHAINS.get(p.getUUID()); + if (chain != null && now - chain.last < config.gauntletCooldownTicks) return; + if (p.getAttackStrengthScale(0) < .99f) return; + var weapon = p.getMainHandItem(); + int step = chain != null && chain.weapon == weapon && now - chain.last <= config.comboResetTicks + && chain.slot == p.getInventory().getSelectedSlot() && chain.dimension == p.level() ? chain.next : 0; + CHAINS.put(p.getUUID(), new Chain(weapon,now,(step+1)%7,p.getInventory().getSelectedSlot(),p.level())); + var batch = new Batch(step); + double yaw = Math.toRadians(p.getYRot()); + Vec3 forward = new Vec3(-Math.sin(yaw),0,Math.cos(yaw)); + double reach = Math.min(config.gauntletReach + (step == 6 ? .35 : 0), p.entityInteractionRange()); + var targets = p.level().getEntities(p,p.getBoundingBox().inflate(reach), candidate -> { + if (ModelCarrier.isHidden(candidate)) return false; + Entity owner = ModelCarrier.owner(candidate), target = owner == null ? candidate : owner; + return target instanceof LivingEntity && target != p && target.isAlive() && !target.isSpectator() + && !(target instanceof net.minecraft.world.entity.decoration.ArmorStand) + && !p.isAlliedTo(target) && (!(target instanceof Player other) || p.canHarmPlayer(other)) + && candidate.getBoundingBox().distanceToSqr(p.getEyePosition()) <= reach*reach + && Combo.within(forward.x,forward.z,candidate.getX()-p.getX(),candidate.getZ()-p.getZ()) + && p.hasLineOfSight(candidate); + }).stream().map(e -> { Entity owner = ModelCarrier.owner(e); return owner == null ? e : owner; }).distinct().toList(); + BATCHES.put(p.getUUID(),batch); + boolean sprinting = p.isSprinting(); + try { + for (var target : targets) { + var e = new AttackEntityEvent(p,target); + if (target != primary) NeoForge.EVENT_BUS.post(e); + if (!e.isCanceled()) batch.accepted.add(target.getId()); + } + batch.enchantments = CustomEnchantments.beginAttack(p,weapon,false,batch.accepted.size()); + for (var target : targets) { + if (!batch.accepted.contains(target.getId())) continue; + if (weapon.isEmpty() || p.getMainHandItem() != weapon) break; + p.setSprinting(sprinting); p.attack(target); + } + } finally { + BATCHES.remove(p.getUUID()); p.onAttack(); + if (batch.enchantments != null) batch.enchantments.finish(); + } + WeaponPresentation.animate(p,Combo.pose(step),Combo.left(step),config.gauntletCooldownTicks); + sound(p,step == 6 ? "swing_kick" : step == 5 ? "swing_medium" : "swing_short",.7f); + if (batch.hit) sound(p,step == 6 ? "hit_kick" : step == 5 ? "hit_medium" : "hit_light",.8f); + p.swing(Combo.left(step) ? InteractionHand.OFF_HAND : InteractionHand.MAIN_HAND,true); + } + public static boolean attackAllowed(Player p,Entity t) { return BATCHES.get(p.getUUID()).accepted.contains(t.getId()); } + public static boolean hurt(Player p,Entity t,DamageSource source,float damage) { + Batch batch = BATCHES.get(p.getUUID()); + var ownSource = new DamageSource(p.registryAccess().lookupOrThrow(Registries.DAMAGE_TYPE).getOrThrow(DAMAGE),p); + float amount = (float)(damage * Combo.multiplier(batch.step)); + if (batch.enchantments != null) amount = batch.enchantments.modifyDamage(t,amount); + boolean hit = t.hurtOrSimulate(ownSource,amount); + if (hit && t instanceof LivingEntity living) { + batch.hit = true; + if (batch.enchantments != null) batch.enchantments.hit(living); + } + return hit; + } + private static void sound(ServerPlayer p,String name,float volume) { + p.level().playSound(null,p.getX(),p.getY(),p.getZ(),net.minecraft.sounds.SoundEvent.createVariableRangeEvent( + Identifier.parse("astraweapons:gauntlets."+name)),p.getSoundSource(),volume,1f); + } + public static void tick(MinecraftServer server) { + CHAINS.entrySet().removeIf(e -> { + var p = server.getPlayerList().getPlayer(e.getKey()); + return p == null || !holds(p) || !p.isAlive() || p.level() != e.getValue().dimension + || p.getMainHandItem() != e.getValue().weapon || p.getInventory().getSelectedSlot() != e.getValue().slot + || p.level().getGameTime()-e.getValue().last > AstraWeapons.settings().comboResetTicks; + }); + } + public static void close() { CHAINS.clear(); BATCHES.clear(); } +} diff --git a/src/main/java/online/astradev/weapons/behavior/TwinbladeCombat.java b/src/main/java/online/astradev/weapons/behavior/TwinbladeCombat.java new file mode 100644 index 0000000..0d40650 --- /dev/null +++ b/src/main/java/online/astradev/weapons/behavior/TwinbladeCombat.java @@ -0,0 +1,211 @@ +package online.astradev.weapons.behavior; + +import java.util.HashSet; +import java.util.Set; +import java.util.UUID; + +import net.minecraft.core.registries.Registries; +import net.minecraft.world.item.enchantment.EnchantmentHelper; +import net.minecraft.world.item.enchantment.Enchantments; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.damagesource.DamageSource; +import net.minecraft.core.component.DataComponents; +import net.minecraft.world.entity.item.ItemEntity; +import net.minecraft.world.entity.projectile.Projectile; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.decoration.ArmorStand; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.phys.Vec3; +import net.neoforged.bus.api.EventPriority; +import net.neoforged.bus.api.SubscribeEvent; +import net.neoforged.neoforge.event.entity.player.AttackEntityEvent; +import net.neoforged.neoforge.event.entity.player.SweepAttackEvent; +import online.astradev.plus.AstraPlus; +import online.astradev.plus.content.enchantment.CustomEnchantments; +import net.neoforged.neoforge.common.NeoForge; +import net.neoforged.neoforge.event.entity.living.LivingKnockBackEvent; +import online.astradev.plus.model.ModelCarrier; + +/** One synchronous batch of ordinary sword hits, retaining shields and per-target damage events. */ +public final class TwinbladeCombat { + public static final String ID = "astraplus:netherite_twinblade"; + private record Pending(ServerPlayer player, net.minecraft.world.item.ItemStack weapon, int slot, Object level, long due, Entity primary) {} + private static final java.util.Map PENDING = new java.util.HashMap<>(); + private static final Set STRIKING = new HashSet<>(); + private static final java.util.Map BATCHES = new java.util.HashMap<>(); + private static final class Batch { + final Vec3 direction; + final Set accepted = new HashSet<>(); + CustomEnchantments.Attack enchantments; + int opponents; + Entity current; + Batch(ServerPlayer player, Vec3 direction) { + this.direction = direction; + } + } + + public static boolean striking(Player player) { return STRIKING.contains(player.getUUID()); } + + public static boolean holdsTwinblade(Player player) { + if (!online.astradev.weapons.AstraWeapons.settings().twinblade) return false; + var content = AstraPlus.content(); + var entry = content == null ? null : content.item(player.getMainHandItem()); + return entry != null && ID.equals(entry.definition().id); + } + + @SubscribeEvent(priority = EventPriority.LOWEST) + public void attack(AttackEntityEvent event) { + if (event.isCanceled() || !(event.getEntity() instanceof ServerPlayer player) + || player.isSpectator() || striking(player) || !holdsTwinblade(player)) { return; } + if (PENDING.containsKey(player.getUUID())) { event.setCanceled(true); return; } + // Uncharged clicks retain the normal sword's weak single-target attack. + if (player.getAttackStrengthScale(0) < 1) { return; } + event.setCanceled(true); + strike(player, event.getTarget()); + } + + @SubscribeEvent(priority = EventPriority.LOWEST) + public void sweep(SweepAttackEvent event) { + if (holdsTwinblade(event.getEntity())) { + event.setSweeping(false); + event.setCanceled(true); + } + } + + public static void strike(ServerPlayer player) { + strike(player, null); + } + + private static void strike(ServerPlayer player, Entity primary) { + if (striking(player) || PENDING.containsKey(player.getUUID()) || player.isSpectator() || !holdsTwinblade(player) + || player.getAttackStrengthScale(0) < 1) return; + PENDING.put(player.getUUID(),new Pending(player,player.getMainHandItem(),player.getInventory().getSelectedSlot(),player.level(),player.level().getGameTime()+2,primary)); + online.astradev.weapons.resource.WeaponPresentation.animate(player,"twinblade",false,7); + } + public static void tick() { + for (Pending pending : java.util.List.copyOf(PENDING.values())) { + ServerPlayer p = pending.player; + if (!p.isAlive() || p.isRemoved() || p.level()!=pending.level || p.getMainHandItem()!=pending.weapon + || p.getInventory().getSelectedSlot()!=pending.slot || !holdsTwinblade(p)) { + PENDING.remove(p.getUUID()); continue; + } + if (p.level().getGameTime()>=pending.due) { + PENDING.remove(p.getUUID()); perform(p,pending.primary); + } + } + } + public static void close() { PENDING.clear();STRIKING.clear();BATCHES.clear(); } + private static void perform(ServerPlayer player, Entity primary) { + if (player.getAttackStrengthScale(0)<1 || player.isSpectator()) return; + var level = player.level(); + var weapon = player.getMainHandItem(); + // Capture before attacking: the last hit can break the weapon. + boolean fiery = EnchantmentHelper.getItemEnchantmentLevel( + level.registryAccess().lookupOrThrow(Registries.ENCHANTMENT).getOrThrow(Enchantments.FIRE_ASPECT), weapon) > 0; + Vec3 origin = player.position(); + double yaw = Math.toRadians(player.getYRot()); + Vec3 forward = new Vec3(-Math.sin(yaw), 0, Math.cos(yaw)); + double reachBonus = CustomEnchantments.sweepReachBonus(weapon); + double reach = Math.min(online.astradev.weapons.AstraWeapons.settings().twinbladeReach, player.entityInteractionRange()) + reachBonus; + var targets = level.getEntities(player, player.getBoundingBox().inflate(reach), candidate -> { + if (ModelCarrier.isHidden(candidate)) return false; + Entity owner = ModelCarrier.owner(candidate), target = owner == null ? candidate : owner; + return target != player && target.isAlive() && movable(target) && !target.isSpectator() + && !player.isAlliedTo(target) && !(target instanceof ArmorStand stand && stand.isMarker()) + && (!(target instanceof Player other) || player.canHarmPlayer(other)) + && inFront(forward.x, forward.z, candidate.getX() - origin.x, candidate.getZ() - origin.z) + && candidate.getBoundingBox().distanceToSqr(player.getEyePosition()) <= reach * reach + && player.isWithinAttackRange(weapon, candidate.getBoundingBox(), reachBonus) && player.hasLineOfSight(candidate); + }).stream().map(candidate -> { Entity owner = ModelCarrier.owner(candidate); return owner == null ? candidate : owner; }).distinct().toList(); + STRIKING.add(player.getUUID()); + Batch batch = new Batch(player, forward); + BATCHES.put(player.getUUID(), batch); + boolean sprinting = player.isSprinting(); + try { + // Resolve ordinary attack vetoes once before choosing the multi-target bonus. + for (Entity target : targets) { + var attack = new AttackEntityEvent(player, target); + if (target != primary) { NeoForge.EVENT_BUS.post(attack); } + if (!attack.isCanceled()) { + batch.accepted.add(target.getId()); + if (target instanceof LivingEntity living && !(living instanceof ArmorStand) + && canDamage(player, living)) { batch.opponents++; } + } + } + batch.enchantments = CustomEnchantments.beginAttack(player, weapon, true, batch.opponents); + // No delayed callbacks, invulnerability resets, raw damage or vanilla secondary sweep. + for (Entity target : targets) { + if (!batch.accepted.contains(target.getId())) { continue; } + if (weapon.isEmpty() || player.getMainHandItem() != weapon) { break; } + batch.current = target; + if (!(target instanceof LivingEntity) || target instanceof ArmorStand) { + target.push(forward.scale(0.4).add(0, 0.1, 0)); + target.hurtMarked = true; + continue; + } + // Vanilla ends sprinting on a hit; do not turn subsequent airborne hits into criticals. + player.setSprinting(sprinting); + player.attack(target); + } + } finally { + STRIKING.remove(player.getUUID()); + BATCHES.remove(player.getUUID()); + player.onAttack(); + if (batch.enchantments != null) { batch.enchantments.finish(); } + } + if (online.astradev.weapons.AstraWeapons.settings().twinbladeSounds) level.playSound(null, player.getX(), player.getY(), player.getZ(), + SoundEvents.PLAYER_ATTACK_SWEEP, player.getSoundSource(), 1, 0.9f); + online.astradev.weapons.resource.SlashDisplay.spawn(player,reach,fiery); + } + + static boolean inFront(double forwardX, double forwardZ, double dx, double dz) { + return forwardX * dx + forwardZ * dz >= -1.0e-9; + } + + private static boolean movable(Entity entity) { + return entity instanceof LivingEntity || entity.isPushable() || entity instanceof ItemEntity || entity instanceof Projectile; + } + + private static boolean canDamage(ServerPlayer player, LivingEntity target) { + var source = player.getMainHandItem().getDamageSource(player); + if (target.isInvulnerableTo(player.level(), source) || target.invulnerableTime > 10) { return false; } + var blocking = target.getItemBlockingWith(); + if (blocking == null) { return true; } + var blocks = blocking.get(DataComponents.BLOCKS_ATTACKS); + if (blocks == null) { return true; } + Vec3 view = Vec3.directionFromRotation(0, target.getYHeadRot()); + Vec3 toPlayer = player.position().subtract(target.position()).multiply(1, 0, 1).normalize(); + double angle = Math.acos(Math.clamp(toPlayer.dot(view), -1, 1)); + return blocks.resolveBlockedDamage(source, 1, angle) < 1; + } + + public static boolean attackAllowed(Player player, Entity target) { + Batch batch = BATCHES.get(player.getUUID()); + return batch == null ? net.neoforged.neoforge.common.CommonHooks.onPlayerAttackTarget(player, target) + : batch.accepted.contains(target.getId()); + } + + public static boolean hurt(Player player, Entity target, DamageSource source, float damage) { + Batch batch = BATCHES.get(player.getUUID()); + boolean current = batch != null && batch.current == target; + CustomEnchantments.Attack enchants = current ? batch.enchantments + : player instanceof ServerPlayer serverPlayer ? CustomEnchantments.beginAttack(serverPlayer, player.getMainHandItem(), false, 1) : null; + if (enchants != null) { damage = enchants.modifyDamage(target, damage); } + boolean hit = target.hurtOrSimulate(source, damage); + if (enchants != null && hit && target instanceof LivingEntity living) { enchants.hit(living); } + if (!current && enchants != null) { CustomEnchantments.completeAfterChargeReset(enchants); } + return hit; + } + + @SubscribeEvent(priority = EventPriority.LOWEST) + public void knockback(LivingKnockBackEvent event) { + if (event.isCanceled()) { return; } + for (Batch batch : BATCHES.values()) { + if (batch.current == event.getEntity()) { + event.setRatioX(-batch.direction.x); event.setRatioZ(-batch.direction.z); return; + } + } + } +} diff --git a/src/main/java/online/astradev/weapons/content/TwinbladeContent.java b/src/main/java/online/astradev/weapons/content/TwinbladeContent.java new file mode 100644 index 0000000..0899443 --- /dev/null +++ b/src/main/java/online/astradev/weapons/content/TwinbladeContent.java @@ -0,0 +1,50 @@ +package online.astradev.weapons.content; + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.List; +import online.astradev.plus.io.PlusFiles; + +/** Adds the standalone weapon to existing installations without replacing user content. */ +public final class TwinbladeContent { + private TwinbladeContent() {} + + public static void install(Path root) throws IOException { + for (String relative : List.of( + "contents/astraplus/items/netherite_twinblade.json", + "resources/assets/astraplus/models/item/netherite_twinblade.json", + "resources/assets/astraplus/textures/item/netherite_twinblade.png")) { + Path target = root.resolve("astraplus").resolve(relative); + PlusFiles.rejectLinks(target); + if (Files.exists(target)) { + if (relative.equals("resources/assets/astraplus/models/item/netherite_twinblade.json")) { fixInventoryScale(root, target); } + continue; + } + try (var input = TwinbladeContent.class.getResourceAsStream("/defaults/" + relative)) { + if (input == null) { throw new IOException("Missing twinblade resource: " + relative); } + Files.createDirectories(target.getParent()); + Files.copy(input, target); + } + } + } + + private static void fixInventoryScale(Path root, Path target) throws IOException { + var model = PlusFiles.readJson(target, 1024 * 1024); + if (!model.has("display") || !model.getAsJsonObject("display").has("gui")) { return; } + var gui = model.getAsJsonObject("display").getAsJsonObject("gui"); + if (!gui.has("scale")) { return; } + var scale = gui.getAsJsonArray("scale"); + if (scale.size() != 3 || scale.get(2).getAsDouble() != 1) { return; } + double previous = scale.get(0).getAsDouble(); + if ((previous != 1 && previous != 4) || scale.get(1).getAsDouble() != previous) { return; } + for (String field : List.of("translation", "rotation")) { + if (gui.has(field) && gui.getAsJsonArray(field).asList().stream().anyMatch(value -> value.getAsDouble() != 0)) { return; } + } + Path backup = root.resolve("astraplus/backups/twinblade-model-" + java.util.UUID.randomUUID() + ".json"); + PlusFiles.rejectLinks(backup); Files.createDirectories(backup.getParent()); Files.copy(target, backup); + gui.add("scale", com.google.gson.JsonParser.parseString("[1.5,1.5,1]")); + gui.add("translation", com.google.gson.JsonParser.parseString("[1.9,1.9,0]")); + PlusFiles.write(target, online.astradev.plus.config.PlusConfig.JSON.toJson(model).getBytes(java.nio.charset.StandardCharsets.UTF_8)); + } +} diff --git a/src/main/java/online/astradev/weapons/content/enchantment/TwinbladeEnchantments.java b/src/main/java/online/astradev/weapons/content/enchantment/TwinbladeEnchantments.java new file mode 100644 index 0000000..6615a0f --- /dev/null +++ b/src/main/java/online/astradev/weapons/content/enchantment/TwinbladeEnchantments.java @@ -0,0 +1,30 @@ +package online.astradev.weapons.content.enchantment; +import online.astradev.plus.content.enchantment.EnchantmentRules; + +import net.minecraft.core.registries.Registries; +import net.minecraft.resources.Identifier; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; +import net.minecraft.world.item.enchantment.EnchantmentHelper; +import online.astradev.weapons.behavior.TwinbladeCombat; +import online.astradev.plus.content.PlusContent; + +public final class TwinbladeEnchantments { + private TwinbladeEnchantments() {} + + public static void registerRules() { + EnchantmentRules.restrict("minecraft:sweeping_edge", stack -> !isTwinblade(stack)); + } + + public static boolean isTwinblade(ItemStack stack) { + return stack.is(Items.NETHERITE_SWORD) && TwinbladeCombat.ID.equals(PlusContent.id(stack)); + } + + public static int level(ServerPlayer player, String name) { + if (!isTwinblade(player.getMainHandItem())) { return 0; } + var enchantment = player.registryAccess().lookupOrThrow(Registries.ENCHANTMENT).get(Identifier.fromNamespaceAndPath("astraplus", name)); + return enchantment.map(value -> Math.min(value.value().getMaxLevel(), EnchantmentHelper.getItemEnchantmentLevel(value, player.getMainHandItem()))).orElse(0); + } + +} diff --git a/src/main/java/online/astradev/weapons/mixin/DisplayAccess.java b/src/main/java/online/astradev/weapons/mixin/DisplayAccess.java new file mode 100644 index 0000000..de1a948 --- /dev/null +++ b/src/main/java/online/astradev/weapons/mixin/DisplayAccess.java @@ -0,0 +1,13 @@ +package online.astradev.weapons.mixin; + +import net.minecraft.world.entity.Display; +import net.minecraft.util.Brightness; +import com.mojang.math.Transformation; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.gen.Invoker; + +@Mixin(Display.class) +public interface DisplayAccess { + @Invoker("setTransformation") void astraweapons$transform(Transformation value); + @Invoker("setBrightnessOverride") void astraweapons$brightness(Brightness value); +} diff --git a/src/main/java/online/astradev/weapons/mixin/GauntletInventoryMixin.java b/src/main/java/online/astradev/weapons/mixin/GauntletInventoryMixin.java new file mode 100644 index 0000000..e4e3222 --- /dev/null +++ b/src/main/java/online/astradev/weapons/mixin/GauntletInventoryMixin.java @@ -0,0 +1,35 @@ +package online.astradev.weapons.mixin; + +import net.minecraft.server.network.ServerGamePacketListenerImpl; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.network.protocol.game.*; +import net.minecraft.world.inventory.ContainerInput; +import org.spongepowered.asm.mixin.*; +import org.spongepowered.asm.mixin.injection.*; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import online.astradev.weapons.behavior.GauntletCombat; +import online.astradev.weapons.resource.WeaponPresentation; + +@Mixin(ServerGamePacketListenerImpl.class) +public abstract class GauntletInventoryMixin { + @Shadow public ServerPlayer player; + // Each injection occurs AFTER vanilla's packet thread validation. + @Inject(method="handleContainerClick",at=@At(value="INVOKE",target="Lnet/minecraft/server/level/ServerPlayer;resetLastActionTime()V"),cancellable=true) + private void astraweapons$slot(ServerboundContainerClickPacket p,CallbackInfo ci) { + if(GauntletCombat.holds(player) && (p.containerId()==0 && p.slotNum()==45 || p.containerInput()==ContainerInput.SWAP && p.buttonNum()==40)) { + player.containerMenu.sendAllDataToRemote(); WeaponPresentation.sync(player); ci.cancel(); + } + } + @Inject(method="handlePlayerAction",at=@At(value="INVOKE",target="Lnet/minecraft/server/level/ServerPlayer;resetLastActionTime()V"),cancellable=true) + private void astraweapons$swap(ServerboundPlayerActionPacket p,CallbackInfo ci) { + if(GauntletCombat.holds(player) && p.getAction()==ServerboundPlayerActionPacket.Action.SWAP_ITEM_WITH_OFFHAND) { + WeaponPresentation.sync(player); ci.cancel(); + } + } + @Inject(method="handleSetCreativeModeSlot",at=@At(value="INVOKE",target="Lnet/minecraft/server/level/ServerPlayer;hasInfiniteMaterials()Z"),cancellable=true) + private void astraweapons$creative(ServerboundSetCreativeModeSlotPacket p,CallbackInfo ci) { + if(WeaponPresentation.ghost(p.itemStack()) || GauntletCombat.holds(player) && p.slotNum()==45) { + player.inventoryMenu.sendAllDataToRemote(); WeaponPresentation.sync(player); ci.cancel(); + } + } +} diff --git a/src/main/java/online/astradev/weapons/mixin/TwinbladeSwingMixin.java b/src/main/java/online/astradev/weapons/mixin/TwinbladeSwingMixin.java new file mode 100644 index 0000000..8dfb476 --- /dev/null +++ b/src/main/java/online/astradev/weapons/mixin/TwinbladeSwingMixin.java @@ -0,0 +1,31 @@ +package online.astradev.weapons.mixin; + +import net.minecraft.network.protocol.game.ServerboundSwingPacket; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.server.network.ServerGamePacketListenerImpl; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.phys.HitResult; +import online.astradev.weapons.behavior.TwinbladeCombat; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +/** Vanilla clients send no server-side left-click-air event; the swing packet is the available hook. */ +@Mixin(ServerGamePacketListenerImpl.class) +public abstract class TwinbladeSwingMixin { + @Shadow public ServerPlayer player; + + @Inject(method = "handleAnimate", at = @At(value = "INVOKE", + target = "Lnet/minecraft/server/level/ServerPlayer;swing(Lnet/minecraft/world/InteractionHand;)V")) + private void astraplus$airSwing(ServerboundSwingPacket packet, CallbackInfo ci) { + if (packet.getHand() != InteractionHand.MAIN_HAND || player.isSpectator() + || (!TwinbladeCombat.holdsTwinblade(player) && !online.astradev.weapons.behavior.GauntletCombat.holds(player))) { return; } + // Mining/interacting with a block is not an air attack. Entity-hit packets already consume charge. + if (player.pick(player.blockInteractionRange(), 1, false).getType() == HitResult.Type.BLOCK) { return; } + // Run after packet thread validation, but before vanilla swing resets the attack charge. + if (online.astradev.weapons.behavior.GauntletCombat.holds(player)) online.astradev.weapons.behavior.GauntletCombat.strike(player); + else TwinbladeCombat.strike(player); + } +} diff --git a/src/main/java/online/astradev/weapons/mixin/WeaponPacketsMixin.java b/src/main/java/online/astradev/weapons/mixin/WeaponPacketsMixin.java new file mode 100644 index 0000000..e74bc54 --- /dev/null +++ b/src/main/java/online/astradev/weapons/mixin/WeaponPacketsMixin.java @@ -0,0 +1,18 @@ +package online.astradev.weapons.mixin; + +import net.minecraft.server.network.ServerCommonPacketListenerImpl; +import net.minecraft.server.network.ServerGamePacketListenerImpl; +import net.minecraft.network.protocol.Packet; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.*; +import online.astradev.weapons.resource.WeaponPresentation; + +@Mixin(ServerCommonPacketListenerImpl.class) +public abstract class WeaponPacketsMixin { + @ModifyVariable(method="send(Lnet/minecraft/network/protocol/Packet;Lio/netty/channel/ChannelFutureListener;)V",at=@At("HEAD"),argsOnly=true) + private Packet astraweapons$hands(Packet packet) { + if ((Object)this instanceof ServerGamePacketListenerImpl listener && listener.player.level().getServer().isSameThread()) + return WeaponPresentation.project(listener.player,packet); + return packet; + } +} diff --git a/src/main/java/online/astradev/weapons/mixin/WeaponSwingChargeMixin.java b/src/main/java/online/astradev/weapons/mixin/WeaponSwingChargeMixin.java new file mode 100644 index 0000000..a85a3b9 --- /dev/null +++ b/src/main/java/online/astradev/weapons/mixin/WeaponSwingChargeMixin.java @@ -0,0 +1,17 @@ +package online.astradev.weapons.mixin; + +import net.minecraft.server.level.ServerPlayer; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Redirect; +import online.astradev.weapons.behavior.GauntletCombat; +import online.astradev.weapons.behavior.TwinbladeCombat; + +/** Charge belongs to accepted custom strikes, not rejected/duplicate animation packets. */ +@Mixin(ServerPlayer.class) +public abstract class WeaponSwingChargeMixin { + @Redirect(method="swing(Lnet/minecraft/world/InteractionHand;)V",at=@At(value="INVOKE",target="Lnet/minecraft/server/level/ServerPlayer;resetAttackStrengthTicker()V")) + private void astraweapons$charge(ServerPlayer player) { + if(!GauntletCombat.holds(player) && !TwinbladeCombat.holdsTwinblade(player)) player.resetAttackStrengthTicker(); + } +} diff --git a/src/main/java/online/astradev/weapons/resource/SlashDisplay.java b/src/main/java/online/astradev/weapons/resource/SlashDisplay.java new file mode 100644 index 0000000..b78a43e --- /dev/null +++ b/src/main/java/online/astradev/weapons/resource/SlashDisplay.java @@ -0,0 +1,46 @@ +package online.astradev.weapons.resource; + +import java.util.*; +import net.minecraft.core.component.DataComponents; +import net.minecraft.resources.Identifier; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.entity.*; +import net.minecraft.world.item.*; +import net.minecraft.world.level.storage.ValueOutput; +import com.mojang.math.Transformation; +import org.joml.*; + +/** A two-sided textured crescent in the actual hit sector; never a particle cloud. */ +public final class SlashDisplay extends Display.ItemDisplay { + private static final List ACTIVE = new ArrayList<>(); + private final long expires; + private final ServerPlayer owner; + private SlashDisplay(ServerPlayer p,double reach,boolean fiery) { + super(EntityTypes.ITEM_DISPLAY,p.level()); owner=p; expires=p.level().getGameTime()+5; + setNoGravity(true);setInvulnerable(true); + setPos(p.getX(),p.getY()+1,p.getZ()); + // Vanilla ItemDisplayRenderer adds a 180-degree item rotation; compensate so +Z is the hit sector. + setYRot(p.getYRot()+180); + var item=new ItemStack(Items.PAPER); + item.set(DataComponents.ITEM_MODEL,Identifier.parse("astraweapons:slash"+(fiery?"_fire":""))); + getSlot(0).set(item); + ((online.astradev.weapons.mixin.DisplayAccess)(Object)this).astraweapons$transform(new Transformation(new Vector3f(),new Quaternionf(),new Vector3f((float)reach*2),new Quaternionf())); + ((online.astradev.weapons.mixin.DisplayAccess)(Object)this).astraweapons$brightness(new net.minecraft.util.Brightness(15,15)); + addTag("astraweapons:slash"); + } + public static void spawn(ServerPlayer player,double reach,boolean fiery) { + var display=new SlashDisplay(player,reach,fiery); + if(player.level().addFreshEntity(display)) ACTIVE.add(display); + } + public static void updateAll() { + ACTIVE.removeIf(display -> { + if(display.isRemoved() || !display.owner.isAlive() || display.owner.level()!=display.level() || display.level().getGameTime()>=display.expires) { + display.discard();return true; + } + return false; + }); + } + public static void close() { ACTIVE.forEach(Entity::discard);ACTIVE.clear(); } + @Override public boolean shouldBeSaved() { return false; } + @Override public boolean saveAsPassenger(ValueOutput output) { return false; } +} diff --git a/src/main/java/online/astradev/weapons/resource/TwinbladeResources.java b/src/main/java/online/astradev/weapons/resource/TwinbladeResources.java new file mode 100644 index 0000000..0ca77f4 --- /dev/null +++ b/src/main/java/online/astradev/weapons/resource/TwinbladeResources.java @@ -0,0 +1,38 @@ +package online.astradev.weapons.resource; + +import java.nio.charset.StandardCharsets; +import java.util.Map; +import java.util.TreeMap; +import com.google.gson.JsonArray; +import com.google.gson.JsonObject; + +/** GUI presentation of the supplied twinblade texture, without status overlays. */ +public final class TwinbladeResources { + private TwinbladeResources() {} + + public static Map generate() { + Map files = new TreeMap<>(); + // Reuse the supplied texture, cropping only its transparent border via UV coordinates. + files.put("assets/astraplus/models/internal/twinblade_gui.json", bytes(""" + {"parent":"astraplus:item/netherite_twinblade","gui_light":"front", + "display":{"gui":{"rotation":[0,0,0],"translation":[0,0,0],"scale":[1,1,1]}}, + "elements":[{"from":[1,1.736842,8],"to":[15,14.263158,8],"shade":false, + "faces":{"south":{"uv":[2,5,11.5,13.5],"texture":"#layer0"}}}]} + """)); + return files; + } + + public static JsonObject itemModel(String modelId) { + JsonObject base = model(modelId.equals("astraplus:item/netherite_twinblade") ? "astraplus:internal/twinblade_gui" : modelId); + JsonObject select = new JsonObject(); select.addProperty("type", "minecraft:select"); + select.addProperty("property", "minecraft:display_context"); select.add("fallback", model(modelId)); + JsonObject gui = new JsonObject(); gui.addProperty("when", "gui"); gui.add("model", base); + JsonArray cases = new JsonArray(); cases.add(gui); select.add("cases", cases); + return select; + } + + private static JsonObject model(String id) { + JsonObject value = new JsonObject(); value.addProperty("type", "minecraft:model"); value.addProperty("model", id); return value; + } + private static byte[] bytes(String text) { return text.getBytes(StandardCharsets.UTF_8); } +} diff --git a/src/main/java/online/astradev/weapons/resource/WeaponPresentation.java b/src/main/java/online/astradev/weapons/resource/WeaponPresentation.java new file mode 100644 index 0000000..f354543 --- /dev/null +++ b/src/main/java/online/astradev/weapons/resource/WeaponPresentation.java @@ -0,0 +1,138 @@ +package online.astradev.weapons.resource; + +import java.util.*; +import com.mojang.datafixers.util.Pair; +import net.minecraft.core.component.DataComponents; +import net.minecraft.network.protocol.Packet; +import net.minecraft.network.protocol.game.*; +import net.minecraft.resources.Identifier; +import net.minecraft.server.MinecraftServer; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.entity.EquipmentSlot; +import net.minecraft.world.item.*; +import online.astradev.weapons.behavior.GauntletCombat; +import online.astradev.weapons.behavior.TwinbladeCombat; + +/** Packet-only hand models: no ghost stack is ever inserted, saved, consumed or dropped. */ +public final class WeaponPresentation { + private record Animation(ItemStack weapon, String pose, boolean left, long start, int ticks, Object level) {} + private static final Map ANIMATIONS = new HashMap<>(); + private static final Set WEARING = new HashSet<>(); + private static final Identifier GHOST = Identifier.parse("astraweapons:gauntlet_offhand"); + private WeaponPresentation() {} + public static boolean reserveOffhand(ServerPlayer p) { + if (!GauntletCombat.holds(p)) return false; + ItemStack off = p.getOffhandItem(); + if (off.isEmpty()) return true; + int free = p.getInventory().getFreeSlot(); + if (free < 0) { + // Preserve both stacks even with a full inventory. The player must make room first. + if (GauntletCombat.ID.equals(online.astradev.plus.content.PlusContent.id(off))) { + if (p.tickCount % 20 == 0) p.sendSystemMessage(net.minecraft.network.chat.Component.literal("Для боевых перчаток освободите один слот инвентаря."),true); + return false; + } + p.setItemInHand(InteractionHand.OFF_HAND,p.getMainHandItem()); + p.setItemInHand(InteractionHand.MAIN_HAND,off); + p.sendSystemMessage(net.minecraft.network.chat.Component.literal("Для боевых перчаток освободите один слот инвентаря."),true); + sync(p); return false; + } + p.stopUsingItem(); + p.getInventory().setItem(free,off); + p.setItemInHand(InteractionHand.OFF_HAND,ItemStack.EMPTY); + p.inventoryMenu.broadcastChanges(); + return true; + } + public static void animate(ServerPlayer p,String pose,boolean left,int ticks) { + ANIMATIONS.put(p.getUUID(),new Animation(p.getMainHandItem(),pose,left,p.level().getGameTime(),ticks,p.level())); sync(p); + } + private static ItemStack visual(ServerPlayer p,ItemStack original,boolean offhand) { + boolean gloves = GauntletCombat.holds(p) && p.getOffhandItem().isEmpty() && !p.isSpectator() && p.isAlive(); + var animation = ANIMATIONS.get(p.getUUID()); + boolean animating = animation != null && animation.weapon == p.getMainHandItem() && animation.level == p.level(); + if (offhand) { + if (!gloves) return original; + var ghost = new ItemStack(Items.PAPER); + ghost.set(DataComponents.ITEM_NAME,net.minecraft.network.chat.Component.literal("Левая боевая перчатка")); + ghost.set(DataComponents.ITEM_MODEL,animating && animation.left ? frame(p,animation) : GHOST); + return ghost; + } + if (animating && (!gloves || !animation.left)) { + var copy = original.copy(); copy.set(DataComponents.ITEM_MODEL,frame(p,animation)); return copy; + } + return original; + } + private static Identifier frame(ServerPlayer p,Animation animation) { + int elapsed = (int)(p.level().getGameTime()-animation.start); + int frame = Math.clamp(elapsed*6/Math.max(1,animation.ticks),0,5); + return Identifier.parse("astraweapons:animation/"+animation.pose+"_"+frame); + } + /** Used only by the outgoing packet mixin on the server thread. */ + public static Packet project(ServerPlayer viewer,Packet packet) { + if (packet instanceof ClientboundBundlePacket bundle) { + var packets = new ArrayList>(); + for (var nested : bundle.subPackets()) { + @SuppressWarnings("unchecked") var projected = (Packet)project(viewer,nested); + packets.add(projected); + } + return new ClientboundBundlePacket(packets); + } + if (packet instanceof ClientboundSetEquipmentPacket e && viewer.level().getEntity(e.getEntity()) instanceof ServerPlayer owner) { + var slots = new ArrayList>(); + boolean hasOffhand=false; + for (var slot:e.getSlots()) { + if(slot.getFirst()==EquipmentSlot.OFFHAND) hasOffhand=true; + var stack = slot.getFirst()==EquipmentSlot.MAINHAND ? visual(owner,slot.getSecond(),false) + : slot.getFirst()==EquipmentSlot.OFFHAND ? visual(owner,slot.getSecond(),true) : slot.getSecond(); + slots.add(Pair.of(slot.getFirst(),stack)); + } + if (!hasOffhand && GauntletCombat.holds(owner)) slots.add(Pair.of(EquipmentSlot.OFFHAND,visual(owner,owner.getOffhandItem(),true))); + return new ClientboundSetEquipmentPacket(e.getEntity(),slots); + } + if (packet instanceof ClientboundSetPlayerInventoryPacket p) { + if (p.slot()==40) return new ClientboundSetPlayerInventoryPacket(40,visual(viewer,p.contents(),true)); + if (p.slot()==viewer.getInventory().getSelectedSlot()) return new ClientboundSetPlayerInventoryPacket(p.slot(),visual(viewer,p.contents(),false)); + } + if (packet instanceof ClientboundContainerSetSlotPacket p && p.getContainerId()==0) { + if (p.getSlot()==45 || p.getSlot()==36+viewer.getInventory().getSelectedSlot()) + return new ClientboundContainerSetSlotPacket(0,p.getStateId(),p.getSlot(),visual(viewer,p.getItem(),p.getSlot()==45)); + } + if (packet instanceof ClientboundContainerSetContentPacket p && p.containerId()==0 && p.items().size()>45) { + var items = new ArrayList<>(p.items()); + items.set(45,visual(viewer,items.get(45),true)); + int main = 36+viewer.getInventory().getSelectedSlot(); items.set(main,visual(viewer,items.get(main),false)); + return new ClientboundContainerSetContentPacket(p.containerId(),p.stateId(),items,p.carriedItem()); + } + return packet; + } + public static boolean ghost(ItemStack stack) { + var id=stack.get(DataComponents.ITEM_MODEL); + return id!=null && (id.equals(GHOST) || id.getNamespace().equals("astraweapons") && id.getPath().startsWith("animation/")); + } + public static void sync(ServerPlayer p) { + if (p.connection==null) return; + p.connection.send(new ClientboundSetPlayerInventoryPacket(40,p.getOffhandItem())); + p.connection.send(new ClientboundSetPlayerInventoryPacket(p.getInventory().getSelectedSlot(),p.getMainHandItem())); + p.level().getChunkSource().sendToTrackingPlayers(p,new ClientboundSetEquipmentPacket(p.getId(),List.of( + Pair.of(EquipmentSlot.MAINHAND,p.getMainHandItem()),Pair.of(EquipmentSlot.OFFHAND,p.getOffhandItem())))); + } + public static void tick(MinecraftServer server) { + var online=new HashSet(); + for(var p:server.getPlayerList().getPlayers()) { + online.add(p.getUUID()); + boolean wearing=GauntletCombat.holds(p) && p.isAlive() && !p.isSpectator() && reserveOffhand(p); + boolean changed=wearing ? WEARING.add(p.getUUID()) : WEARING.remove(p.getUUID()); + var animation=ANIMATIONS.get(p.getUUID()); + if(animation!=null) { + if(!p.isAlive() || p.level()!=animation.level || p.getMainHandItem()!=animation.weapon || p.level().getGameTime()-animation.start>=animation.ticks) + ANIMATIONS.remove(p.getUUID()); + sync(p); + } else if(changed) sync(p); + } + WEARING.retainAll(online); ANIMATIONS.keySet().retainAll(online); + } + public static void close(MinecraftServer server) { + ANIMATIONS.clear(); WEARING.clear(); + // Projection naturally ends when the connection closes; no stored items need restoration. + } +} diff --git a/src/main/java/online/astradev/weapons/resource/WeaponsResources.java b/src/main/java/online/astradev/weapons/resource/WeaponsResources.java new file mode 100644 index 0000000..2e01e70 --- /dev/null +++ b/src/main/java/online/astradev/weapons/resource/WeaponsResources.java @@ -0,0 +1,40 @@ +package online.astradev.weapons.resource; + +import java.io.*; +import java.nio.file.*; +import java.nio.charset.StandardCharsets; +import com.google.gson.*; +import online.astradev.plus.io.PlusFiles; + +/** Seeds missing addon files before registry/pack loading; preserves user-edited definitions and assets. */ +public final class WeaponsResources { + private WeaponsResources() {} + public static void install(Path root) throws IOException { + online.astradev.weapons.content.TwinbladeContent.install(root); + try(var input=WeaponsResources.class.getResourceAsStream("/weapons-index.txt")) { + if(input==null) throw new IOException("Missing weapons resource index"); + for(String relative:new String(input.readAllBytes(),StandardCharsets.UTF_8).lines().filter(s->!s.isBlank()).toList()) { + Path target=root.resolve("astraplus").resolve(relative).normalize(); + if(!target.startsWith(root.resolve("astraplus").normalize())) throw new IOException("Invalid resource path"); + PlusFiles.rejectLinks(target); + if(Files.exists(target)) continue; + try(var resource=WeaponsResources.class.getResourceAsStream("/defaults/"+relative)) { + if(resource==null) throw new IOException("Missing weapons resource: "+relative); + Files.createDirectories(target.getParent());Files.copy(resource,target); + } + } + } + for(var resource:TwinbladeResources.generate().entrySet()) { + Path target=root.resolve("astraplus/resources").resolve(resource.getKey()); + PlusFiles.rejectLinks(target); + if(!Files.exists(target)) PlusFiles.write(target,resource.getValue()); + } + } + public static JsonObject gauntletModel(String model) { + return JsonParser.parseString(""" + {"type":"minecraft:select","property":"minecraft:display_context", + "cases":[{"when":["gui","ground","fixed"],"model":{"type":"minecraft:model","model":"astraweapons:item/iron_gauntlet_2d"}}], + "fallback":{"type":"minecraft:model","model":"PLACEHOLDER"}} + """.replace("PLACEHOLDER",model)).getAsJsonObject(); + } +} diff --git a/src/main/resources/LICENSE_gauntlets b/src/main/resources/LICENSE_gauntlets new file mode 100644 index 0000000..c657cab --- /dev/null +++ b/src/main/resources/LICENSE_gauntlets @@ -0,0 +1,407 @@ +Attribution-NonCommercial 4.0 International + +======================================================================= + +Creative Commons Corporation ("Creative Commons") is not a law firm and +does not provide legal services or legal advice. Distribution of +Creative Commons public licenses does not create a lawyer-client or +other relationship. Creative Commons makes its licenses and related +information available on an "as-is" basis. Creative Commons gives no +warranties regarding its licenses, any material licensed under their +terms and conditions, or any related information. Creative Commons +disclaims all liability for damages resulting from their use to the +fullest extent possible. + +Using Creative Commons Public Licenses + +Creative Commons public licenses provide a standard set of terms and +conditions that creators and other rights holders may use to share +original works of authorship and other material subject to copyright +and certain other rights specified in the public license below. The +following considerations are for informational purposes only, are not +exhaustive, and do not form part of our licenses. + + Considerations for licensors: Our public licenses are + intended for use by those authorized to give the public + permission to use material in ways otherwise restricted by + copyright and certain other rights. Our licenses are + irrevocable. Licensors should read and understand the terms + and conditions of the license they choose before applying it. + Licensors should also secure all rights necessary before + applying our licenses so that the public can reuse the + material as expected. Licensors should clearly mark any + material not subject to the license. This includes other CC- + licensed material, or material used under an exception or + limitation to copyright. More considerations for licensors: + wiki.creativecommons.org/Considerations_for_licensors + + Considerations for the public: By using one of our public + licenses, a licensor grants the public permission to use the + licensed material under specified terms and conditions. If + the licensor's permission is not necessary for any reason--for + example, because of any applicable exception or limitation to + copyright--then that use is not regulated by the license. Our + licenses grant only permissions under copyright and certain + other rights that a licensor has authority to grant. Use of + the licensed material may still be restricted for other + reasons, including because others have copyright or other + rights in the material. A licensor may make special requests, + such as asking that all changes be marked or described. + Although not required by our licenses, you are encouraged to + respect those requests where reasonable. More considerations + for the public: + wiki.creativecommons.org/Considerations_for_licensees + +======================================================================= + +Creative Commons Attribution-NonCommercial 4.0 International Public +License + +By exercising the Licensed Rights (defined below), You accept and agree +to be bound by the terms and conditions of this Creative Commons +Attribution-NonCommercial 4.0 International Public License ("Public +License"). To the extent this Public License may be interpreted as a +contract, You are granted the Licensed Rights in consideration of Your +acceptance of these terms and conditions, and the Licensor grants You +such rights in consideration of benefits the Licensor receives from +making the Licensed Material available under these terms and +conditions. + + +Section 1 -- Definitions. + + a. Adapted Material means material subject to Copyright and Similar + Rights that is derived from or based upon the Licensed Material + and in which the Licensed Material is translated, altered, + arranged, transformed, or otherwise modified in a manner requiring + permission under the Copyright and Similar Rights held by the + Licensor. For purposes of this Public License, where the Licensed + Material is a musical work, performance, or sound recording, + Adapted Material is always produced where the Licensed Material is + synched in timed relation with a moving image. + + b. Adapter's License means the license You apply to Your Copyright + and Similar Rights in Your contributions to Adapted Material in + accordance with the terms and conditions of this Public License. + + c. Copyright and Similar Rights means copyright and/or similar rights + closely related to copyright including, without limitation, + performance, broadcast, sound recording, and Sui Generis Database + Rights, without regard to how the rights are labeled or + categorized. For purposes of this Public License, the rights + specified in Section 2(b)(1)-(2) are not Copyright and Similar + Rights. + d. Effective Technological Measures means those measures that, in the + absence of proper authority, may not be circumvented under laws + fulfilling obligations under Article 11 of the WIPO Copyright + Treaty adopted on December 20, 1996, and/or similar international + agreements. + + e. Exceptions and Limitations means fair use, fair dealing, and/or + any other exception or limitation to Copyright and Similar Rights + that applies to Your use of the Licensed Material. + + f. Licensed Material means the artistic or literary work, database, + or other material to which the Licensor applied this Public + License. + + g. Licensed Rights means the rights granted to You subject to the + terms and conditions of this Public License, which are limited to + all Copyright and Similar Rights that apply to Your use of the + Licensed Material and that the Licensor has authority to license. + + h. Licensor means the individual(s) or entity(ies) granting rights + under this Public License. + + i. NonCommercial means not primarily intended for or directed towards + commercial advantage or monetary compensation. For purposes of + this Public License, the exchange of the Licensed Material for + other material subject to Copyright and Similar Rights by digital + file-sharing or similar means is NonCommercial provided there is + no payment of monetary compensation in connection with the + exchange. + + j. Share means to provide material to the public by any means or + process that requires permission under the Licensed Rights, such + as reproduction, public display, public performance, distribution, + dissemination, communication, or importation, and to make material + available to the public including in ways that members of the + public may access the material from a place and at a time + individually chosen by them. + + k. Sui Generis Database Rights means rights other than copyright + resulting from Directive 96/9/EC of the European Parliament and of + the Council of 11 March 1996 on the legal protection of databases, + as amended and/or succeeded, as well as other essentially + equivalent rights anywhere in the world. + + l. You means the individual or entity exercising the Licensed Rights + under this Public License. Your has a corresponding meaning. + + +Section 2 -- Scope. + + a. License grant. + + 1. Subject to the terms and conditions of this Public License, + the Licensor hereby grants You a worldwide, royalty-free, + non-sublicensable, non-exclusive, irrevocable license to + exercise the Licensed Rights in the Licensed Material to: + + a. reproduce and Share the Licensed Material, in whole or + in part, for NonCommercial purposes only; and + + b. produce, reproduce, and Share Adapted Material for + NonCommercial purposes only. + + 2. Exceptions and Limitations. For the avoidance of doubt, where + Exceptions and Limitations apply to Your use, this Public + License does not apply, and You do not need to comply with + its terms and conditions. + + 3. Term. The term of this Public License is specified in Section + 6(a). + + 4. Media and formats; technical modifications allowed. The + Licensor authorizes You to exercise the Licensed Rights in + all media and formats whether now known or hereafter created, + and to make technical modifications necessary to do so. The + Licensor waives and/or agrees not to assert any right or + authority to forbid You from making technical modifications + necessary to exercise the Licensed Rights, including + technical modifications necessary to circumvent Effective + Technological Measures. For purposes of this Public License, + simply making modifications authorized by this Section 2(a) + (4) never produces Adapted Material. + + 5. Downstream recipients. + + a. Offer from the Licensor -- Licensed Material. Every + recipient of the Licensed Material automatically + receives an offer from the Licensor to exercise the + Licensed Rights under the terms and conditions of this + Public License. + + b. No downstream restrictions. You may not offer or impose + any additional or different terms or conditions on, or + apply any Effective Technological Measures to, the + Licensed Material if doing so restricts exercise of the + Licensed Rights by any recipient of the Licensed + Material. + + 6. No endorsement. Nothing in this Public License constitutes or + may be construed as permission to assert or imply that You + are, or that Your use of the Licensed Material is, connected + with, or sponsored, endorsed, or granted official status by, + the Licensor or others designated to receive attribution as + provided in Section 3(a)(1)(A)(i). + + b. Other rights. + + 1. Moral rights, such as the right of integrity, are not + licensed under this Public License, nor are publicity, + privacy, and/or other similar personality rights; however, to + the extent possible, the Licensor waives and/or agrees not to + assert any such rights held by the Licensor to the limited + extent necessary to allow You to exercise the Licensed + Rights, but not otherwise. + + 2. Patent and trademark rights are not licensed under this + Public License. + + 3. To the extent possible, the Licensor waives any right to + collect royalties from You for the exercise of the Licensed + Rights, whether directly or through a collecting society + under any voluntary or waivable statutory or compulsory + licensing scheme. In all other cases the Licensor expressly + reserves any right to collect such royalties, including when + the Licensed Material is used other than for NonCommercial + purposes. + + +Section 3 -- License Conditions. + +Your exercise of the Licensed Rights is expressly made subject to the +following conditions. + + a. Attribution. + + 1. If You Share the Licensed Material (including in modified + form), You must: + + a. retain the following if it is supplied by the Licensor + with the Licensed Material: + + i. identification of the creator(s) of the Licensed + Material and any others designated to receive + attribution, in any reasonable manner requested by + the Licensor (including by pseudonym if + designated); + + ii. a copyright notice; + + iii. a notice that refers to this Public License; + + iv. a notice that refers to the disclaimer of + warranties; + + v. a URI or hyperlink to the Licensed Material to the + extent reasonably practicable; + + b. indicate if You modified the Licensed Material and + retain an indication of any previous modifications; and + + c. indicate the Licensed Material is licensed under this + Public License, and include the text of, or the URI or + hyperlink to, this Public License. + + 2. You may satisfy the conditions in Section 3(a)(1) in any + reasonable manner based on the medium, means, and context in + which You Share the Licensed Material. For example, it may be + reasonable to satisfy the conditions by providing a URI or + hyperlink to a resource that includes the required + information. + + 3. If requested by the Licensor, You must remove any of the + information required by Section 3(a)(1)(A) to the extent + reasonably practicable. + + 4. If You Share Adapted Material You produce, the Adapter's + License You apply must not prevent recipients of the Adapted + Material from complying with this Public License. + + +Section 4 -- Sui Generis Database Rights. + +Where the Licensed Rights include Sui Generis Database Rights that +apply to Your use of the Licensed Material: + + a. for the avoidance of doubt, Section 2(a)(1) grants You the right + to extract, reuse, reproduce, and Share all or a substantial + portion of the contents of the database for NonCommercial purposes + only; + + b. if You include all or a substantial portion of the database + contents in a database in which You have Sui Generis Database + Rights, then the database in which You have Sui Generis Database + Rights (but not its individual contents) is Adapted Material; and + + c. You must comply with the conditions in Section 3(a) if You Share + all or a substantial portion of the contents of the database. + +For the avoidance of doubt, this Section 4 supplements and does not +replace Your obligations under this Public License where the Licensed +Rights include other Copyright and Similar Rights. + + +Section 5 -- Disclaimer of Warranties and Limitation of Liability. + + a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE + EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS + AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF + ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS, + IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION, + WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR + PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS, + ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT + KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT + ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU. + + b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE + TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION, + NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT, + INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES, + COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR + USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN + ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR + DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR + IN PART, THIS LIMITATION MAY NOT APPLY TO YOU. + + c. The disclaimer of warranties and limitation of liability provided + above shall be interpreted in a manner that, to the extent + possible, most closely approximates an absolute disclaimer and + waiver of all liability. + + +Section 6 -- Term and Termination. + + a. This Public License applies for the term of the Copyright and + Similar Rights licensed here. However, if You fail to comply with + this Public License, then Your rights under this Public License + terminate automatically. + + b. Where Your right to use the Licensed Material has terminated under + Section 6(a), it reinstates: + + 1. automatically as of the date the violation is cured, provided + it is cured within 30 days of Your discovery of the + violation; or + + 2. upon express reinstatement by the Licensor. + + For the avoidance of doubt, this Section 6(b) does not affect any + right the Licensor may have to seek remedies for Your violations + of this Public License. + + c. For the avoidance of doubt, the Licensor may also offer the + Licensed Material under separate terms or conditions or stop + distributing the Licensed Material at any time; however, doing so + will not terminate this Public License. + + d. Sections 1, 5, 6, 7, and 8 survive termination of this Public + License. + + +Section 7 -- Other Terms and Conditions. + + a. The Licensor shall not be bound by any additional or different + terms or conditions communicated by You unless expressly agreed. + + b. Any arrangements, understandings, or agreements regarding the + Licensed Material not stated herein are separate from and + independent of the terms and conditions of this Public License. + + +Section 8 -- Interpretation. + + a. For the avoidance of doubt, this Public License does not, and + shall not be interpreted to, reduce, limit, restrict, or impose + conditions on any use of the Licensed Material that could lawfully + be made without permission under this Public License. + + b. To the extent possible, if any provision of this Public License is + deemed unenforceable, it shall be automatically reformed to the + minimum extent necessary to make it enforceable. If the provision + cannot be reformed, it shall be severed from this Public License + without affecting the enforceability of the remaining terms and + conditions. + + c. No term or condition of this Public License will be waived and no + failure to comply consented to unless expressly agreed to by the + Licensor. + + d. Nothing in this Public License constitutes or may be interpreted + as a limitation upon, or waiver of, any privileges and immunities + that apply to the Licensor or You, including from the legal + processes of any jurisdiction or authority. + +======================================================================= + +Creative Commons is not a party to its public +licenses. Notwithstanding, Creative Commons may elect to apply one of +its public licenses to material it publishes and in those instances +will be considered the “Licensor.” The text of the Creative Commons +public licenses is dedicated to the public domain under the CC0 Public +Domain Dedication. Except for the limited purpose of indicating that +material is shared under a Creative Commons public license or as +otherwise permitted by the Creative Commons policies published at +creativecommons.org/policies, Creative Commons does not authorize the +use of the trademark "Creative Commons" or any other trademark or logo +of Creative Commons without its prior written consent including, +without limitation, in connection with any unauthorized modifications +to any of its public licenses or any other arrangements, +understandings, or agreements concerning use of licensed material. For +the avoidance of doubt, this paragraph does not form part of the +public licenses. + +Creative Commons may be contacted at creativecommons.org. diff --git a/src/main/resources/META-INF/neoforge.mods.toml b/src/main/resources/META-INF/neoforge.mods.toml new file mode 100644 index 0000000..50287e0 --- /dev/null +++ b/src/main/resources/META-INF/neoforge.mods.toml @@ -0,0 +1,26 @@ +modLoader="javafml" +loaderVersion="[11,)" +license="All Rights Reserved; third-party assets: see THIRD_PARTY_NOTICES.md" +[[mods]] +modId="astraweapons" +version="${version}" +displayName="AstraWeapons" +description='''Server-side twinblade and combo gauntlets for vanilla clients with AstraPlus resources.''' +[[mixins]] +config="astraweapons.mixins.json" +[[dependencies.astraweapons]] +modId="neoforge" +type="required" +versionRange="[26.2.0.79,26.3)" +side="SERVER" +[[dependencies.astraweapons]] +modId="minecraft" +type="required" +versionRange="[26.2,26.3)" +side="SERVER" +[[dependencies.astraweapons]] +modId="astraplus" +type="required" +versionRange="[0.5.67,0.6)" +ordering="AFTER" +side="SERVER" diff --git a/src/main/resources/THIRD_PARTY_NOTICES.md b/src/main/resources/THIRD_PARTY_NOTICES.md new file mode 100644 index 0000000..b922b17 --- /dev/null +++ b/src/main/resources/THIRD_PARTY_NOTICES.md @@ -0,0 +1,15 @@ +# Third-party assets + +Gauntlet model and textures: **joshieman**, **Gallant Gauntlets 1.1.2** (Fabric, Minecraft 1.21.1). +Source supplied by the user: `gauntlets-1.1.2-1.21.1`. +Project: https://www.curseforge.com/minecraft/mc-mods/gauntlets/files/5800931 +Original geometry and iron textures are retained. Changes: resource namespace, vanilla 26.2 item presentation, and new display-transform animation frames by AstraDev. +The source metadata declares ARR. The bundled `LICENSE_gauntlets` is preserved verbatim; this attribution does not relicense the original assets. + +Gauntlet sounds: **Mojang Studios / Double Eleven / Microsoft**, **Minecraft Dungeons**. +Reference and sound filenames: https://minecraft.wiki/w/Dungeons:Gauntlets +Minecraft Wiki refused direct downloads (HTTP 403); the identical named original game wave assets were obtained from the user's local Dungeons installation. OGG data are unmodified. +`gauntlet-audio-provenance.json` lists source names, Wiki file references, and SHA-256 hashes. + +Twinblade texture/model: retained from the existing user-provided AstraPlus resource pack. Original credit information was not present in that resource. +Crescent hit texture and pose animation JSON: AstraDev, authored for AstraWeapons. diff --git a/src/main/resources/astraweapons.mixins.json b/src/main/resources/astraweapons.mixins.json new file mode 100644 index 0000000..d304684 --- /dev/null +++ b/src/main/resources/astraweapons.mixins.json @@ -0,0 +1,7 @@ +{ + "required": true, + "package": "online.astradev.weapons.mixin", + "compatibilityLevel": "JAVA_25", + "mixins": ["DisplayAccess", "TwinbladeSwingMixin", "WeaponSwingChargeMixin", "WeaponPacketsMixin", "GauntletInventoryMixin"], + "injectors": {"defaultRequire": 1} +} diff --git a/src/main/resources/data/astraweapons/damage_type/gauntlet.json b/src/main/resources/data/astraweapons/damage_type/gauntlet.json new file mode 100644 index 0000000..82d2309 --- /dev/null +++ b/src/main/resources/data/astraweapons/damage_type/gauntlet.json @@ -0,0 +1 @@ +{"message_id":"player","scaling":"never","exhaustion":0.1} diff --git a/src/main/resources/data/minecraft/tags/damage_type/bypasses_cooldown.json b/src/main/resources/data/minecraft/tags/damage_type/bypasses_cooldown.json new file mode 100644 index 0000000..b7984f9 --- /dev/null +++ b/src/main/resources/data/minecraft/tags/damage_type/bypasses_cooldown.json @@ -0,0 +1 @@ +{"replace":false,"values":["astraweapons:gauntlet"]} diff --git a/src/main/resources/defaults/contents/astraplus/enchantments/hook.json b/src/main/resources/defaults/contents/astraplus/enchantments/hook.json new file mode 100644 index 0000000..597b1fb --- /dev/null +++ b/src/main/resources/defaults/contents/astraplus/enchantments/hook.json @@ -0,0 +1,6 @@ +{ + "id": "astraplus:hook", "name": "Зацеп", "maxLevel": 2, + "items": ["astraplus:netherite_twinblade"], "slots": ["mainhand"], "conflicts": [], + "acquisition": {"table": true, "loot": true, "trading": true}, + "effects": [{"type": "slow", "values": [0.15, 0.25], "duration": 10}] +} diff --git a/src/main/resources/defaults/contents/astraplus/enchantments/inertia.json b/src/main/resources/defaults/contents/astraplus/enchantments/inertia.json new file mode 100644 index 0000000..ff4c96c --- /dev/null +++ b/src/main/resources/defaults/contents/astraplus/enchantments/inertia.json @@ -0,0 +1,7 @@ +{ + "id": "astraplus:inertia", "name": "Инерция", "maxLevel": 2, + "items": ["astraplus:netherite_twinblade"], "slots": ["mainhand"], + "conflicts": ["astraplus:reaping"], + "acquisition": {"table": true, "loot": true, "trading": true}, + "effects": [{"type": "recovery", "values": [0.1, 0.2], "minTargets": 2, "sweepOnly": true}] +} diff --git a/src/main/resources/defaults/contents/astraplus/enchantments/reach.json b/src/main/resources/defaults/contents/astraplus/enchantments/reach.json new file mode 100644 index 0000000..d77d0b1 --- /dev/null +++ b/src/main/resources/defaults/contents/astraplus/enchantments/reach.json @@ -0,0 +1,6 @@ +{ + "id": "astraplus:reach", "name": "Размах", "maxLevel": 2, + "items": ["astraplus:netherite_twinblade"], "slots": ["mainhand"], "conflicts": [], + "acquisition": {"table": true, "loot": true, "trading": true}, + "effects": [{"type": "sweep_reach", "values": [1, 2]}] +} diff --git a/src/main/resources/defaults/contents/astraplus/enchantments/reaping.json b/src/main/resources/defaults/contents/astraplus/enchantments/reaping.json new file mode 100644 index 0000000..65adba0 --- /dev/null +++ b/src/main/resources/defaults/contents/astraplus/enchantments/reaping.json @@ -0,0 +1,7 @@ +{ + "id": "astraplus:reaping", "name": "Жатва", "maxLevel": 3, + "items": ["astraplus:netherite_twinblade"], "slots": ["mainhand"], + "conflicts": ["astraplus:inertia"], + "acquisition": {"table": true, "loot": true, "trading": true}, + "effects": [{"type": "damage_bonus", "values": [0.1, 0.2, 0.3], "minTargets": 2, "sweepOnly": true}] +} diff --git a/src/main/resources/defaults/contents/astraplus/items/netherite_twinblade.json b/src/main/resources/defaults/contents/astraplus/items/netherite_twinblade.json new file mode 100644 index 0000000..357db31 --- /dev/null +++ b/src/main/resources/defaults/contents/astraplus/items/netherite_twinblade.json @@ -0,0 +1,11 @@ +{ + "name": "Незеритовый твинблейд", + "material": "minecraft:netherite_sword", + "model": "astraplus:item/netherite_twinblade", + "components": { + "minecraft:attribute_modifiers": [ + {"type": "minecraft:attack_damage", "id": "minecraft:base_attack_damage", "amount": 6, "operation": "add_value", "slot": "mainhand"}, + {"type": "minecraft:attack_speed", "id": "minecraft:base_attack_speed", "amount": -2.4, "operation": "add_value", "slot": "mainhand"} + ] + } +} diff --git a/src/main/resources/defaults/contents/astraweapons/items/gauntlets.json b/src/main/resources/defaults/contents/astraweapons/items/gauntlets.json new file mode 100644 index 0000000..4e81549 --- /dev/null +++ b/src/main/resources/defaults/contents/astraweapons/items/gauntlets.json @@ -0,0 +1,12 @@ +{ + "name": "Боевые перчатки", + "material": "minecraft:iron_sword", + "model": "astraweapons:item/iron_gauntlet_3d", + "components": { + "minecraft:lore": [{"text":"Модель: joshieman — Gallant Gauntlets","color":"dark_gray","italic":false}], + "minecraft:attribute_modifiers": [ + {"type":"minecraft:attack_damage","id":"minecraft:base_attack_damage","amount":2,"operation":"add_value","slot":"mainhand"}, + {"type":"minecraft:attack_speed","id":"minecraft:base_attack_speed","amount":0,"operation":"add_value","slot":"mainhand"} + ] + } +} diff --git a/src/main/resources/defaults/resources/assets/astraplus/models/item/netherite_twinblade.json b/src/main/resources/defaults/resources/assets/astraplus/models/item/netherite_twinblade.json new file mode 100644 index 0000000..3cdafac --- /dev/null +++ b/src/main/resources/defaults/resources/assets/astraplus/models/item/netherite_twinblade.json @@ -0,0 +1,136 @@ +{ + "parent": "builtin/generated", + "gui_light": "front", + "display": { + "ground": { + "rotation": [ + 0, + 0, + 0 + ], + "translation": [ + 0, + 2, + 0 + ], + "scale": [ + 2, + 2, + 0.5 + ] + }, + "head": { + "rotation": [ + 0, + 180, + 0 + ], + "translation": [ + 0, + 13, + 7 + ], + "scale": [ + 4, + 4, + 1 + ] + }, + "thirdperson_righthand": { + "rotation": [ + 0, + -90, + 55 + ], + "translation": [ + 0, + 4.0, + 0.5 + ], + "scale": [ + 3.4, + 3.4, + 0.85 + ] + }, + "thirdperson_lefthand": { + "rotation": [ + 0, + 90, + -55 + ], + "translation": [ + 0, + 4.0, + 0.5 + ], + "scale": [ + 3.4, + 3.4, + 0.85 + ] + }, + "firstperson_righthand": { + "rotation": [ + 0, + -90, + 25 + ], + "translation": [ + 1.13, + 3.2, + 1.13 + ], + "scale": [ + 2.72, + 2.72, + 0.68 + ] + }, + "firstperson_lefthand": { + "rotation": [ + 0, + 90, + -25 + ], + "translation": [ + 1.13, + 3.2, + 1.13 + ], + "scale": [ + 2.72, + 2.72, + 0.68 + ] + }, + "fixed": { + "rotation": [ + 0, + 180, + 0 + ], + "scale": [ + 4, + 4, + 1 + ] + }, + "gui": { + "rotation": [ + 0, + 0, + 0 + ], + "scale": [ + 1.5, + 1.5, + 1 + ], + "translation": [1.9, 1.9, 0] + } + }, + "textures": { + "layer0": "astraplus:item/netherite_twinblade" + } +} diff --git a/src/main/resources/defaults/resources/assets/astraplus/textures/item/netherite_twinblade.png b/src/main/resources/defaults/resources/assets/astraplus/textures/item/netherite_twinblade.png new file mode 100644 index 0000000..68f013a Binary files /dev/null and b/src/main/resources/defaults/resources/assets/astraplus/textures/item/netherite_twinblade.png differ diff --git a/src/main/resources/defaults/resources/assets/astraweapons/credits/THIRD_PARTY_NOTICES.md b/src/main/resources/defaults/resources/assets/astraweapons/credits/THIRD_PARTY_NOTICES.md new file mode 100644 index 0000000..b922b17 --- /dev/null +++ b/src/main/resources/defaults/resources/assets/astraweapons/credits/THIRD_PARTY_NOTICES.md @@ -0,0 +1,15 @@ +# Third-party assets + +Gauntlet model and textures: **joshieman**, **Gallant Gauntlets 1.1.2** (Fabric, Minecraft 1.21.1). +Source supplied by the user: `gauntlets-1.1.2-1.21.1`. +Project: https://www.curseforge.com/minecraft/mc-mods/gauntlets/files/5800931 +Original geometry and iron textures are retained. Changes: resource namespace, vanilla 26.2 item presentation, and new display-transform animation frames by AstraDev. +The source metadata declares ARR. The bundled `LICENSE_gauntlets` is preserved verbatim; this attribution does not relicense the original assets. + +Gauntlet sounds: **Mojang Studios / Double Eleven / Microsoft**, **Minecraft Dungeons**. +Reference and sound filenames: https://minecraft.wiki/w/Dungeons:Gauntlets +Minecraft Wiki refused direct downloads (HTTP 403); the identical named original game wave assets were obtained from the user's local Dungeons installation. OGG data are unmodified. +`gauntlet-audio-provenance.json` lists source names, Wiki file references, and SHA-256 hashes. + +Twinblade texture/model: retained from the existing user-provided AstraPlus resource pack. Original credit information was not present in that resource. +Crescent hit texture and pose animation JSON: AstraDev, authored for AstraWeapons. diff --git a/src/main/resources/defaults/resources/assets/astraweapons/items/animation/hook_0.json b/src/main/resources/defaults/resources/assets/astraweapons/items/animation/hook_0.json new file mode 100644 index 0000000..19e3144 --- /dev/null +++ b/src/main/resources/defaults/resources/assets/astraweapons/items/animation/hook_0.json @@ -0,0 +1,20 @@ +{ + "hand_animation_on_swap": false, + "model": { + "type": "minecraft:select", + "property": "minecraft:display_context", + "cases": [ + { + "when": "gui", + "model": { + "type": "minecraft:model", + "model": "astraweapons:item/iron_gauntlet_2d" + } + } + ], + "fallback": { + "type": "minecraft:model", + "model": "astraweapons:animation/hook_0" + } + } +} diff --git a/src/main/resources/defaults/resources/assets/astraweapons/items/animation/hook_1.json b/src/main/resources/defaults/resources/assets/astraweapons/items/animation/hook_1.json new file mode 100644 index 0000000..91d8481 --- /dev/null +++ b/src/main/resources/defaults/resources/assets/astraweapons/items/animation/hook_1.json @@ -0,0 +1,20 @@ +{ + "hand_animation_on_swap": false, + "model": { + "type": "minecraft:select", + "property": "minecraft:display_context", + "cases": [ + { + "when": "gui", + "model": { + "type": "minecraft:model", + "model": "astraweapons:item/iron_gauntlet_2d" + } + } + ], + "fallback": { + "type": "minecraft:model", + "model": "astraweapons:animation/hook_1" + } + } +} diff --git a/src/main/resources/defaults/resources/assets/astraweapons/items/animation/hook_2.json b/src/main/resources/defaults/resources/assets/astraweapons/items/animation/hook_2.json new file mode 100644 index 0000000..9d0aac6 --- /dev/null +++ b/src/main/resources/defaults/resources/assets/astraweapons/items/animation/hook_2.json @@ -0,0 +1,20 @@ +{ + "hand_animation_on_swap": false, + "model": { + "type": "minecraft:select", + "property": "minecraft:display_context", + "cases": [ + { + "when": "gui", + "model": { + "type": "minecraft:model", + "model": "astraweapons:item/iron_gauntlet_2d" + } + } + ], + "fallback": { + "type": "minecraft:model", + "model": "astraweapons:animation/hook_2" + } + } +} diff --git a/src/main/resources/defaults/resources/assets/astraweapons/items/animation/hook_3.json b/src/main/resources/defaults/resources/assets/astraweapons/items/animation/hook_3.json new file mode 100644 index 0000000..6703e26 --- /dev/null +++ b/src/main/resources/defaults/resources/assets/astraweapons/items/animation/hook_3.json @@ -0,0 +1,20 @@ +{ + "hand_animation_on_swap": false, + "model": { + "type": "minecraft:select", + "property": "minecraft:display_context", + "cases": [ + { + "when": "gui", + "model": { + "type": "minecraft:model", + "model": "astraweapons:item/iron_gauntlet_2d" + } + } + ], + "fallback": { + "type": "minecraft:model", + "model": "astraweapons:animation/hook_3" + } + } +} diff --git a/src/main/resources/defaults/resources/assets/astraweapons/items/animation/hook_4.json b/src/main/resources/defaults/resources/assets/astraweapons/items/animation/hook_4.json new file mode 100644 index 0000000..faf0af0 --- /dev/null +++ b/src/main/resources/defaults/resources/assets/astraweapons/items/animation/hook_4.json @@ -0,0 +1,20 @@ +{ + "hand_animation_on_swap": false, + "model": { + "type": "minecraft:select", + "property": "minecraft:display_context", + "cases": [ + { + "when": "gui", + "model": { + "type": "minecraft:model", + "model": "astraweapons:item/iron_gauntlet_2d" + } + } + ], + "fallback": { + "type": "minecraft:model", + "model": "astraweapons:animation/hook_4" + } + } +} diff --git a/src/main/resources/defaults/resources/assets/astraweapons/items/animation/hook_5.json b/src/main/resources/defaults/resources/assets/astraweapons/items/animation/hook_5.json new file mode 100644 index 0000000..08b56d5 --- /dev/null +++ b/src/main/resources/defaults/resources/assets/astraweapons/items/animation/hook_5.json @@ -0,0 +1,20 @@ +{ + "hand_animation_on_swap": false, + "model": { + "type": "minecraft:select", + "property": "minecraft:display_context", + "cases": [ + { + "when": "gui", + "model": { + "type": "minecraft:model", + "model": "astraweapons:item/iron_gauntlet_2d" + } + } + ], + "fallback": { + "type": "minecraft:model", + "model": "astraweapons:animation/hook_5" + } + } +} diff --git a/src/main/resources/defaults/resources/assets/astraweapons/items/animation/jab_0.json b/src/main/resources/defaults/resources/assets/astraweapons/items/animation/jab_0.json new file mode 100644 index 0000000..b6dd2e8 --- /dev/null +++ b/src/main/resources/defaults/resources/assets/astraweapons/items/animation/jab_0.json @@ -0,0 +1,20 @@ +{ + "hand_animation_on_swap": false, + "model": { + "type": "minecraft:select", + "property": "minecraft:display_context", + "cases": [ + { + "when": "gui", + "model": { + "type": "minecraft:model", + "model": "astraweapons:item/iron_gauntlet_2d" + } + } + ], + "fallback": { + "type": "minecraft:model", + "model": "astraweapons:animation/jab_0" + } + } +} diff --git a/src/main/resources/defaults/resources/assets/astraweapons/items/animation/jab_1.json b/src/main/resources/defaults/resources/assets/astraweapons/items/animation/jab_1.json new file mode 100644 index 0000000..79652de --- /dev/null +++ b/src/main/resources/defaults/resources/assets/astraweapons/items/animation/jab_1.json @@ -0,0 +1,20 @@ +{ + "hand_animation_on_swap": false, + "model": { + "type": "minecraft:select", + "property": "minecraft:display_context", + "cases": [ + { + "when": "gui", + "model": { + "type": "minecraft:model", + "model": "astraweapons:item/iron_gauntlet_2d" + } + } + ], + "fallback": { + "type": "minecraft:model", + "model": "astraweapons:animation/jab_1" + } + } +} diff --git a/src/main/resources/defaults/resources/assets/astraweapons/items/animation/jab_2.json b/src/main/resources/defaults/resources/assets/astraweapons/items/animation/jab_2.json new file mode 100644 index 0000000..6ffce3a --- /dev/null +++ b/src/main/resources/defaults/resources/assets/astraweapons/items/animation/jab_2.json @@ -0,0 +1,20 @@ +{ + "hand_animation_on_swap": false, + "model": { + "type": "minecraft:select", + "property": "minecraft:display_context", + "cases": [ + { + "when": "gui", + "model": { + "type": "minecraft:model", + "model": "astraweapons:item/iron_gauntlet_2d" + } + } + ], + "fallback": { + "type": "minecraft:model", + "model": "astraweapons:animation/jab_2" + } + } +} diff --git a/src/main/resources/defaults/resources/assets/astraweapons/items/animation/jab_3.json b/src/main/resources/defaults/resources/assets/astraweapons/items/animation/jab_3.json new file mode 100644 index 0000000..ea7d715 --- /dev/null +++ b/src/main/resources/defaults/resources/assets/astraweapons/items/animation/jab_3.json @@ -0,0 +1,20 @@ +{ + "hand_animation_on_swap": false, + "model": { + "type": "minecraft:select", + "property": "minecraft:display_context", + "cases": [ + { + "when": "gui", + "model": { + "type": "minecraft:model", + "model": "astraweapons:item/iron_gauntlet_2d" + } + } + ], + "fallback": { + "type": "minecraft:model", + "model": "astraweapons:animation/jab_3" + } + } +} diff --git a/src/main/resources/defaults/resources/assets/astraweapons/items/animation/jab_4.json b/src/main/resources/defaults/resources/assets/astraweapons/items/animation/jab_4.json new file mode 100644 index 0000000..9bd4e2f --- /dev/null +++ b/src/main/resources/defaults/resources/assets/astraweapons/items/animation/jab_4.json @@ -0,0 +1,20 @@ +{ + "hand_animation_on_swap": false, + "model": { + "type": "minecraft:select", + "property": "minecraft:display_context", + "cases": [ + { + "when": "gui", + "model": { + "type": "minecraft:model", + "model": "astraweapons:item/iron_gauntlet_2d" + } + } + ], + "fallback": { + "type": "minecraft:model", + "model": "astraweapons:animation/jab_4" + } + } +} diff --git a/src/main/resources/defaults/resources/assets/astraweapons/items/animation/jab_5.json b/src/main/resources/defaults/resources/assets/astraweapons/items/animation/jab_5.json new file mode 100644 index 0000000..9f23f39 --- /dev/null +++ b/src/main/resources/defaults/resources/assets/astraweapons/items/animation/jab_5.json @@ -0,0 +1,20 @@ +{ + "hand_animation_on_swap": false, + "model": { + "type": "minecraft:select", + "property": "minecraft:display_context", + "cases": [ + { + "when": "gui", + "model": { + "type": "minecraft:model", + "model": "astraweapons:item/iron_gauntlet_2d" + } + } + ], + "fallback": { + "type": "minecraft:model", + "model": "astraweapons:animation/jab_5" + } + } +} diff --git a/src/main/resources/defaults/resources/assets/astraweapons/items/animation/lunge_0.json b/src/main/resources/defaults/resources/assets/astraweapons/items/animation/lunge_0.json new file mode 100644 index 0000000..345679e --- /dev/null +++ b/src/main/resources/defaults/resources/assets/astraweapons/items/animation/lunge_0.json @@ -0,0 +1,20 @@ +{ + "hand_animation_on_swap": false, + "model": { + "type": "minecraft:select", + "property": "minecraft:display_context", + "cases": [ + { + "when": "gui", + "model": { + "type": "minecraft:model", + "model": "astraweapons:item/iron_gauntlet_2d" + } + } + ], + "fallback": { + "type": "minecraft:model", + "model": "astraweapons:animation/lunge_0" + } + } +} diff --git a/src/main/resources/defaults/resources/assets/astraweapons/items/animation/lunge_1.json b/src/main/resources/defaults/resources/assets/astraweapons/items/animation/lunge_1.json new file mode 100644 index 0000000..cdfa3d2 --- /dev/null +++ b/src/main/resources/defaults/resources/assets/astraweapons/items/animation/lunge_1.json @@ -0,0 +1,20 @@ +{ + "hand_animation_on_swap": false, + "model": { + "type": "minecraft:select", + "property": "minecraft:display_context", + "cases": [ + { + "when": "gui", + "model": { + "type": "minecraft:model", + "model": "astraweapons:item/iron_gauntlet_2d" + } + } + ], + "fallback": { + "type": "minecraft:model", + "model": "astraweapons:animation/lunge_1" + } + } +} diff --git a/src/main/resources/defaults/resources/assets/astraweapons/items/animation/lunge_2.json b/src/main/resources/defaults/resources/assets/astraweapons/items/animation/lunge_2.json new file mode 100644 index 0000000..953612c --- /dev/null +++ b/src/main/resources/defaults/resources/assets/astraweapons/items/animation/lunge_2.json @@ -0,0 +1,20 @@ +{ + "hand_animation_on_swap": false, + "model": { + "type": "minecraft:select", + "property": "minecraft:display_context", + "cases": [ + { + "when": "gui", + "model": { + "type": "minecraft:model", + "model": "astraweapons:item/iron_gauntlet_2d" + } + } + ], + "fallback": { + "type": "minecraft:model", + "model": "astraweapons:animation/lunge_2" + } + } +} diff --git a/src/main/resources/defaults/resources/assets/astraweapons/items/animation/lunge_3.json b/src/main/resources/defaults/resources/assets/astraweapons/items/animation/lunge_3.json new file mode 100644 index 0000000..615cc35 --- /dev/null +++ b/src/main/resources/defaults/resources/assets/astraweapons/items/animation/lunge_3.json @@ -0,0 +1,20 @@ +{ + "hand_animation_on_swap": false, + "model": { + "type": "minecraft:select", + "property": "minecraft:display_context", + "cases": [ + { + "when": "gui", + "model": { + "type": "minecraft:model", + "model": "astraweapons:item/iron_gauntlet_2d" + } + } + ], + "fallback": { + "type": "minecraft:model", + "model": "astraweapons:animation/lunge_3" + } + } +} diff --git a/src/main/resources/defaults/resources/assets/astraweapons/items/animation/lunge_4.json b/src/main/resources/defaults/resources/assets/astraweapons/items/animation/lunge_4.json new file mode 100644 index 0000000..f84158b --- /dev/null +++ b/src/main/resources/defaults/resources/assets/astraweapons/items/animation/lunge_4.json @@ -0,0 +1,20 @@ +{ + "hand_animation_on_swap": false, + "model": { + "type": "minecraft:select", + "property": "minecraft:display_context", + "cases": [ + { + "when": "gui", + "model": { + "type": "minecraft:model", + "model": "astraweapons:item/iron_gauntlet_2d" + } + } + ], + "fallback": { + "type": "minecraft:model", + "model": "astraweapons:animation/lunge_4" + } + } +} diff --git a/src/main/resources/defaults/resources/assets/astraweapons/items/animation/lunge_5.json b/src/main/resources/defaults/resources/assets/astraweapons/items/animation/lunge_5.json new file mode 100644 index 0000000..625e0bf --- /dev/null +++ b/src/main/resources/defaults/resources/assets/astraweapons/items/animation/lunge_5.json @@ -0,0 +1,20 @@ +{ + "hand_animation_on_swap": false, + "model": { + "type": "minecraft:select", + "property": "minecraft:display_context", + "cases": [ + { + "when": "gui", + "model": { + "type": "minecraft:model", + "model": "astraweapons:item/iron_gauntlet_2d" + } + } + ], + "fallback": { + "type": "minecraft:model", + "model": "astraweapons:animation/lunge_5" + } + } +} diff --git a/src/main/resources/defaults/resources/assets/astraweapons/items/animation/twinblade_0.json b/src/main/resources/defaults/resources/assets/astraweapons/items/animation/twinblade_0.json new file mode 100644 index 0000000..a1f5ad1 --- /dev/null +++ b/src/main/resources/defaults/resources/assets/astraweapons/items/animation/twinblade_0.json @@ -0,0 +1,20 @@ +{ + "hand_animation_on_swap": false, + "model": { + "type": "minecraft:select", + "property": "minecraft:display_context", + "cases": [ + { + "when": "gui", + "model": { + "type": "minecraft:model", + "model": "astraplus:internal/twinblade_gui" + } + } + ], + "fallback": { + "type": "minecraft:model", + "model": "astraweapons:animation/twinblade_0" + } + } +} diff --git a/src/main/resources/defaults/resources/assets/astraweapons/items/animation/twinblade_1.json b/src/main/resources/defaults/resources/assets/astraweapons/items/animation/twinblade_1.json new file mode 100644 index 0000000..8f5e686 --- /dev/null +++ b/src/main/resources/defaults/resources/assets/astraweapons/items/animation/twinblade_1.json @@ -0,0 +1,20 @@ +{ + "hand_animation_on_swap": false, + "model": { + "type": "minecraft:select", + "property": "minecraft:display_context", + "cases": [ + { + "when": "gui", + "model": { + "type": "minecraft:model", + "model": "astraplus:internal/twinblade_gui" + } + } + ], + "fallback": { + "type": "minecraft:model", + "model": "astraweapons:animation/twinblade_1" + } + } +} diff --git a/src/main/resources/defaults/resources/assets/astraweapons/items/animation/twinblade_2.json b/src/main/resources/defaults/resources/assets/astraweapons/items/animation/twinblade_2.json new file mode 100644 index 0000000..8f0ad70 --- /dev/null +++ b/src/main/resources/defaults/resources/assets/astraweapons/items/animation/twinblade_2.json @@ -0,0 +1,20 @@ +{ + "hand_animation_on_swap": false, + "model": { + "type": "minecraft:select", + "property": "minecraft:display_context", + "cases": [ + { + "when": "gui", + "model": { + "type": "minecraft:model", + "model": "astraplus:internal/twinblade_gui" + } + } + ], + "fallback": { + "type": "minecraft:model", + "model": "astraweapons:animation/twinblade_2" + } + } +} diff --git a/src/main/resources/defaults/resources/assets/astraweapons/items/animation/twinblade_3.json b/src/main/resources/defaults/resources/assets/astraweapons/items/animation/twinblade_3.json new file mode 100644 index 0000000..a08993d --- /dev/null +++ b/src/main/resources/defaults/resources/assets/astraweapons/items/animation/twinblade_3.json @@ -0,0 +1,20 @@ +{ + "hand_animation_on_swap": false, + "model": { + "type": "minecraft:select", + "property": "minecraft:display_context", + "cases": [ + { + "when": "gui", + "model": { + "type": "minecraft:model", + "model": "astraplus:internal/twinblade_gui" + } + } + ], + "fallback": { + "type": "minecraft:model", + "model": "astraweapons:animation/twinblade_3" + } + } +} diff --git a/src/main/resources/defaults/resources/assets/astraweapons/items/animation/twinblade_4.json b/src/main/resources/defaults/resources/assets/astraweapons/items/animation/twinblade_4.json new file mode 100644 index 0000000..11cbeae --- /dev/null +++ b/src/main/resources/defaults/resources/assets/astraweapons/items/animation/twinblade_4.json @@ -0,0 +1,20 @@ +{ + "hand_animation_on_swap": false, + "model": { + "type": "minecraft:select", + "property": "minecraft:display_context", + "cases": [ + { + "when": "gui", + "model": { + "type": "minecraft:model", + "model": "astraplus:internal/twinblade_gui" + } + } + ], + "fallback": { + "type": "minecraft:model", + "model": "astraweapons:animation/twinblade_4" + } + } +} diff --git a/src/main/resources/defaults/resources/assets/astraweapons/items/animation/twinblade_5.json b/src/main/resources/defaults/resources/assets/astraweapons/items/animation/twinblade_5.json new file mode 100644 index 0000000..5bfc82a --- /dev/null +++ b/src/main/resources/defaults/resources/assets/astraweapons/items/animation/twinblade_5.json @@ -0,0 +1,20 @@ +{ + "hand_animation_on_swap": false, + "model": { + "type": "minecraft:select", + "property": "minecraft:display_context", + "cases": [ + { + "when": "gui", + "model": { + "type": "minecraft:model", + "model": "astraplus:internal/twinblade_gui" + } + } + ], + "fallback": { + "type": "minecraft:model", + "model": "astraweapons:animation/twinblade_5" + } + } +} diff --git a/src/main/resources/defaults/resources/assets/astraweapons/items/animation/uppercut_0.json b/src/main/resources/defaults/resources/assets/astraweapons/items/animation/uppercut_0.json new file mode 100644 index 0000000..41ff867 --- /dev/null +++ b/src/main/resources/defaults/resources/assets/astraweapons/items/animation/uppercut_0.json @@ -0,0 +1,20 @@ +{ + "hand_animation_on_swap": false, + "model": { + "type": "minecraft:select", + "property": "minecraft:display_context", + "cases": [ + { + "when": "gui", + "model": { + "type": "minecraft:model", + "model": "astraweapons:item/iron_gauntlet_2d" + } + } + ], + "fallback": { + "type": "minecraft:model", + "model": "astraweapons:animation/uppercut_0" + } + } +} diff --git a/src/main/resources/defaults/resources/assets/astraweapons/items/animation/uppercut_1.json b/src/main/resources/defaults/resources/assets/astraweapons/items/animation/uppercut_1.json new file mode 100644 index 0000000..a7876b3 --- /dev/null +++ b/src/main/resources/defaults/resources/assets/astraweapons/items/animation/uppercut_1.json @@ -0,0 +1,20 @@ +{ + "hand_animation_on_swap": false, + "model": { + "type": "minecraft:select", + "property": "minecraft:display_context", + "cases": [ + { + "when": "gui", + "model": { + "type": "minecraft:model", + "model": "astraweapons:item/iron_gauntlet_2d" + } + } + ], + "fallback": { + "type": "minecraft:model", + "model": "astraweapons:animation/uppercut_1" + } + } +} diff --git a/src/main/resources/defaults/resources/assets/astraweapons/items/animation/uppercut_2.json b/src/main/resources/defaults/resources/assets/astraweapons/items/animation/uppercut_2.json new file mode 100644 index 0000000..30487fc --- /dev/null +++ b/src/main/resources/defaults/resources/assets/astraweapons/items/animation/uppercut_2.json @@ -0,0 +1,20 @@ +{ + "hand_animation_on_swap": false, + "model": { + "type": "minecraft:select", + "property": "minecraft:display_context", + "cases": [ + { + "when": "gui", + "model": { + "type": "minecraft:model", + "model": "astraweapons:item/iron_gauntlet_2d" + } + } + ], + "fallback": { + "type": "minecraft:model", + "model": "astraweapons:animation/uppercut_2" + } + } +} diff --git a/src/main/resources/defaults/resources/assets/astraweapons/items/animation/uppercut_3.json b/src/main/resources/defaults/resources/assets/astraweapons/items/animation/uppercut_3.json new file mode 100644 index 0000000..8e5bc2a --- /dev/null +++ b/src/main/resources/defaults/resources/assets/astraweapons/items/animation/uppercut_3.json @@ -0,0 +1,20 @@ +{ + "hand_animation_on_swap": false, + "model": { + "type": "minecraft:select", + "property": "minecraft:display_context", + "cases": [ + { + "when": "gui", + "model": { + "type": "minecraft:model", + "model": "astraweapons:item/iron_gauntlet_2d" + } + } + ], + "fallback": { + "type": "minecraft:model", + "model": "astraweapons:animation/uppercut_3" + } + } +} diff --git a/src/main/resources/defaults/resources/assets/astraweapons/items/animation/uppercut_4.json b/src/main/resources/defaults/resources/assets/astraweapons/items/animation/uppercut_4.json new file mode 100644 index 0000000..ba275d5 --- /dev/null +++ b/src/main/resources/defaults/resources/assets/astraweapons/items/animation/uppercut_4.json @@ -0,0 +1,20 @@ +{ + "hand_animation_on_swap": false, + "model": { + "type": "minecraft:select", + "property": "minecraft:display_context", + "cases": [ + { + "when": "gui", + "model": { + "type": "minecraft:model", + "model": "astraweapons:item/iron_gauntlet_2d" + } + } + ], + "fallback": { + "type": "minecraft:model", + "model": "astraweapons:animation/uppercut_4" + } + } +} diff --git a/src/main/resources/defaults/resources/assets/astraweapons/items/animation/uppercut_5.json b/src/main/resources/defaults/resources/assets/astraweapons/items/animation/uppercut_5.json new file mode 100644 index 0000000..b9356b1 --- /dev/null +++ b/src/main/resources/defaults/resources/assets/astraweapons/items/animation/uppercut_5.json @@ -0,0 +1,20 @@ +{ + "hand_animation_on_swap": false, + "model": { + "type": "minecraft:select", + "property": "minecraft:display_context", + "cases": [ + { + "when": "gui", + "model": { + "type": "minecraft:model", + "model": "astraweapons:item/iron_gauntlet_2d" + } + } + ], + "fallback": { + "type": "minecraft:model", + "model": "astraweapons:animation/uppercut_5" + } + } +} diff --git a/src/main/resources/defaults/resources/assets/astraweapons/items/gauntlet_offhand.json b/src/main/resources/defaults/resources/assets/astraweapons/items/gauntlet_offhand.json new file mode 100644 index 0000000..e6f4f2f --- /dev/null +++ b/src/main/resources/defaults/resources/assets/astraweapons/items/gauntlet_offhand.json @@ -0,0 +1,20 @@ +{ + "hand_animation_on_swap": false, + "model": { + "type": "minecraft:select", + "property": "minecraft:display_context", + "cases": [ + { + "when": "gui", + "model": { + "type": "minecraft:model", + "model": "astraweapons:item/iron_gauntlet_2d" + } + } + ], + "fallback": { + "type": "minecraft:model", + "model": "astraweapons:item/iron_gauntlet_3d" + } + } +} diff --git a/src/main/resources/defaults/resources/assets/astraweapons/items/slash.json b/src/main/resources/defaults/resources/assets/astraweapons/items/slash.json new file mode 100644 index 0000000..3bcf543 --- /dev/null +++ b/src/main/resources/defaults/resources/assets/astraweapons/items/slash.json @@ -0,0 +1,6 @@ +{ + "model": { + "type": "minecraft:model", + "model": "astraweapons:effect/slash" + } +} diff --git a/src/main/resources/defaults/resources/assets/astraweapons/items/slash_fire.json b/src/main/resources/defaults/resources/assets/astraweapons/items/slash_fire.json new file mode 100644 index 0000000..4dda399 --- /dev/null +++ b/src/main/resources/defaults/resources/assets/astraweapons/items/slash_fire.json @@ -0,0 +1,6 @@ +{ + "model": { + "type": "minecraft:model", + "model": "astraweapons:effect/slash_fire" + } +} diff --git a/src/main/resources/defaults/resources/assets/astraweapons/lang/en_us.json b/src/main/resources/defaults/resources/assets/astraweapons/lang/en_us.json new file mode 100644 index 0000000..f54f78a --- /dev/null +++ b/src/main/resources/defaults/resources/assets/astraweapons/lang/en_us.json @@ -0,0 +1,10 @@ +{ + "subtitles.astraweapons.gauntlets.hit_light": "Hit light", + "subtitles.astraweapons.gauntlets.hit_medium": "Hit medium", + "subtitles.astraweapons.gauntlets.hit_kick": "Hit kick", + "subtitles.astraweapons.gauntlets.hit_punch": "Hit punch", + "subtitles.astraweapons.gauntlets.swing_short": "Swing short", + "subtitles.astraweapons.gauntlets.swing_medium": "Swing medium", + "subtitles.astraweapons.gauntlets.swing_kick": "Swing kick", + "subtitles.astraweapons.gauntlets.swing_scream": "Swing scream" +} \ No newline at end of file diff --git a/src/main/resources/defaults/resources/assets/astraweapons/lang/ru_ru.json b/src/main/resources/defaults/resources/assets/astraweapons/lang/ru_ru.json new file mode 100644 index 0000000..af3a1a4 --- /dev/null +++ b/src/main/resources/defaults/resources/assets/astraweapons/lang/ru_ru.json @@ -0,0 +1,10 @@ +{ + "subtitles.astraweapons.gauntlets.hit_light": "Удар перчаткой", + "subtitles.astraweapons.gauntlets.hit_medium": "Апперкот", + "subtitles.astraweapons.gauntlets.hit_kick": "Выпад", + "subtitles.astraweapons.gauntlets.hit_punch": "Хук", + "subtitles.astraweapons.gauntlets.swing_short": "Замах перчаткой", + "subtitles.astraweapons.gauntlets.swing_medium": "Замах апперкота", + "subtitles.astraweapons.gauntlets.swing_kick": "Замах выпада", + "subtitles.astraweapons.gauntlets.swing_scream": "Резкий замах" +} \ No newline at end of file diff --git a/src/main/resources/defaults/resources/assets/astraweapons/models/animation/hook_0.json b/src/main/resources/defaults/resources/assets/astraweapons/models/animation/hook_0.json new file mode 100644 index 0000000..87bea7a --- /dev/null +++ b/src/main/resources/defaults/resources/assets/astraweapons/models/animation/hook_0.json @@ -0,0 +1,76 @@ +{ + "parent": "astraweapons:item/iron_gauntlet_3d", + "display": { + "firstperson_righthand": { + "rotation": [ + -24, + 0.0, + -8.0 + ], + "translation": [ + 0.5, + 6.5, + 0.0 + ], + "scale": [ + 1, + 1, + 1 + ] + }, + "thirdperson_righthand": { + "rotation": [ + -90, + 90.0, + 0.0 + ], + "translation": [ + 0.0, + -3, + -1.25 + ], + "scale": [ + 1.15, + 1.15, + 1.15 + ] + }, + "firstperson_lefthand": { + "rotation": [ + -24, + 0.0, + -8.0 + ], + "translation": [ + -1.5, + 6.5, + 0.0 + ], + "scale": [ + 1, + 1, + 1 + ] + }, + "thirdperson_lefthand": { + "rotation": [ + -90, + -90.0, + 0.0 + ], + "translation": [ + 0.0, + -3, + -1.25 + ], + "scale": [ + 1.15, + 1.15, + 1.15 + ] + } + }, + "textures": { + "particle": "#0" + } +} diff --git a/src/main/resources/defaults/resources/assets/astraweapons/models/animation/hook_1.json b/src/main/resources/defaults/resources/assets/astraweapons/models/animation/hook_1.json new file mode 100644 index 0000000..b5c47c1 --- /dev/null +++ b/src/main/resources/defaults/resources/assets/astraweapons/models/animation/hook_1.json @@ -0,0 +1,76 @@ +{ + "parent": "astraweapons:item/iron_gauntlet_3d", + "display": { + "firstperson_righthand": { + "rotation": [ + -24, + 29.389262614623657, + 27.267115137548387 + ], + "translation": [ + -4.202282018339785, + 6.5, + -2.938926261462366 + ], + "scale": [ + 1, + 1, + 1 + ] + }, + "thirdperson_righthand": { + "rotation": [ + -90, + 119.38926261462366, + 35.26711513754839 + ], + "translation": [ + -4.702282018339785, + -3, + -4.188926261462366 + ], + "scale": [ + 1.15, + 1.15, + 1.15 + ] + }, + "firstperson_lefthand": { + "rotation": [ + -24, + -29.389262614623657, + -43.26711513754839 + ], + "translation": [ + 3.202282018339785, + 6.5, + -2.938926261462366 + ], + "scale": [ + 1, + 1, + 1 + ] + }, + "thirdperson_lefthand": { + "rotation": [ + -90, + -119.38926261462366, + -35.26711513754839 + ], + "translation": [ + 4.702282018339785, + -3, + -4.188926261462366 + ], + "scale": [ + 1.15, + 1.15, + 1.15 + ] + } + }, + "textures": { + "particle": "#0" + } +} diff --git a/src/main/resources/defaults/resources/assets/astraweapons/models/animation/hook_2.json b/src/main/resources/defaults/resources/assets/astraweapons/models/animation/hook_2.json new file mode 100644 index 0000000..a8d27f5 --- /dev/null +++ b/src/main/resources/defaults/resources/assets/astraweapons/models/animation/hook_2.json @@ -0,0 +1,76 @@ +{ + "parent": "astraweapons:item/iron_gauntlet_3d", + "display": { + "firstperson_righthand": { + "rotation": [ + -24, + 47.552825814757675, + 49.06339097770921 + ], + "translation": [ + -7.108452130361228, + 6.5, + -4.755282581475767 + ], + "scale": [ + 1, + 1, + 1 + ] + }, + "thirdperson_righthand": { + "rotation": [ + -90, + 137.55282581475768, + 57.06339097770921 + ], + "translation": [ + -7.608452130361228, + -3, + -6.005282581475767 + ], + "scale": [ + 1.15, + 1.15, + 1.15 + ] + }, + "firstperson_lefthand": { + "rotation": [ + -24, + -47.552825814757675, + -65.06339097770922 + ], + "translation": [ + 6.108452130361228, + 6.5, + -4.755282581475767 + ], + "scale": [ + 1, + 1, + 1 + ] + }, + "thirdperson_lefthand": { + "rotation": [ + -90, + -137.55282581475768, + -57.06339097770921 + ], + "translation": [ + 7.608452130361228, + -3, + -6.005282581475767 + ], + "scale": [ + 1.15, + 1.15, + 1.15 + ] + } + }, + "textures": { + "particle": "#0" + } +} diff --git a/src/main/resources/defaults/resources/assets/astraweapons/models/animation/hook_3.json b/src/main/resources/defaults/resources/assets/astraweapons/models/animation/hook_3.json new file mode 100644 index 0000000..ba5f643 --- /dev/null +++ b/src/main/resources/defaults/resources/assets/astraweapons/models/animation/hook_3.json @@ -0,0 +1,76 @@ +{ + "parent": "astraweapons:item/iron_gauntlet_3d", + "display": { + "firstperson_righthand": { + "rotation": [ + -24, + 47.55282581475768, + 49.06339097770922 + ], + "translation": [ + -7.108452130361229, + 6.5, + -4.755282581475768 + ], + "scale": [ + 1, + 1, + 1 + ] + }, + "thirdperson_righthand": { + "rotation": [ + -90, + 137.55282581475768, + 57.06339097770922 + ], + "translation": [ + -7.608452130361229, + -3, + -6.005282581475768 + ], + "scale": [ + 1.15, + 1.15, + 1.15 + ] + }, + "firstperson_lefthand": { + "rotation": [ + -24, + -47.55282581475768, + -65.06339097770922 + ], + "translation": [ + 6.108452130361229, + 6.5, + -4.755282581475768 + ], + "scale": [ + 1, + 1, + 1 + ] + }, + "thirdperson_lefthand": { + "rotation": [ + -90, + -137.55282581475768, + -57.06339097770922 + ], + "translation": [ + 7.608452130361229, + -3, + -6.005282581475768 + ], + "scale": [ + 1.15, + 1.15, + 1.15 + ] + } + }, + "textures": { + "particle": "#0" + } +} diff --git a/src/main/resources/defaults/resources/assets/astraweapons/models/animation/hook_4.json b/src/main/resources/defaults/resources/assets/astraweapons/models/animation/hook_4.json new file mode 100644 index 0000000..493bdca --- /dev/null +++ b/src/main/resources/defaults/resources/assets/astraweapons/models/animation/hook_4.json @@ -0,0 +1,76 @@ +{ + "parent": "astraweapons:item/iron_gauntlet_3d", + "display": { + "firstperson_righthand": { + "rotation": [ + -24, + 29.38926261462366, + 27.267115137548394 + ], + "translation": [ + -4.202282018339786, + 6.5, + -2.9389262614623664 + ], + "scale": [ + 1, + 1, + 1 + ] + }, + "thirdperson_righthand": { + "rotation": [ + -90, + 119.38926261462366, + 35.267115137548394 + ], + "translation": [ + -4.702282018339786, + -3, + -4.188926261462367 + ], + "scale": [ + 1.15, + 1.15, + 1.15 + ] + }, + "firstperson_lefthand": { + "rotation": [ + -24, + -29.38926261462366, + -43.267115137548394 + ], + "translation": [ + 3.202282018339786, + 6.5, + -2.9389262614623664 + ], + "scale": [ + 1, + 1, + 1 + ] + }, + "thirdperson_lefthand": { + "rotation": [ + -90, + -119.38926261462366, + -35.267115137548394 + ], + "translation": [ + 4.702282018339786, + -3, + -4.188926261462367 + ], + "scale": [ + 1.15, + 1.15, + 1.15 + ] + } + }, + "textures": { + "particle": "#0" + } +} diff --git a/src/main/resources/defaults/resources/assets/astraweapons/models/animation/hook_5.json b/src/main/resources/defaults/resources/assets/astraweapons/models/animation/hook_5.json new file mode 100644 index 0000000..2074020 --- /dev/null +++ b/src/main/resources/defaults/resources/assets/astraweapons/models/animation/hook_5.json @@ -0,0 +1,76 @@ +{ + "parent": "astraweapons:item/iron_gauntlet_3d", + "display": { + "firstperson_righthand": { + "rotation": [ + -24, + 6.123233995736766e-15, + -7.999999999999993 + ], + "translation": [ + 0.499999999999999, + 6.5, + -6.123233995736766e-16 + ], + "scale": [ + 1, + 1, + 1 + ] + }, + "thirdperson_righthand": { + "rotation": [ + -90, + 90.0, + 7.34788079488412e-15 + ], + "translation": [ + -9.797174393178826e-16, + -3, + -1.2500000000000007 + ], + "scale": [ + 1.15, + 1.15, + 1.15 + ] + }, + "firstperson_lefthand": { + "rotation": [ + -24, + -6.123233995736766e-15, + -8.000000000000007 + ], + "translation": [ + -1.4999999999999991, + 6.5, + -6.123233995736766e-16 + ], + "scale": [ + 1, + 1, + 1 + ] + }, + "thirdperson_lefthand": { + "rotation": [ + -90, + -90.0, + -7.34788079488412e-15 + ], + "translation": [ + 9.797174393178826e-16, + -3, + -1.2500000000000007 + ], + "scale": [ + 1.15, + 1.15, + 1.15 + ] + } + }, + "textures": { + "particle": "#0" + } +} diff --git a/src/main/resources/defaults/resources/assets/astraweapons/models/animation/jab_0.json b/src/main/resources/defaults/resources/assets/astraweapons/models/animation/jab_0.json new file mode 100644 index 0000000..027e69e --- /dev/null +++ b/src/main/resources/defaults/resources/assets/astraweapons/models/animation/jab_0.json @@ -0,0 +1,76 @@ +{ + "parent": "astraweapons:item/iron_gauntlet_3d", + "display": { + "firstperson_righthand": { + "rotation": [ + -24.0, + 0, + -8 + ], + "translation": [ + 0.5, + 6.5, + 0.0 + ], + "scale": [ + 1, + 1, + 1 + ] + }, + "thirdperson_righthand": { + "rotation": [ + -90.0, + 90, + 0 + ], + "translation": [ + 0, + -3, + -1.25 + ], + "scale": [ + 1.15, + 1.15, + 1.15 + ] + }, + "firstperson_lefthand": { + "rotation": [ + -24.0, + 0, + -8 + ], + "translation": [ + -1.5, + 6.5, + 0.0 + ], + "scale": [ + 1, + 1, + 1 + ] + }, + "thirdperson_lefthand": { + "rotation": [ + -90.0, + -90, + 0 + ], + "translation": [ + 0, + -3, + -1.25 + ], + "scale": [ + 1.15, + 1.15, + 1.15 + ] + } + }, + "textures": { + "particle": "#0" + } +} diff --git a/src/main/resources/defaults/resources/assets/astraweapons/models/animation/jab_1.json b/src/main/resources/defaults/resources/assets/astraweapons/models/animation/jab_1.json new file mode 100644 index 0000000..6de87c7 --- /dev/null +++ b/src/main/resources/defaults/resources/assets/astraweapons/models/animation/jab_1.json @@ -0,0 +1,76 @@ +{ + "parent": "astraweapons:item/iron_gauntlet_3d", + "display": { + "firstperson_righthand": { + "rotation": [ + -34.58013454126451, + 0, + -8 + ], + "translation": [ + 0.5, + 6.5, + -5.2900672706322585 + ], + "scale": [ + 1, + 1, + 1 + ] + }, + "thirdperson_righthand": { + "rotation": [ + -100.58013454126451, + 90, + 0 + ], + "translation": [ + 0, + -3, + -6.5400672706322585 + ], + "scale": [ + 1.15, + 1.15, + 1.15 + ] + }, + "firstperson_lefthand": { + "rotation": [ + -34.58013454126451, + 0, + -8 + ], + "translation": [ + -1.5, + 6.5, + -5.2900672706322585 + ], + "scale": [ + 1, + 1, + 1 + ] + }, + "thirdperson_lefthand": { + "rotation": [ + -100.58013454126451, + -90, + 0 + ], + "translation": [ + 0, + -3, + -6.5400672706322585 + ], + "scale": [ + 1.15, + 1.15, + 1.15 + ] + } + }, + "textures": { + "particle": "#0" + } +} diff --git a/src/main/resources/defaults/resources/assets/astraweapons/models/animation/jab_2.json b/src/main/resources/defaults/resources/assets/astraweapons/models/animation/jab_2.json new file mode 100644 index 0000000..9060cb4 --- /dev/null +++ b/src/main/resources/defaults/resources/assets/astraweapons/models/animation/jab_2.json @@ -0,0 +1,76 @@ +{ + "parent": "astraweapons:item/iron_gauntlet_3d", + "display": { + "firstperson_righthand": { + "rotation": [ + -41.119017293312766, + 0, + -8 + ], + "translation": [ + 0.5, + 6.5, + -8.559508646656381 + ], + "scale": [ + 1, + 1, + 1 + ] + }, + "thirdperson_righthand": { + "rotation": [ + -107.11901729331277, + 90, + 0 + ], + "translation": [ + 0, + -3, + -9.809508646656381 + ], + "scale": [ + 1.15, + 1.15, + 1.15 + ] + }, + "firstperson_lefthand": { + "rotation": [ + -41.119017293312766, + 0, + -8 + ], + "translation": [ + -1.5, + 6.5, + -8.559508646656381 + ], + "scale": [ + 1, + 1, + 1 + ] + }, + "thirdperson_lefthand": { + "rotation": [ + -107.11901729331277, + -90, + 0 + ], + "translation": [ + 0, + -3, + -9.809508646656381 + ], + "scale": [ + 1.15, + 1.15, + 1.15 + ] + } + }, + "textures": { + "particle": "#0" + } +} diff --git a/src/main/resources/defaults/resources/assets/astraweapons/models/animation/jab_3.json b/src/main/resources/defaults/resources/assets/astraweapons/models/animation/jab_3.json new file mode 100644 index 0000000..31bc19d --- /dev/null +++ b/src/main/resources/defaults/resources/assets/astraweapons/models/animation/jab_3.json @@ -0,0 +1,76 @@ +{ + "parent": "astraweapons:item/iron_gauntlet_3d", + "display": { + "firstperson_righthand": { + "rotation": [ + -41.119017293312766, + 0, + -8 + ], + "translation": [ + 0.5, + 6.5, + -8.559508646656383 + ], + "scale": [ + 1, + 1, + 1 + ] + }, + "thirdperson_righthand": { + "rotation": [ + -107.11901729331277, + 90, + 0 + ], + "translation": [ + 0, + -3, + -9.809508646656383 + ], + "scale": [ + 1.15, + 1.15, + 1.15 + ] + }, + "firstperson_lefthand": { + "rotation": [ + -41.119017293312766, + 0, + -8 + ], + "translation": [ + -1.5, + 6.5, + -8.559508646656383 + ], + "scale": [ + 1, + 1, + 1 + ] + }, + "thirdperson_lefthand": { + "rotation": [ + -107.11901729331277, + -90, + 0 + ], + "translation": [ + 0, + -3, + -9.809508646656383 + ], + "scale": [ + 1.15, + 1.15, + 1.15 + ] + } + }, + "textures": { + "particle": "#0" + } +} diff --git a/src/main/resources/defaults/resources/assets/astraweapons/models/animation/jab_4.json b/src/main/resources/defaults/resources/assets/astraweapons/models/animation/jab_4.json new file mode 100644 index 0000000..81f68c8 --- /dev/null +++ b/src/main/resources/defaults/resources/assets/astraweapons/models/animation/jab_4.json @@ -0,0 +1,76 @@ +{ + "parent": "astraweapons:item/iron_gauntlet_3d", + "display": { + "firstperson_righthand": { + "rotation": [ + -34.58013454126452, + 0, + -8 + ], + "translation": [ + 0.5, + 6.5, + -5.290067270632259 + ], + "scale": [ + 1, + 1, + 1 + ] + }, + "thirdperson_righthand": { + "rotation": [ + -100.58013454126451, + 90, + 0 + ], + "translation": [ + 0, + -3, + -6.540067270632259 + ], + "scale": [ + 1.15, + 1.15, + 1.15 + ] + }, + "firstperson_lefthand": { + "rotation": [ + -34.58013454126452, + 0, + -8 + ], + "translation": [ + -1.5, + 6.5, + -5.290067270632259 + ], + "scale": [ + 1, + 1, + 1 + ] + }, + "thirdperson_lefthand": { + "rotation": [ + -100.58013454126451, + -90, + 0 + ], + "translation": [ + 0, + -3, + -6.540067270632259 + ], + "scale": [ + 1.15, + 1.15, + 1.15 + ] + } + }, + "textures": { + "particle": "#0" + } +} diff --git a/src/main/resources/defaults/resources/assets/astraweapons/models/animation/jab_5.json b/src/main/resources/defaults/resources/assets/astraweapons/models/animation/jab_5.json new file mode 100644 index 0000000..5574cc4 --- /dev/null +++ b/src/main/resources/defaults/resources/assets/astraweapons/models/animation/jab_5.json @@ -0,0 +1,76 @@ +{ + "parent": "astraweapons:item/iron_gauntlet_3d", + "display": { + "firstperson_righthand": { + "rotation": [ + -24.000000000000004, + 0, + -8 + ], + "translation": [ + 0.5, + 6.5, + -1.102182119232618e-15 + ], + "scale": [ + 1, + 1, + 1 + ] + }, + "thirdperson_righthand": { + "rotation": [ + -90.0, + 90, + 0 + ], + "translation": [ + 0, + -3, + -1.250000000000001 + ], + "scale": [ + 1.15, + 1.15, + 1.15 + ] + }, + "firstperson_lefthand": { + "rotation": [ + -24.000000000000004, + 0, + -8 + ], + "translation": [ + -1.5, + 6.5, + -1.102182119232618e-15 + ], + "scale": [ + 1, + 1, + 1 + ] + }, + "thirdperson_lefthand": { + "rotation": [ + -90.0, + -90, + 0 + ], + "translation": [ + 0, + -3, + -1.250000000000001 + ], + "scale": [ + 1.15, + 1.15, + 1.15 + ] + } + }, + "textures": { + "particle": "#0" + } +} diff --git a/src/main/resources/defaults/resources/assets/astraweapons/models/animation/lunge_0.json b/src/main/resources/defaults/resources/assets/astraweapons/models/animation/lunge_0.json new file mode 100644 index 0000000..013768e --- /dev/null +++ b/src/main/resources/defaults/resources/assets/astraweapons/models/animation/lunge_0.json @@ -0,0 +1,76 @@ +{ + "parent": "astraweapons:item/iron_gauntlet_3d", + "display": { + "firstperson_righthand": { + "rotation": [ + -24.0, + 0, + -8 + ], + "translation": [ + 0.5, + 6.5, + 0.0 + ], + "scale": [ + 1, + 1, + 1 + ] + }, + "thirdperson_righthand": { + "rotation": [ + -90.0, + 90, + 0 + ], + "translation": [ + 0, + -3.0, + -1.25 + ], + "scale": [ + 1.15, + 1.15, + 1.15 + ] + }, + "firstperson_lefthand": { + "rotation": [ + -24.0, + 0, + -8 + ], + "translation": [ + -1.5, + 6.5, + 0.0 + ], + "scale": [ + 1, + 1, + 1 + ] + }, + "thirdperson_lefthand": { + "rotation": [ + -90.0, + -90, + 0 + ], + "translation": [ + 0, + -3.0, + -1.25 + ], + "scale": [ + 1.15, + 1.15, + 1.15 + ] + } + }, + "textures": { + "particle": "#0" + } +} diff --git a/src/main/resources/defaults/resources/assets/astraweapons/models/animation/lunge_1.json b/src/main/resources/defaults/resources/assets/astraweapons/models/animation/lunge_1.json new file mode 100644 index 0000000..a6afc88 --- /dev/null +++ b/src/main/resources/defaults/resources/assets/astraweapons/models/animation/lunge_1.json @@ -0,0 +1,76 @@ +{ + "parent": "astraweapons:item/iron_gauntlet_3d", + "display": { + "firstperson_righthand": { + "rotation": [ + -41.633557568774194, + 0, + -8 + ], + "translation": [ + 0.5, + 5.324429495415053, + -7.641208279802151 + ], + "scale": [ + 1, + 1, + 1 + ] + }, + "thirdperson_righthand": { + "rotation": [ + -107.6335575687742, + 90, + 0 + ], + "translation": [ + 0, + -4.175570504584947, + -8.89120827980215 + ], + "scale": [ + 1.15, + 1.15, + 1.15 + ] + }, + "firstperson_lefthand": { + "rotation": [ + -41.633557568774194, + 0, + -8 + ], + "translation": [ + -1.5, + 5.324429495415053, + -7.641208279802151 + ], + "scale": [ + 1, + 1, + 1 + ] + }, + "thirdperson_lefthand": { + "rotation": [ + -107.6335575687742, + -90, + 0 + ], + "translation": [ + 0, + -4.175570504584947, + -8.89120827980215 + ], + "scale": [ + 1.15, + 1.15, + 1.15 + ] + } + }, + "textures": { + "particle": "#0" + } +} diff --git a/src/main/resources/defaults/resources/assets/astraweapons/models/animation/lunge_2.json b/src/main/resources/defaults/resources/assets/astraweapons/models/animation/lunge_2.json new file mode 100644 index 0000000..c5bf252 --- /dev/null +++ b/src/main/resources/defaults/resources/assets/astraweapons/models/animation/lunge_2.json @@ -0,0 +1,76 @@ +{ + "parent": "astraweapons:item/iron_gauntlet_3d", + "display": { + "firstperson_righthand": { + "rotation": [ + -52.53169548885461, + 0, + -8 + ], + "translation": [ + 0.5, + 4.597886967409693, + -12.363734711836996 + ], + "scale": [ + 1, + 1, + 1 + ] + }, + "thirdperson_righthand": { + "rotation": [ + -118.53169548885461, + 90, + 0 + ], + "translation": [ + 0, + -4.902113032590307, + -13.613734711836996 + ], + "scale": [ + 1.15, + 1.15, + 1.15 + ] + }, + "firstperson_lefthand": { + "rotation": [ + -52.53169548885461, + 0, + -8 + ], + "translation": [ + -1.5, + 4.597886967409693, + -12.363734711836996 + ], + "scale": [ + 1, + 1, + 1 + ] + }, + "thirdperson_lefthand": { + "rotation": [ + -118.53169548885461, + -90, + 0 + ], + "translation": [ + 0, + -4.902113032590307, + -13.613734711836996 + ], + "scale": [ + 1.15, + 1.15, + 1.15 + ] + } + }, + "textures": { + "particle": "#0" + } +} diff --git a/src/main/resources/defaults/resources/assets/astraweapons/models/animation/lunge_3.json b/src/main/resources/defaults/resources/assets/astraweapons/models/animation/lunge_3.json new file mode 100644 index 0000000..18c5d57 --- /dev/null +++ b/src/main/resources/defaults/resources/assets/astraweapons/models/animation/lunge_3.json @@ -0,0 +1,76 @@ +{ + "parent": "astraweapons:item/iron_gauntlet_3d", + "display": { + "firstperson_righthand": { + "rotation": [ + -52.53169548885461, + 0, + -8 + ], + "translation": [ + 0.5, + 4.597886967409693, + -12.363734711836997 + ], + "scale": [ + 1, + 1, + 1 + ] + }, + "thirdperson_righthand": { + "rotation": [ + -118.53169548885461, + 90, + 0 + ], + "translation": [ + 0, + -4.902113032590307, + -13.613734711836997 + ], + "scale": [ + 1.15, + 1.15, + 1.15 + ] + }, + "firstperson_lefthand": { + "rotation": [ + -52.53169548885461, + 0, + -8 + ], + "translation": [ + -1.5, + 4.597886967409693, + -12.363734711836997 + ], + "scale": [ + 1, + 1, + 1 + ] + }, + "thirdperson_lefthand": { + "rotation": [ + -118.53169548885461, + -90, + 0 + ], + "translation": [ + 0, + -4.902113032590307, + -13.613734711836997 + ], + "scale": [ + 1.15, + 1.15, + 1.15 + ] + } + }, + "textures": { + "particle": "#0" + } +} diff --git a/src/main/resources/defaults/resources/assets/astraweapons/models/animation/lunge_4.json b/src/main/resources/defaults/resources/assets/astraweapons/models/animation/lunge_4.json new file mode 100644 index 0000000..4dcb320 --- /dev/null +++ b/src/main/resources/defaults/resources/assets/astraweapons/models/animation/lunge_4.json @@ -0,0 +1,76 @@ +{ + "parent": "astraweapons:item/iron_gauntlet_3d", + "display": { + "firstperson_righthand": { + "rotation": [ + -41.633557568774194, + 0, + -8 + ], + "translation": [ + 0.5, + 5.324429495415053, + -7.641208279802152 + ], + "scale": [ + 1, + 1, + 1 + ] + }, + "thirdperson_righthand": { + "rotation": [ + -107.6335575687742, + 90, + 0 + ], + "translation": [ + 0, + -4.175570504584947, + -8.891208279802152 + ], + "scale": [ + 1.15, + 1.15, + 1.15 + ] + }, + "firstperson_lefthand": { + "rotation": [ + -41.633557568774194, + 0, + -8 + ], + "translation": [ + -1.5, + 5.324429495415053, + -7.641208279802152 + ], + "scale": [ + 1, + 1, + 1 + ] + }, + "thirdperson_lefthand": { + "rotation": [ + -107.6335575687742, + -90, + 0 + ], + "translation": [ + 0, + -4.175570504584947, + -8.891208279802152 + ], + "scale": [ + 1.15, + 1.15, + 1.15 + ] + } + }, + "textures": { + "particle": "#0" + } +} diff --git a/src/main/resources/defaults/resources/assets/astraweapons/models/animation/lunge_5.json b/src/main/resources/defaults/resources/assets/astraweapons/models/animation/lunge_5.json new file mode 100644 index 0000000..db2f989 --- /dev/null +++ b/src/main/resources/defaults/resources/assets/astraweapons/models/animation/lunge_5.json @@ -0,0 +1,76 @@ +{ + "parent": "astraweapons:item/iron_gauntlet_3d", + "display": { + "firstperson_righthand": { + "rotation": [ + -24.000000000000004, + 0, + -8 + ], + "translation": [ + 0.5, + 6.5, + -1.592040838891559e-15 + ], + "scale": [ + 1, + 1, + 1 + ] + }, + "thirdperson_righthand": { + "rotation": [ + -90.0, + 90, + 0 + ], + "translation": [ + 0, + -3.0000000000000004, + -1.2500000000000016 + ], + "scale": [ + 1.15, + 1.15, + 1.15 + ] + }, + "firstperson_lefthand": { + "rotation": [ + -24.000000000000004, + 0, + -8 + ], + "translation": [ + -1.5, + 6.5, + -1.592040838891559e-15 + ], + "scale": [ + 1, + 1, + 1 + ] + }, + "thirdperson_lefthand": { + "rotation": [ + -90.0, + -90, + 0 + ], + "translation": [ + 0, + -3.0000000000000004, + -1.2500000000000016 + ], + "scale": [ + 1.15, + 1.15, + 1.15 + ] + } + }, + "textures": { + "particle": "#0" + } +} diff --git a/src/main/resources/defaults/resources/assets/astraweapons/models/animation/twinblade_0.json b/src/main/resources/defaults/resources/assets/astraweapons/models/animation/twinblade_0.json new file mode 100644 index 0000000..4a82dfd --- /dev/null +++ b/src/main/resources/defaults/resources/assets/astraweapons/models/animation/twinblade_0.json @@ -0,0 +1,76 @@ +{ + "parent": "astraplus:item/netherite_twinblade", + "display": { + "firstperson_righthand": { + "rotation": [ + 0, + -105, + 40 + ], + "translation": [ + 1.13, + 3.2, + 1.13 + ], + "scale": [ + 2.72, + 2.72, + 0.68 + ] + }, + "thirdperson_righthand": { + "rotation": [ + 0, + -105, + 70 + ], + "translation": [ + 0.0, + 4.0, + 0.5 + ], + "scale": [ + 3.4, + 3.4, + 0.85 + ] + }, + "firstperson_lefthand": { + "rotation": [ + 0, + 105, + -40 + ], + "translation": [ + 1.13, + 3.2, + 1.13 + ], + "scale": [ + 2.72, + 2.72, + 0.68 + ] + }, + "thirdperson_lefthand": { + "rotation": [ + 0, + 105, + -70 + ], + "translation": [ + 0.0, + 4.0, + 0.5 + ], + "scale": [ + 3.4, + 3.4, + 0.85 + ] + } + }, + "textures": { + "particle": "#layer0" + } +} diff --git a/src/main/resources/defaults/resources/assets/astraweapons/models/animation/twinblade_1.json b/src/main/resources/defaults/resources/assets/astraweapons/models/animation/twinblade_1.json new file mode 100644 index 0000000..347767a --- /dev/null +++ b/src/main/resources/defaults/resources/assets/astraweapons/models/animation/twinblade_1.json @@ -0,0 +1,76 @@ +{ + "parent": "astraplus:item/netherite_twinblade", + "display": { + "firstperson_righthand": { + "rotation": [ + 0, + -130, + 55 + ], + "translation": [ + -2.396711513754839, + 3.7877852522924735, + -0.04557050458494638 + ], + "scale": [ + 2.72, + 2.72, + 0.68 + ] + }, + "thirdperson_righthand": { + "rotation": [ + 0, + -130, + 85 + ], + "translation": [ + -3.526711513754839, + 4.587785252292473, + -0.6755705045849463 + ], + "scale": [ + 3.4, + 3.4, + 0.85 + ] + }, + "firstperson_lefthand": { + "rotation": [ + 0, + 130, + -55 + ], + "translation": [ + 4.656711513754839, + 3.7877852522924735, + -0.04557050458494638 + ], + "scale": [ + 2.72, + 2.72, + 0.68 + ] + }, + "thirdperson_lefthand": { + "rotation": [ + 0, + 130, + -85 + ], + "translation": [ + 3.526711513754839, + 4.587785252292473, + -0.6755705045849463 + ], + "scale": [ + 3.4, + 3.4, + 0.85 + ] + } + }, + "textures": { + "particle": "#layer0" + } +} diff --git a/src/main/resources/defaults/resources/assets/astraweapons/models/animation/twinblade_2.json b/src/main/resources/defaults/resources/assets/astraweapons/models/animation/twinblade_2.json new file mode 100644 index 0000000..15bbcc5 --- /dev/null +++ b/src/main/resources/defaults/resources/assets/astraweapons/models/animation/twinblade_2.json @@ -0,0 +1,76 @@ +{ + "parent": "astraplus:item/netherite_twinblade", + "display": { + "firstperson_righthand": { + "rotation": [ + 0, + -90, + 35 + ], + "translation": [ + -4.576339097770921, + 4.151056516295154, + -0.7721130325903072 + ], + "scale": [ + 2.72, + 2.72, + 0.68 + ] + }, + "thirdperson_righthand": { + "rotation": [ + 0, + -90, + 65 + ], + "translation": [ + -5.706339097770921, + 4.951056516295154, + -1.402113032590307 + ], + "scale": [ + 3.4, + 3.4, + 0.85 + ] + }, + "firstperson_lefthand": { + "rotation": [ + 0, + 90, + -35 + ], + "translation": [ + 6.836339097770921, + 4.151056516295154, + -0.7721130325903072 + ], + "scale": [ + 2.72, + 2.72, + 0.68 + ] + }, + "thirdperson_lefthand": { + "rotation": [ + 0, + 90, + -65 + ], + "translation": [ + 5.706339097770921, + 4.951056516295154, + -1.402113032590307 + ], + "scale": [ + 3.4, + 3.4, + 0.85 + ] + } + }, + "textures": { + "particle": "#layer0" + } +} diff --git a/src/main/resources/defaults/resources/assets/astraweapons/models/animation/twinblade_3.json b/src/main/resources/defaults/resources/assets/astraweapons/models/animation/twinblade_3.json new file mode 100644 index 0000000..ea7c48f --- /dev/null +++ b/src/main/resources/defaults/resources/assets/astraweapons/models/animation/twinblade_3.json @@ -0,0 +1,76 @@ +{ + "parent": "astraplus:item/netherite_twinblade", + "display": { + "firstperson_righthand": { + "rotation": [ + 0, + -35, + -5 + ], + "translation": [ + -4.576339097770922, + 4.151056516295154, + -0.7721130325903074 + ], + "scale": [ + 2.72, + 2.72, + 0.68 + ] + }, + "thirdperson_righthand": { + "rotation": [ + 0, + -35, + 25 + ], + "translation": [ + -5.706339097770922, + 4.951056516295154, + -1.4021130325903073 + ], + "scale": [ + 3.4, + 3.4, + 0.85 + ] + }, + "firstperson_lefthand": { + "rotation": [ + 0, + 35, + 5 + ], + "translation": [ + 6.836339097770922, + 4.151056516295154, + -0.7721130325903074 + ], + "scale": [ + 2.72, + 2.72, + 0.68 + ] + }, + "thirdperson_lefthand": { + "rotation": [ + 0, + 35, + -25 + ], + "translation": [ + 5.706339097770922, + 4.951056516295154, + -1.4021130325903073 + ], + "scale": [ + 3.4, + 3.4, + 0.85 + ] + } + }, + "textures": { + "particle": "#layer0" + } +} diff --git a/src/main/resources/defaults/resources/assets/astraweapons/models/animation/twinblade_4.json b/src/main/resources/defaults/resources/assets/astraweapons/models/animation/twinblade_4.json new file mode 100644 index 0000000..0d65154 --- /dev/null +++ b/src/main/resources/defaults/resources/assets/astraweapons/models/animation/twinblade_4.json @@ -0,0 +1,76 @@ +{ + "parent": "astraplus:item/netherite_twinblade", + "display": { + "firstperson_righthand": { + "rotation": [ + 0, + 0, + -35 + ], + "translation": [ + -2.3967115137548394, + 3.7877852522924735, + -0.0455705045849466 + ], + "scale": [ + 2.72, + 2.72, + 0.68 + ] + }, + "thirdperson_righthand": { + "rotation": [ + 0, + 0, + -5 + ], + "translation": [ + -3.5267115137548393, + 4.587785252292473, + -0.6755705045849465 + ], + "scale": [ + 3.4, + 3.4, + 0.85 + ] + }, + "firstperson_lefthand": { + "rotation": [ + 0, + 0, + 35 + ], + "translation": [ + 4.656711513754839, + 3.7877852522924735, + -0.0455705045849466 + ], + "scale": [ + 2.72, + 2.72, + 0.68 + ] + }, + "thirdperson_lefthand": { + "rotation": [ + 0, + 0, + 5 + ], + "translation": [ + 3.5267115137548393, + 4.587785252292473, + -0.6755705045849465 + ], + "scale": [ + 3.4, + 3.4, + 0.85 + ] + } + }, + "textures": { + "particle": "#layer0" + } +} diff --git a/src/main/resources/defaults/resources/assets/astraweapons/models/animation/twinblade_5.json b/src/main/resources/defaults/resources/assets/astraweapons/models/animation/twinblade_5.json new file mode 100644 index 0000000..6f9f480 --- /dev/null +++ b/src/main/resources/defaults/resources/assets/astraweapons/models/animation/twinblade_5.json @@ -0,0 +1,76 @@ +{ + "parent": "astraplus:item/netherite_twinblade", + "display": { + "firstperson_righthand": { + "rotation": [ + 0, + -70, + 10 + ], + "translation": [ + 1.1299999999999992, + 3.2, + 1.1299999999999997 + ], + "scale": [ + 2.72, + 2.72, + 0.68 + ] + }, + "thirdperson_righthand": { + "rotation": [ + 0, + -70, + 40 + ], + "translation": [ + -7.347880794884119e-16, + 4.0, + 0.4999999999999998 + ], + "scale": [ + 3.4, + 3.4, + 0.85 + ] + }, + "firstperson_lefthand": { + "rotation": [ + 0, + 70, + -10 + ], + "translation": [ + 1.1300000000000006, + 3.2, + 1.1299999999999997 + ], + "scale": [ + 2.72, + 2.72, + 0.68 + ] + }, + "thirdperson_lefthand": { + "rotation": [ + 0, + 70, + -40 + ], + "translation": [ + 7.347880794884119e-16, + 4.0, + 0.4999999999999998 + ], + "scale": [ + 3.4, + 3.4, + 0.85 + ] + } + }, + "textures": { + "particle": "#layer0" + } +} diff --git a/src/main/resources/defaults/resources/assets/astraweapons/models/animation/uppercut_0.json b/src/main/resources/defaults/resources/assets/astraweapons/models/animation/uppercut_0.json new file mode 100644 index 0000000..013768e --- /dev/null +++ b/src/main/resources/defaults/resources/assets/astraweapons/models/animation/uppercut_0.json @@ -0,0 +1,76 @@ +{ + "parent": "astraweapons:item/iron_gauntlet_3d", + "display": { + "firstperson_righthand": { + "rotation": [ + -24.0, + 0, + -8 + ], + "translation": [ + 0.5, + 6.5, + 0.0 + ], + "scale": [ + 1, + 1, + 1 + ] + }, + "thirdperson_righthand": { + "rotation": [ + -90.0, + 90, + 0 + ], + "translation": [ + 0, + -3.0, + -1.25 + ], + "scale": [ + 1.15, + 1.15, + 1.15 + ] + }, + "firstperson_lefthand": { + "rotation": [ + -24.0, + 0, + -8 + ], + "translation": [ + -1.5, + 6.5, + 0.0 + ], + "scale": [ + 1, + 1, + 1 + ] + }, + "thirdperson_lefthand": { + "rotation": [ + -90.0, + -90, + 0 + ], + "translation": [ + 0, + -3.0, + -1.25 + ], + "scale": [ + 1.15, + 1.15, + 1.15 + ] + } + }, + "textures": { + "particle": "#0" + } +} diff --git a/src/main/resources/defaults/resources/assets/astraweapons/models/animation/uppercut_1.json b/src/main/resources/defaults/resources/assets/astraweapons/models/animation/uppercut_1.json new file mode 100644 index 0000000..529d5cd --- /dev/null +++ b/src/main/resources/defaults/resources/assets/astraweapons/models/animation/uppercut_1.json @@ -0,0 +1,76 @@ +{ + "parent": "astraweapons:item/iron_gauntlet_3d", + "display": { + "firstperson_righthand": { + "rotation": [ + -44.572483830236564, + 0, + -8 + ], + "translation": [ + 0.5, + 8.557248383023655, + -3.526711513754839 + ], + "scale": [ + 1, + 1, + 1 + ] + }, + "thirdperson_righthand": { + "rotation": [ + -110.57248383023656, + 90, + 0 + ], + "translation": [ + 0, + -0.9427516169763441, + -4.776711513754838 + ], + "scale": [ + 1.15, + 1.15, + 1.15 + ] + }, + "firstperson_lefthand": { + "rotation": [ + -44.572483830236564, + 0, + -8 + ], + "translation": [ + -1.5, + 8.557248383023655, + -3.526711513754839 + ], + "scale": [ + 1, + 1, + 1 + ] + }, + "thirdperson_lefthand": { + "rotation": [ + -110.57248383023656, + -90, + 0 + ], + "translation": [ + 0, + -0.9427516169763441, + -4.776711513754838 + ], + "scale": [ + 1.15, + 1.15, + 1.15 + ] + } + }, + "textures": { + "particle": "#0" + } +} diff --git a/src/main/resources/defaults/resources/assets/astraweapons/models/animation/uppercut_2.json b/src/main/resources/defaults/resources/assets/astraweapons/models/animation/uppercut_2.json new file mode 100644 index 0000000..0ddd56d --- /dev/null +++ b/src/main/resources/defaults/resources/assets/astraweapons/models/animation/uppercut_2.json @@ -0,0 +1,76 @@ +{ + "parent": "astraweapons:item/iron_gauntlet_3d", + "display": { + "firstperson_righthand": { + "rotation": [ + -57.28697807033037, + 0, + -8 + ], + "translation": [ + 0.5, + 9.828697807033038, + -5.706339097770921 + ], + "scale": [ + 1, + 1, + 1 + ] + }, + "thirdperson_righthand": { + "rotation": [ + -123.28697807033038, + 90, + 0 + ], + "translation": [ + 0, + 0.3286978070330373, + -6.956339097770921 + ], + "scale": [ + 1.15, + 1.15, + 1.15 + ] + }, + "firstperson_lefthand": { + "rotation": [ + -57.28697807033037, + 0, + -8 + ], + "translation": [ + -1.5, + 9.828697807033038, + -5.706339097770921 + ], + "scale": [ + 1, + 1, + 1 + ] + }, + "thirdperson_lefthand": { + "rotation": [ + -123.28697807033038, + -90, + 0 + ], + "translation": [ + 0, + 0.3286978070330373, + -6.956339097770921 + ], + "scale": [ + 1.15, + 1.15, + 1.15 + ] + } + }, + "textures": { + "particle": "#0" + } +} diff --git a/src/main/resources/defaults/resources/assets/astraweapons/models/animation/uppercut_3.json b/src/main/resources/defaults/resources/assets/astraweapons/models/animation/uppercut_3.json new file mode 100644 index 0000000..606f357 --- /dev/null +++ b/src/main/resources/defaults/resources/assets/astraweapons/models/animation/uppercut_3.json @@ -0,0 +1,76 @@ +{ + "parent": "astraweapons:item/iron_gauntlet_3d", + "display": { + "firstperson_righthand": { + "rotation": [ + -57.28697807033038, + 0, + -8 + ], + "translation": [ + 0.5, + 9.828697807033038, + -5.706339097770922 + ], + "scale": [ + 1, + 1, + 1 + ] + }, + "thirdperson_righthand": { + "rotation": [ + -123.28697807033038, + 90, + 0 + ], + "translation": [ + 0, + 0.32869780703303775, + -6.956339097770922 + ], + "scale": [ + 1.15, + 1.15, + 1.15 + ] + }, + "firstperson_lefthand": { + "rotation": [ + -57.28697807033038, + 0, + -8 + ], + "translation": [ + -1.5, + 9.828697807033038, + -5.706339097770922 + ], + "scale": [ + 1, + 1, + 1 + ] + }, + "thirdperson_lefthand": { + "rotation": [ + -123.28697807033038, + -90, + 0 + ], + "translation": [ + 0, + 0.32869780703303775, + -6.956339097770922 + ], + "scale": [ + 1.15, + 1.15, + 1.15 + ] + } + }, + "textures": { + "particle": "#0" + } +} diff --git a/src/main/resources/defaults/resources/assets/astraweapons/models/animation/uppercut_4.json b/src/main/resources/defaults/resources/assets/astraweapons/models/animation/uppercut_4.json new file mode 100644 index 0000000..0a01a6b --- /dev/null +++ b/src/main/resources/defaults/resources/assets/astraweapons/models/animation/uppercut_4.json @@ -0,0 +1,76 @@ +{ + "parent": "astraweapons:item/iron_gauntlet_3d", + "display": { + "firstperson_righthand": { + "rotation": [ + -44.572483830236564, + 0, + -8 + ], + "translation": [ + 0.5, + 8.557248383023657, + -3.5267115137548393 + ], + "scale": [ + 1, + 1, + 1 + ] + }, + "thirdperson_righthand": { + "rotation": [ + -110.57248383023656, + 90, + 0 + ], + "translation": [ + 0, + -0.9427516169763437, + -4.776711513754839 + ], + "scale": [ + 1.15, + 1.15, + 1.15 + ] + }, + "firstperson_lefthand": { + "rotation": [ + -44.572483830236564, + 0, + -8 + ], + "translation": [ + -1.5, + 8.557248383023657, + -3.5267115137548393 + ], + "scale": [ + 1, + 1, + 1 + ] + }, + "thirdperson_lefthand": { + "rotation": [ + -110.57248383023656, + -90, + 0 + ], + "translation": [ + 0, + -0.9427516169763437, + -4.776711513754839 + ], + "scale": [ + 1.15, + 1.15, + 1.15 + ] + } + }, + "textures": { + "particle": "#0" + } +} diff --git a/src/main/resources/defaults/resources/assets/astraweapons/models/animation/uppercut_5.json b/src/main/resources/defaults/resources/assets/astraweapons/models/animation/uppercut_5.json new file mode 100644 index 0000000..c64c23f --- /dev/null +++ b/src/main/resources/defaults/resources/assets/astraweapons/models/animation/uppercut_5.json @@ -0,0 +1,76 @@ +{ + "parent": "astraweapons:item/iron_gauntlet_3d", + "display": { + "firstperson_righthand": { + "rotation": [ + -24.000000000000004, + 0, + -8 + ], + "translation": [ + 0.5, + 6.5, + -7.347880794884119e-16 + ], + "scale": [ + 1, + 1, + 1 + ] + }, + "thirdperson_righthand": { + "rotation": [ + -90.0, + 90, + 0 + ], + "translation": [ + 0, + -2.9999999999999996, + -1.2500000000000007 + ], + "scale": [ + 1.15, + 1.15, + 1.15 + ] + }, + "firstperson_lefthand": { + "rotation": [ + -24.000000000000004, + 0, + -8 + ], + "translation": [ + -1.5, + 6.5, + -7.347880794884119e-16 + ], + "scale": [ + 1, + 1, + 1 + ] + }, + "thirdperson_lefthand": { + "rotation": [ + -90.0, + -90, + 0 + ], + "translation": [ + 0, + -2.9999999999999996, + -1.2500000000000007 + ], + "scale": [ + 1.15, + 1.15, + 1.15 + ] + } + }, + "textures": { + "particle": "#0" + } +} diff --git a/src/main/resources/defaults/resources/assets/astraweapons/models/effect/slash.json b/src/main/resources/defaults/resources/assets/astraweapons/models/effect/slash.json new file mode 100644 index 0000000..e2ffaef --- /dev/null +++ b/src/main/resources/defaults/resources/assets/astraweapons/models/effect/slash.json @@ -0,0 +1,42 @@ +{ + "textures": { + "slash": "astraweapons:item/slash", + "particle": "astraweapons:item/slash" + }, + "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 + } + } + } + ] +} diff --git a/src/main/resources/defaults/resources/assets/astraweapons/models/effect/slash_fire.json b/src/main/resources/defaults/resources/assets/astraweapons/models/effect/slash_fire.json new file mode 100644 index 0000000..04ef087 --- /dev/null +++ b/src/main/resources/defaults/resources/assets/astraweapons/models/effect/slash_fire.json @@ -0,0 +1,42 @@ +{ + "textures": { + "slash": "astraweapons:item/slash_fire", + "particle": "astraweapons:item/slash_fire" + }, + "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 + } + } + } + ] +} diff --git a/src/main/resources/defaults/resources/assets/astraweapons/models/item/iron_gauntlet_2d.json b/src/main/resources/defaults/resources/assets/astraweapons/models/item/iron_gauntlet_2d.json new file mode 100644 index 0000000..a850751 --- /dev/null +++ b/src/main/resources/defaults/resources/assets/astraweapons/models/item/iron_gauntlet_2d.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "astraweapons:item/iron_gauntlet" + } +} \ No newline at end of file diff --git a/src/main/resources/defaults/resources/assets/astraweapons/models/item/iron_gauntlet_3d.json b/src/main/resources/defaults/resources/assets/astraweapons/models/item/iron_gauntlet_3d.json new file mode 100644 index 0000000..83b12d9 --- /dev/null +++ b/src/main/resources/defaults/resources/assets/astraweapons/models/item/iron_gauntlet_3d.json @@ -0,0 +1,88 @@ +{ + "textures": { + "0": "astraweapons:item/iron_gauntlet_3d_1", + "1": "astraweapons:item/iron_gauntlet_3d_2" + }, + "elements": [ + { + "from": [5, 1, 6], + "to": [5.01, 7, 10], + "faces": { + "north": {"uv": [0, 0, 0, 7], "texture": "#1"}, + "east": {"uv": [0, 0, 4, 7], "texture": "#1"}, + "south": {"uv": [0, 0, 0, 7], "texture": "#1"}, + "west": {"uv": [4, 0, 8, 6], "texture": "#1"}, + "up": {"uv": [0, 4, 0, 0], "texture": "#1"}, + "down": {"uv": [0, 0, 0, 4], "texture": "#1"} + } + }, + { + "from": [9, 1, 6], + "to": [9.01, 7, 10], + "faces": { + "north": {"uv": [0, 0, 0.01, 6], "texture": "#1"}, + "east": {"uv": [0, 0, 4, 6], "texture": "#1"}, + "south": {"uv": [0, 0, 0.01, 6], "texture": "#1"}, + "west": {"uv": [0, 0, 4, 6], "texture": "#1"}, + "up": {"uv": [0, 0, 0.01, 4], "texture": "#1"}, + "down": {"uv": [0, 0, 0.01, 4], "texture": "#1"} + } + }, + { + "from": [5, 1, 6], + "to": [9, 7, 6.01], + "faces": { + "north": {"uv": [0, 0, 4, 6], "texture": "#1"}, + "east": {"uv": [0, 0, 0.01, 6], "texture": "#1"}, + "south": {"uv": [0, 0, 4, 6], "texture": "#1"}, + "west": {"uv": [0, 0, 0.01, 6], "texture": "#1"}, + "up": {"uv": [0, 0, 0.01, 4], "rotation": 270, "texture": "#1"}, + "down": {"uv": [0, 0, 0.01, 4], "rotation": 90, "texture": "#1"} + } + }, + { + "from": [5, 1, 9.99], + "to": [9, 7, 10], + "faces": { + "north": {"uv": [0, 0, 4, 6], "texture": "#1"}, + "east": {"uv": [0, 0, 0.01, 6], "texture": "#1"}, + "south": {"uv": [0, 0, 4, 6], "texture": "#1"}, + "west": {"uv": [0, 0, 0.01, 6], "texture": "#1"}, + "up": {"uv": [0, 0, 0.01, 4], "rotation": 90, "texture": "#1"}, + "down": {"uv": [0, 0, 0.01, 4], "rotation": 270, "texture": "#1"} + } + }, + { + "from": [5, 6.99, 6], + "to": [9, 7, 10], + "faces": { + "north": {"uv": [0, 0, 4, 0], "rotation": 180, "texture": "#0"}, + "east": {"uv": [0, 0, 4, 0], "rotation": 180, "texture": "#0"}, + "south": {"uv": [0, 0, 4, 0], "rotation": 180, "texture": "#0"}, + "west": {"uv": [0, 0, 4, 0], "rotation": 180, "texture": "#0"}, + "up": {"uv": [4, 4, 0, 8], "rotation": 180, "texture": "#0"}, + "down": {"uv": [4, 4, 0, 0], "rotation": 180, "texture": "#0"} + } + } + ], + "display": { + "thirdperson_righthand": { + "rotation": [-90, 90, 0], + "translation": [0, -3, -1.25], + "scale": [1.15, 1.15, 1.15] + }, + "thirdperson_lefthand": { + "rotation": [-90, -90, 0], + "translation": [0, -3, -1.25], + "scale": [1.15, 1.15, 1.15] + }, + "firstperson_righthand": { + "rotation": [-24, 0, -8], + "translation": [0.5, 6.5, 0] + }, + "firstperson_lefthand": { + "rotation": [-24, 0, -8], + "translation": [-1.5, 6.5, 0] + } + } +} \ No newline at end of file diff --git a/src/main/resources/defaults/resources/assets/astraweapons/sounds.json b/src/main/resources/defaults/resources/assets/astraweapons/sounds.json new file mode 100644 index 0000000..02648f2 --- /dev/null +++ b/src/main/resources/defaults/resources/assets/astraweapons/sounds.json @@ -0,0 +1,65 @@ +{ + "gauntlets.hit_light": { + "sounds": [ + "astraweapons:gauntlets/sfx_item_gauntletshitimpactlight-001_soundwave", + "astraweapons:gauntlets/sfx_item_gauntletshitimpactlight-002_soundwave", + "astraweapons:gauntlets/sfx_item_gauntletshitimpactlight-003_soundwave", + "astraweapons:gauntlets/sfx_item_gauntletshitimpactlight-004_soundwave" + ], + "subtitle": "subtitles.astraweapons.gauntlets.hit_light" + }, + "gauntlets.hit_medium": { + "sounds": [ + "astraweapons:gauntlets/sfx_item_gauntletshitimpactmedium-001_soundwave", + "astraweapons:gauntlets/sfx_item_gauntletshitimpactmedium-002_soundwave", + "astraweapons:gauntlets/sfx_item_gauntletshitimpactmedium-003_soundwave" + ], + "subtitle": "subtitles.astraweapons.gauntlets.hit_medium" + }, + "gauntlets.hit_kick": { + "sounds": [ + "astraweapons:gauntlets/sfx_item_gauntletshitimpactkick-001_soundwave", + "astraweapons:gauntlets/sfx_item_gauntletshitimpactkick-002_soundwave", + "astraweapons:gauntlets/sfx_item_gauntletshitimpactkick-003_soundwave" + ], + "subtitle": "subtitles.astraweapons.gauntlets.hit_kick" + }, + "gauntlets.hit_punch": { + "sounds": [ + "astraweapons:gauntlets/sfx_item_gauntletshitimpactpunch-001_soundwave", + "astraweapons:gauntlets/sfx_item_gauntletshitimpactpunch-002_soundwave", + "astraweapons:gauntlets/sfx_item_gauntletshitimpactpunch-003_soundwave" + ], + "subtitle": "subtitles.astraweapons.gauntlets.hit_punch" + }, + "gauntlets.swing_short": { + "sounds": [ + "astraweapons:gauntlets/sfx_item_gauntletsswingshort-001_soundwave", + "astraweapons:gauntlets/sfx_item_gauntletsswingshort-002_soundwave", + "astraweapons:gauntlets/sfx_item_gauntletsswingshort-003_soundwave", + "astraweapons:gauntlets/sfx_item_gauntletsswingshort-004_soundwave" + ], + "subtitle": "subtitles.astraweapons.gauntlets.swing_short" + }, + "gauntlets.swing_medium": { + "sounds": [ + "astraweapons:gauntlets/sfx_item_gauntletsswingmedium-001_soundwave", + "astraweapons:gauntlets/sfx_item_gauntletsswingmedium-002_soundwave", + "astraweapons:gauntlets/sfx_item_gauntletsswingmedium-003_soundwave" + ], + "subtitle": "subtitles.astraweapons.gauntlets.swing_medium" + }, + "gauntlets.swing_kick": { + "sounds": [ + "astraweapons:gauntlets/sfx_item_gauntletsswingkick-001_soundwave" + ], + "subtitle": "subtitles.astraweapons.gauntlets.swing_kick" + }, + "gauntlets.swing_scream": { + "sounds": [ + "astraweapons:gauntlets/sfx_item_gauntletsswingscream-001_soundwave", + "astraweapons:gauntlets/sfx_item_gauntletsswingscream-002_soundwave" + ], + "subtitle": "subtitles.astraweapons.gauntlets.swing_scream" + } +} diff --git a/src/main/resources/defaults/resources/assets/astraweapons/sounds/gauntlets/sfx_item_gauntletshitimpactkick-001_soundwave.ogg b/src/main/resources/defaults/resources/assets/astraweapons/sounds/gauntlets/sfx_item_gauntletshitimpactkick-001_soundwave.ogg new file mode 100644 index 0000000..9860762 Binary files /dev/null and b/src/main/resources/defaults/resources/assets/astraweapons/sounds/gauntlets/sfx_item_gauntletshitimpactkick-001_soundwave.ogg differ diff --git a/src/main/resources/defaults/resources/assets/astraweapons/sounds/gauntlets/sfx_item_gauntletshitimpactkick-002_soundwave.ogg b/src/main/resources/defaults/resources/assets/astraweapons/sounds/gauntlets/sfx_item_gauntletshitimpactkick-002_soundwave.ogg new file mode 100644 index 0000000..267bb7b Binary files /dev/null and b/src/main/resources/defaults/resources/assets/astraweapons/sounds/gauntlets/sfx_item_gauntletshitimpactkick-002_soundwave.ogg differ diff --git a/src/main/resources/defaults/resources/assets/astraweapons/sounds/gauntlets/sfx_item_gauntletshitimpactkick-003_soundwave.ogg b/src/main/resources/defaults/resources/assets/astraweapons/sounds/gauntlets/sfx_item_gauntletshitimpactkick-003_soundwave.ogg new file mode 100644 index 0000000..761877e Binary files /dev/null and b/src/main/resources/defaults/resources/assets/astraweapons/sounds/gauntlets/sfx_item_gauntletshitimpactkick-003_soundwave.ogg differ diff --git a/src/main/resources/defaults/resources/assets/astraweapons/sounds/gauntlets/sfx_item_gauntletshitimpactlight-001_soundwave.ogg b/src/main/resources/defaults/resources/assets/astraweapons/sounds/gauntlets/sfx_item_gauntletshitimpactlight-001_soundwave.ogg new file mode 100644 index 0000000..70965c0 Binary files /dev/null and b/src/main/resources/defaults/resources/assets/astraweapons/sounds/gauntlets/sfx_item_gauntletshitimpactlight-001_soundwave.ogg differ diff --git a/src/main/resources/defaults/resources/assets/astraweapons/sounds/gauntlets/sfx_item_gauntletshitimpactlight-002_soundwave.ogg b/src/main/resources/defaults/resources/assets/astraweapons/sounds/gauntlets/sfx_item_gauntletshitimpactlight-002_soundwave.ogg new file mode 100644 index 0000000..39005eb Binary files /dev/null and b/src/main/resources/defaults/resources/assets/astraweapons/sounds/gauntlets/sfx_item_gauntletshitimpactlight-002_soundwave.ogg differ diff --git a/src/main/resources/defaults/resources/assets/astraweapons/sounds/gauntlets/sfx_item_gauntletshitimpactlight-003_soundwave.ogg b/src/main/resources/defaults/resources/assets/astraweapons/sounds/gauntlets/sfx_item_gauntletshitimpactlight-003_soundwave.ogg new file mode 100644 index 0000000..590f17e Binary files /dev/null and b/src/main/resources/defaults/resources/assets/astraweapons/sounds/gauntlets/sfx_item_gauntletshitimpactlight-003_soundwave.ogg differ diff --git a/src/main/resources/defaults/resources/assets/astraweapons/sounds/gauntlets/sfx_item_gauntletshitimpactlight-004_soundwave.ogg b/src/main/resources/defaults/resources/assets/astraweapons/sounds/gauntlets/sfx_item_gauntletshitimpactlight-004_soundwave.ogg new file mode 100644 index 0000000..478590a Binary files /dev/null and b/src/main/resources/defaults/resources/assets/astraweapons/sounds/gauntlets/sfx_item_gauntletshitimpactlight-004_soundwave.ogg differ diff --git a/src/main/resources/defaults/resources/assets/astraweapons/sounds/gauntlets/sfx_item_gauntletshitimpactmedium-001_soundwave.ogg b/src/main/resources/defaults/resources/assets/astraweapons/sounds/gauntlets/sfx_item_gauntletshitimpactmedium-001_soundwave.ogg new file mode 100644 index 0000000..61e4572 Binary files /dev/null and b/src/main/resources/defaults/resources/assets/astraweapons/sounds/gauntlets/sfx_item_gauntletshitimpactmedium-001_soundwave.ogg differ diff --git a/src/main/resources/defaults/resources/assets/astraweapons/sounds/gauntlets/sfx_item_gauntletshitimpactmedium-002_soundwave.ogg b/src/main/resources/defaults/resources/assets/astraweapons/sounds/gauntlets/sfx_item_gauntletshitimpactmedium-002_soundwave.ogg new file mode 100644 index 0000000..635d1b3 Binary files /dev/null and b/src/main/resources/defaults/resources/assets/astraweapons/sounds/gauntlets/sfx_item_gauntletshitimpactmedium-002_soundwave.ogg differ diff --git a/src/main/resources/defaults/resources/assets/astraweapons/sounds/gauntlets/sfx_item_gauntletshitimpactmedium-003_soundwave.ogg b/src/main/resources/defaults/resources/assets/astraweapons/sounds/gauntlets/sfx_item_gauntletshitimpactmedium-003_soundwave.ogg new file mode 100644 index 0000000..927da38 Binary files /dev/null and b/src/main/resources/defaults/resources/assets/astraweapons/sounds/gauntlets/sfx_item_gauntletshitimpactmedium-003_soundwave.ogg differ diff --git a/src/main/resources/defaults/resources/assets/astraweapons/sounds/gauntlets/sfx_item_gauntletshitimpactpunch-001_soundwave.ogg b/src/main/resources/defaults/resources/assets/astraweapons/sounds/gauntlets/sfx_item_gauntletshitimpactpunch-001_soundwave.ogg new file mode 100644 index 0000000..8c88368 Binary files /dev/null and b/src/main/resources/defaults/resources/assets/astraweapons/sounds/gauntlets/sfx_item_gauntletshitimpactpunch-001_soundwave.ogg differ diff --git a/src/main/resources/defaults/resources/assets/astraweapons/sounds/gauntlets/sfx_item_gauntletshitimpactpunch-002_soundwave.ogg b/src/main/resources/defaults/resources/assets/astraweapons/sounds/gauntlets/sfx_item_gauntletshitimpactpunch-002_soundwave.ogg new file mode 100644 index 0000000..6677f80 Binary files /dev/null and b/src/main/resources/defaults/resources/assets/astraweapons/sounds/gauntlets/sfx_item_gauntletshitimpactpunch-002_soundwave.ogg differ diff --git a/src/main/resources/defaults/resources/assets/astraweapons/sounds/gauntlets/sfx_item_gauntletshitimpactpunch-003_soundwave.ogg b/src/main/resources/defaults/resources/assets/astraweapons/sounds/gauntlets/sfx_item_gauntletshitimpactpunch-003_soundwave.ogg new file mode 100644 index 0000000..d9fb3c3 Binary files /dev/null and b/src/main/resources/defaults/resources/assets/astraweapons/sounds/gauntlets/sfx_item_gauntletshitimpactpunch-003_soundwave.ogg differ diff --git a/src/main/resources/defaults/resources/assets/astraweapons/sounds/gauntlets/sfx_item_gauntletsswingkick-001_soundwave.ogg b/src/main/resources/defaults/resources/assets/astraweapons/sounds/gauntlets/sfx_item_gauntletsswingkick-001_soundwave.ogg new file mode 100644 index 0000000..108efbd Binary files /dev/null and b/src/main/resources/defaults/resources/assets/astraweapons/sounds/gauntlets/sfx_item_gauntletsswingkick-001_soundwave.ogg differ diff --git a/src/main/resources/defaults/resources/assets/astraweapons/sounds/gauntlets/sfx_item_gauntletsswingmedium-001_soundwave.ogg b/src/main/resources/defaults/resources/assets/astraweapons/sounds/gauntlets/sfx_item_gauntletsswingmedium-001_soundwave.ogg new file mode 100644 index 0000000..b649ce1 Binary files /dev/null and b/src/main/resources/defaults/resources/assets/astraweapons/sounds/gauntlets/sfx_item_gauntletsswingmedium-001_soundwave.ogg differ diff --git a/src/main/resources/defaults/resources/assets/astraweapons/sounds/gauntlets/sfx_item_gauntletsswingmedium-002_soundwave.ogg b/src/main/resources/defaults/resources/assets/astraweapons/sounds/gauntlets/sfx_item_gauntletsswingmedium-002_soundwave.ogg new file mode 100644 index 0000000..054b600 Binary files /dev/null and b/src/main/resources/defaults/resources/assets/astraweapons/sounds/gauntlets/sfx_item_gauntletsswingmedium-002_soundwave.ogg differ diff --git a/src/main/resources/defaults/resources/assets/astraweapons/sounds/gauntlets/sfx_item_gauntletsswingmedium-003_soundwave.ogg b/src/main/resources/defaults/resources/assets/astraweapons/sounds/gauntlets/sfx_item_gauntletsswingmedium-003_soundwave.ogg new file mode 100644 index 0000000..755081c Binary files /dev/null and b/src/main/resources/defaults/resources/assets/astraweapons/sounds/gauntlets/sfx_item_gauntletsswingmedium-003_soundwave.ogg differ diff --git a/src/main/resources/defaults/resources/assets/astraweapons/sounds/gauntlets/sfx_item_gauntletsswingscream-001_soundwave.ogg b/src/main/resources/defaults/resources/assets/astraweapons/sounds/gauntlets/sfx_item_gauntletsswingscream-001_soundwave.ogg new file mode 100644 index 0000000..ce31490 Binary files /dev/null and b/src/main/resources/defaults/resources/assets/astraweapons/sounds/gauntlets/sfx_item_gauntletsswingscream-001_soundwave.ogg differ diff --git a/src/main/resources/defaults/resources/assets/astraweapons/sounds/gauntlets/sfx_item_gauntletsswingscream-002_soundwave.ogg b/src/main/resources/defaults/resources/assets/astraweapons/sounds/gauntlets/sfx_item_gauntletsswingscream-002_soundwave.ogg new file mode 100644 index 0000000..3621961 Binary files /dev/null and b/src/main/resources/defaults/resources/assets/astraweapons/sounds/gauntlets/sfx_item_gauntletsswingscream-002_soundwave.ogg differ diff --git a/src/main/resources/defaults/resources/assets/astraweapons/sounds/gauntlets/sfx_item_gauntletsswingshort-001_soundwave.ogg b/src/main/resources/defaults/resources/assets/astraweapons/sounds/gauntlets/sfx_item_gauntletsswingshort-001_soundwave.ogg new file mode 100644 index 0000000..7a182ba Binary files /dev/null and b/src/main/resources/defaults/resources/assets/astraweapons/sounds/gauntlets/sfx_item_gauntletsswingshort-001_soundwave.ogg differ diff --git a/src/main/resources/defaults/resources/assets/astraweapons/sounds/gauntlets/sfx_item_gauntletsswingshort-002_soundwave.ogg b/src/main/resources/defaults/resources/assets/astraweapons/sounds/gauntlets/sfx_item_gauntletsswingshort-002_soundwave.ogg new file mode 100644 index 0000000..5f55bf9 Binary files /dev/null and b/src/main/resources/defaults/resources/assets/astraweapons/sounds/gauntlets/sfx_item_gauntletsswingshort-002_soundwave.ogg differ diff --git a/src/main/resources/defaults/resources/assets/astraweapons/sounds/gauntlets/sfx_item_gauntletsswingshort-003_soundwave.ogg b/src/main/resources/defaults/resources/assets/astraweapons/sounds/gauntlets/sfx_item_gauntletsswingshort-003_soundwave.ogg new file mode 100644 index 0000000..b58d98b Binary files /dev/null and b/src/main/resources/defaults/resources/assets/astraweapons/sounds/gauntlets/sfx_item_gauntletsswingshort-003_soundwave.ogg differ diff --git a/src/main/resources/defaults/resources/assets/astraweapons/sounds/gauntlets/sfx_item_gauntletsswingshort-004_soundwave.ogg b/src/main/resources/defaults/resources/assets/astraweapons/sounds/gauntlets/sfx_item_gauntletsswingshort-004_soundwave.ogg new file mode 100644 index 0000000..046ca6c Binary files /dev/null and b/src/main/resources/defaults/resources/assets/astraweapons/sounds/gauntlets/sfx_item_gauntletsswingshort-004_soundwave.ogg differ diff --git a/src/main/resources/defaults/resources/assets/astraweapons/textures/item/iron_gauntlet.png b/src/main/resources/defaults/resources/assets/astraweapons/textures/item/iron_gauntlet.png new file mode 100644 index 0000000..e87fb93 Binary files /dev/null and b/src/main/resources/defaults/resources/assets/astraweapons/textures/item/iron_gauntlet.png differ diff --git a/src/main/resources/defaults/resources/assets/astraweapons/textures/item/iron_gauntlet_3d_1.png b/src/main/resources/defaults/resources/assets/astraweapons/textures/item/iron_gauntlet_3d_1.png new file mode 100644 index 0000000..ee1b44f Binary files /dev/null and b/src/main/resources/defaults/resources/assets/astraweapons/textures/item/iron_gauntlet_3d_1.png differ diff --git a/src/main/resources/defaults/resources/assets/astraweapons/textures/item/iron_gauntlet_3d_2.png b/src/main/resources/defaults/resources/assets/astraweapons/textures/item/iron_gauntlet_3d_2.png new file mode 100644 index 0000000..6e95a25 Binary files /dev/null and b/src/main/resources/defaults/resources/assets/astraweapons/textures/item/iron_gauntlet_3d_2.png differ diff --git a/src/main/resources/defaults/resources/assets/astraweapons/textures/item/slash.png b/src/main/resources/defaults/resources/assets/astraweapons/textures/item/slash.png new file mode 100644 index 0000000..531efd7 Binary files /dev/null and b/src/main/resources/defaults/resources/assets/astraweapons/textures/item/slash.png differ diff --git a/src/main/resources/defaults/resources/assets/astraweapons/textures/item/slash.png.mcmeta b/src/main/resources/defaults/resources/assets/astraweapons/textures/item/slash.png.mcmeta new file mode 100644 index 0000000..f2c5c2b --- /dev/null +++ b/src/main/resources/defaults/resources/assets/astraweapons/textures/item/slash.png.mcmeta @@ -0,0 +1,6 @@ +{ + "animation": { + "frametime": 1, + "interpolate": false + } +} diff --git a/src/main/resources/defaults/resources/assets/astraweapons/textures/item/slash_fire.png b/src/main/resources/defaults/resources/assets/astraweapons/textures/item/slash_fire.png new file mode 100644 index 0000000..c65e497 Binary files /dev/null and b/src/main/resources/defaults/resources/assets/astraweapons/textures/item/slash_fire.png differ diff --git a/src/main/resources/defaults/resources/assets/astraweapons/textures/item/slash_fire.png.mcmeta b/src/main/resources/defaults/resources/assets/astraweapons/textures/item/slash_fire.png.mcmeta new file mode 100644 index 0000000..f2c5c2b --- /dev/null +++ b/src/main/resources/defaults/resources/assets/astraweapons/textures/item/slash_fire.png.mcmeta @@ -0,0 +1,6 @@ +{ + "animation": { + "frametime": 1, + "interpolate": false + } +} diff --git a/src/main/resources/gauntlet-audio-provenance.json b/src/main/resources/gauntlet-audio-provenance.json new file mode 100644 index 0000000..030db2e --- /dev/null +++ b/src/main/resources/gauntlet-audio-provenance.json @@ -0,0 +1,140 @@ +[ + { + "file": "sounds/gauntlets/sfx_item_gauntletshitimpactlight-001_soundwave.ogg", + "original": "sfx_item_gauntletsHitImpactLight-001_soundWave.ogg", + "sha256": "939c440337b8dc538a8de7413f501e5ec376f789b98b679aa4e11cc5f5eeb149", + "reference": "https://minecraft.wiki/w/File:Sfx_item_gauntletsHitImpactLight-001_soundWave.ogg" + }, + { + "file": "sounds/gauntlets/sfx_item_gauntletshitimpactlight-002_soundwave.ogg", + "original": "sfx_item_gauntletsHitImpactLight-002_soundWave.ogg", + "sha256": "ea0e3cbcc54815ce98e07a590b74f26616cdf603f8afd819e7b1c9f70db695dd", + "reference": "https://minecraft.wiki/w/File:Sfx_item_gauntletsHitImpactLight-002_soundWave.ogg" + }, + { + "file": "sounds/gauntlets/sfx_item_gauntletshitimpactlight-003_soundwave.ogg", + "original": "sfx_item_gauntletsHitImpactLight-003_soundWave.ogg", + "sha256": "99ca5a5f064c0703cdd3aa3b0a5efb764973cecab49aae7022a7bb970111603d", + "reference": "https://minecraft.wiki/w/File:Sfx_item_gauntletsHitImpactLight-003_soundWave.ogg" + }, + { + "file": "sounds/gauntlets/sfx_item_gauntletshitimpactlight-004_soundwave.ogg", + "original": "sfx_item_gauntletsHitImpactLight-004_soundWave.ogg", + "sha256": "530e75262fe50f5eef76d0c301d48b10ce766b8caaa727debea76ce7ffe69086", + "reference": "https://minecraft.wiki/w/File:Sfx_item_gauntletsHitImpactLight-004_soundWave.ogg" + }, + { + "file": "sounds/gauntlets/sfx_item_gauntletshitimpactmedium-001_soundwave.ogg", + "original": "sfx_item_gauntletsHitImpactMedium-001_soundWave.ogg", + "sha256": "3e592c9cf86c7ae8f67dab7ca45c204bae991ba5b23b323efcb32715bfc05c78", + "reference": "https://minecraft.wiki/w/File:Sfx_item_gauntletsHitImpactMedium-001_soundWave.ogg" + }, + { + "file": "sounds/gauntlets/sfx_item_gauntletshitimpactmedium-002_soundwave.ogg", + "original": "sfx_item_gauntletsHitImpactMedium-002_soundWave.ogg", + "sha256": "bba5277b3178a1e906b1380498ef8a90fa3a040b7191d6b4b23375a6ca543f80", + "reference": "https://minecraft.wiki/w/File:Sfx_item_gauntletsHitImpactMedium-002_soundWave.ogg" + }, + { + "file": "sounds/gauntlets/sfx_item_gauntletshitimpactmedium-003_soundwave.ogg", + "original": "sfx_item_gauntletsHitImpactMedium-003_soundWave.ogg", + "sha256": "e9460eb4741a974c6b8ccd663acb4c142952cec33ed0d45d246f965fd0e86929", + "reference": "https://minecraft.wiki/w/File:Sfx_item_gauntletsHitImpactMedium-003_soundWave.ogg" + }, + { + "file": "sounds/gauntlets/sfx_item_gauntletshitimpactkick-001_soundwave.ogg", + "original": "sfx_item_gauntletsHitImpactKick-001_soundWave.ogg", + "sha256": "9e9e498e90fcc472edd529456b8b94cfb21124ab4e024fa05a9ffc994531da91", + "reference": "https://minecraft.wiki/w/File:Sfx_item_gauntletsHitImpactKick-001_soundWave.ogg" + }, + { + "file": "sounds/gauntlets/sfx_item_gauntletshitimpactkick-002_soundwave.ogg", + "original": "sfx_item_gauntletsHitImpactKick-002_soundWave.ogg", + "sha256": "42a814d1f1cbce5a10005a8e7188b26a81603b5589d25f0e54f0e77c9a880893", + "reference": "https://minecraft.wiki/w/File:Sfx_item_gauntletsHitImpactKick-002_soundWave.ogg" + }, + { + "file": "sounds/gauntlets/sfx_item_gauntletshitimpactkick-003_soundwave.ogg", + "original": "sfx_item_gauntletsHitImpactKick-003_soundWave.ogg", + "sha256": "b5bc647e25079d05f81418165507c28a1ff580a12c777dac8283d710a0b38321", + "reference": "https://minecraft.wiki/w/File:Sfx_item_gauntletsHitImpactKick-003_soundWave.ogg" + }, + { + "file": "sounds/gauntlets/sfx_item_gauntletshitimpactpunch-001_soundwave.ogg", + "original": "sfx_item_gauntletsHitImpactPunch-001_soundWave.ogg", + "sha256": "2c294bcba4ab0467d5be7666b86ec1d4f34011cab63ff5d065456d3dc165743e", + "reference": "https://minecraft.wiki/w/File:Sfx_item_gauntletsHitImpactPunch-001_soundWave.ogg" + }, + { + "file": "sounds/gauntlets/sfx_item_gauntletshitimpactpunch-002_soundwave.ogg", + "original": "sfx_item_gauntletsHitImpactPunch-002_soundWave.ogg", + "sha256": "b08b6c58a521815ceb211ae56367f8afbb6a9c549ba53f9af209265c8be12d96", + "reference": "https://minecraft.wiki/w/File:Sfx_item_gauntletsHitImpactPunch-002_soundWave.ogg" + }, + { + "file": "sounds/gauntlets/sfx_item_gauntletshitimpactpunch-003_soundwave.ogg", + "original": "sfx_item_gauntletsHitImpactPunch-003_soundWave.ogg", + "sha256": "af9e9809ff44f0a3263d382f2a413b4965ea7acd47cc81287e73639efb81d358", + "reference": "https://minecraft.wiki/w/File:Sfx_item_gauntletsHitImpactPunch-003_soundWave.ogg" + }, + { + "file": "sounds/gauntlets/sfx_item_gauntletsswingshort-001_soundwave.ogg", + "original": "sfx_item_gauntletsSwingShort-001_soundWave.ogg", + "sha256": "7b140ad9196b9e0dc1d2b997378a7c939e202e5c036f433c90ef44730b52f596", + "reference": "https://minecraft.wiki/w/File:Sfx_item_gauntletsSwingShort-001_soundWave.ogg" + }, + { + "file": "sounds/gauntlets/sfx_item_gauntletsswingshort-002_soundwave.ogg", + "original": "sfx_item_gauntletsSwingShort-002_soundWave.ogg", + "sha256": "e12da23135d786bed96a1001f3547c6128b86827eef3bf8e70714c70e712edcc", + "reference": "https://minecraft.wiki/w/File:Sfx_item_gauntletsSwingShort-002_soundWave.ogg" + }, + { + "file": "sounds/gauntlets/sfx_item_gauntletsswingshort-003_soundwave.ogg", + "original": "sfx_item_gauntletsSwingShort-003_soundWave.ogg", + "sha256": "12fb1a1e63ba8a62b5975c391f5657dd06dba730866d71211e25989883461f2b", + "reference": "https://minecraft.wiki/w/File:Sfx_item_gauntletsSwingShort-003_soundWave.ogg" + }, + { + "file": "sounds/gauntlets/sfx_item_gauntletsswingshort-004_soundwave.ogg", + "original": "sfx_item_gauntletsSwingShort-004_soundWave.ogg", + "sha256": "b930d20ad2a04cc502c13f1df0c9f7caea9ecf84d0a4f29aba6eb95d81cd66eb", + "reference": "https://minecraft.wiki/w/File:Sfx_item_gauntletsSwingShort-004_soundWave.ogg" + }, + { + "file": "sounds/gauntlets/sfx_item_gauntletsswingmedium-001_soundwave.ogg", + "original": "sfx_item_gauntletsSwingMedium-001_soundWave.ogg", + "sha256": "26138e703a0f1712083f7766f88af01630f69b8e9905ed983a38a3465d9ad656", + "reference": "https://minecraft.wiki/w/File:Sfx_item_gauntletsSwingMedium-001_soundWave.ogg" + }, + { + "file": "sounds/gauntlets/sfx_item_gauntletsswingmedium-002_soundwave.ogg", + "original": "sfx_item_gauntletsSwingMedium-002_soundWave.ogg", + "sha256": "a111c1b504ce88f23dcd9f626ab97556b8a32f5afb346df1d1664bb96f1d0c6c", + "reference": "https://minecraft.wiki/w/File:Sfx_item_gauntletsSwingMedium-002_soundWave.ogg" + }, + { + "file": "sounds/gauntlets/sfx_item_gauntletsswingmedium-003_soundwave.ogg", + "original": "sfx_item_gauntletsSwingMedium-003_soundWave.ogg", + "sha256": "95fd5cf194aa3266c6361f734ad57974874f0181abee63cfdbc47d10a59270b8", + "reference": "https://minecraft.wiki/w/File:Sfx_item_gauntletsSwingMedium-003_soundWave.ogg" + }, + { + "file": "sounds/gauntlets/sfx_item_gauntletsswingkick-001_soundwave.ogg", + "original": "sfx_item_gauntletsSwingKick-001_soundWave.ogg", + "sha256": "dc25d9adcf0689b851b616d55758fc5220e9f81931f7c02ecbc152fb7a99a1df", + "reference": "https://minecraft.wiki/w/File:Sfx_item_gauntletsSwingKick-001_soundWave.ogg" + }, + { + "file": "sounds/gauntlets/sfx_item_gauntletsswingscream-001_soundwave.ogg", + "original": "sfx_item_gauntletsSwingScream-001_soundWave.ogg", + "sha256": "e4de266700429160ca9f589f5ff30160a01c5b7462915b67eaa6d3041d671dc1", + "reference": "https://minecraft.wiki/w/File:Sfx_item_gauntletsSwingScream-001_soundWave.ogg" + }, + { + "file": "sounds/gauntlets/sfx_item_gauntletsswingscream-002_soundwave.ogg", + "original": "sfx_item_gauntletsSwingScream-002_soundWave.ogg", + "sha256": "d895fb1d957aa6ad6df879803d15070c1b7bc65c4da26b741113d16193dc55b7", + "reference": "https://minecraft.wiki/w/File:Sfx_item_gauntletsSwingScream-002_soundWave.ogg" + } +] diff --git a/src/main/resources/weapons-index.txt b/src/main/resources/weapons-index.txt new file mode 100644 index 0000000..09888f5 --- /dev/null +++ b/src/main/resources/weapons-index.txt @@ -0,0 +1,109 @@ +contents/astraplus/enchantments/hook.json +contents/astraplus/enchantments/inertia.json +contents/astraplus/enchantments/reach.json +contents/astraplus/enchantments/reaping.json +contents/astraplus/items/netherite_twinblade.json +contents/astraweapons/items/gauntlets.json +resources/assets/astraplus/models/item/netherite_twinblade.json +resources/assets/astraplus/textures/item/netherite_twinblade.png +resources/assets/astraweapons/credits/THIRD_PARTY_NOTICES.md +resources/assets/astraweapons/items/animation/hook_0.json +resources/assets/astraweapons/items/animation/hook_1.json +resources/assets/astraweapons/items/animation/hook_2.json +resources/assets/astraweapons/items/animation/hook_3.json +resources/assets/astraweapons/items/animation/hook_4.json +resources/assets/astraweapons/items/animation/hook_5.json +resources/assets/astraweapons/items/animation/jab_0.json +resources/assets/astraweapons/items/animation/jab_1.json +resources/assets/astraweapons/items/animation/jab_2.json +resources/assets/astraweapons/items/animation/jab_3.json +resources/assets/astraweapons/items/animation/jab_4.json +resources/assets/astraweapons/items/animation/jab_5.json +resources/assets/astraweapons/items/animation/lunge_0.json +resources/assets/astraweapons/items/animation/lunge_1.json +resources/assets/astraweapons/items/animation/lunge_2.json +resources/assets/astraweapons/items/animation/lunge_3.json +resources/assets/astraweapons/items/animation/lunge_4.json +resources/assets/astraweapons/items/animation/lunge_5.json +resources/assets/astraweapons/items/animation/twinblade_0.json +resources/assets/astraweapons/items/animation/twinblade_1.json +resources/assets/astraweapons/items/animation/twinblade_2.json +resources/assets/astraweapons/items/animation/twinblade_3.json +resources/assets/astraweapons/items/animation/twinblade_4.json +resources/assets/astraweapons/items/animation/twinblade_5.json +resources/assets/astraweapons/items/animation/uppercut_0.json +resources/assets/astraweapons/items/animation/uppercut_1.json +resources/assets/astraweapons/items/animation/uppercut_2.json +resources/assets/astraweapons/items/animation/uppercut_3.json +resources/assets/astraweapons/items/animation/uppercut_4.json +resources/assets/astraweapons/items/animation/uppercut_5.json +resources/assets/astraweapons/items/gauntlet_offhand.json +resources/assets/astraweapons/items/slash.json +resources/assets/astraweapons/items/slash_fire.json +resources/assets/astraweapons/lang/en_us.json +resources/assets/astraweapons/lang/ru_ru.json +resources/assets/astraweapons/models/animation/hook_0.json +resources/assets/astraweapons/models/animation/hook_1.json +resources/assets/astraweapons/models/animation/hook_2.json +resources/assets/astraweapons/models/animation/hook_3.json +resources/assets/astraweapons/models/animation/hook_4.json +resources/assets/astraweapons/models/animation/hook_5.json +resources/assets/astraweapons/models/animation/jab_0.json +resources/assets/astraweapons/models/animation/jab_1.json +resources/assets/astraweapons/models/animation/jab_2.json +resources/assets/astraweapons/models/animation/jab_3.json +resources/assets/astraweapons/models/animation/jab_4.json +resources/assets/astraweapons/models/animation/jab_5.json +resources/assets/astraweapons/models/animation/lunge_0.json +resources/assets/astraweapons/models/animation/lunge_1.json +resources/assets/astraweapons/models/animation/lunge_2.json +resources/assets/astraweapons/models/animation/lunge_3.json +resources/assets/astraweapons/models/animation/lunge_4.json +resources/assets/astraweapons/models/animation/lunge_5.json +resources/assets/astraweapons/models/animation/twinblade_0.json +resources/assets/astraweapons/models/animation/twinblade_1.json +resources/assets/astraweapons/models/animation/twinblade_2.json +resources/assets/astraweapons/models/animation/twinblade_3.json +resources/assets/astraweapons/models/animation/twinblade_4.json +resources/assets/astraweapons/models/animation/twinblade_5.json +resources/assets/astraweapons/models/animation/uppercut_0.json +resources/assets/astraweapons/models/animation/uppercut_1.json +resources/assets/astraweapons/models/animation/uppercut_2.json +resources/assets/astraweapons/models/animation/uppercut_3.json +resources/assets/astraweapons/models/animation/uppercut_4.json +resources/assets/astraweapons/models/animation/uppercut_5.json +resources/assets/astraweapons/models/effect/slash.json +resources/assets/astraweapons/models/effect/slash_fire.json +resources/assets/astraweapons/models/item/iron_gauntlet_2d.json +resources/assets/astraweapons/models/item/iron_gauntlet_3d.json +resources/assets/astraweapons/sounds.json +resources/assets/astraweapons/sounds/gauntlets/sfx_item_gauntletshitimpactkick-001_soundwave.ogg +resources/assets/astraweapons/sounds/gauntlets/sfx_item_gauntletshitimpactkick-002_soundwave.ogg +resources/assets/astraweapons/sounds/gauntlets/sfx_item_gauntletshitimpactkick-003_soundwave.ogg +resources/assets/astraweapons/sounds/gauntlets/sfx_item_gauntletshitimpactlight-001_soundwave.ogg +resources/assets/astraweapons/sounds/gauntlets/sfx_item_gauntletshitimpactlight-002_soundwave.ogg +resources/assets/astraweapons/sounds/gauntlets/sfx_item_gauntletshitimpactlight-003_soundwave.ogg +resources/assets/astraweapons/sounds/gauntlets/sfx_item_gauntletshitimpactlight-004_soundwave.ogg +resources/assets/astraweapons/sounds/gauntlets/sfx_item_gauntletshitimpactmedium-001_soundwave.ogg +resources/assets/astraweapons/sounds/gauntlets/sfx_item_gauntletshitimpactmedium-002_soundwave.ogg +resources/assets/astraweapons/sounds/gauntlets/sfx_item_gauntletshitimpactmedium-003_soundwave.ogg +resources/assets/astraweapons/sounds/gauntlets/sfx_item_gauntletshitimpactpunch-001_soundwave.ogg +resources/assets/astraweapons/sounds/gauntlets/sfx_item_gauntletshitimpactpunch-002_soundwave.ogg +resources/assets/astraweapons/sounds/gauntlets/sfx_item_gauntletshitimpactpunch-003_soundwave.ogg +resources/assets/astraweapons/sounds/gauntlets/sfx_item_gauntletsswingkick-001_soundwave.ogg +resources/assets/astraweapons/sounds/gauntlets/sfx_item_gauntletsswingmedium-001_soundwave.ogg +resources/assets/astraweapons/sounds/gauntlets/sfx_item_gauntletsswingmedium-002_soundwave.ogg +resources/assets/astraweapons/sounds/gauntlets/sfx_item_gauntletsswingmedium-003_soundwave.ogg +resources/assets/astraweapons/sounds/gauntlets/sfx_item_gauntletsswingscream-001_soundwave.ogg +resources/assets/astraweapons/sounds/gauntlets/sfx_item_gauntletsswingscream-002_soundwave.ogg +resources/assets/astraweapons/sounds/gauntlets/sfx_item_gauntletsswingshort-001_soundwave.ogg +resources/assets/astraweapons/sounds/gauntlets/sfx_item_gauntletsswingshort-002_soundwave.ogg +resources/assets/astraweapons/sounds/gauntlets/sfx_item_gauntletsswingshort-003_soundwave.ogg +resources/assets/astraweapons/sounds/gauntlets/sfx_item_gauntletsswingshort-004_soundwave.ogg +resources/assets/astraweapons/textures/item/iron_gauntlet.png +resources/assets/astraweapons/textures/item/iron_gauntlet_3d_1.png +resources/assets/astraweapons/textures/item/iron_gauntlet_3d_2.png +resources/assets/astraweapons/textures/item/slash.png +resources/assets/astraweapons/textures/item/slash.png.mcmeta +resources/assets/astraweapons/textures/item/slash_fire.png +resources/assets/astraweapons/textures/item/slash_fire.png.mcmeta diff --git a/src/test/java/online/astradev/weapons/ComboTest.java b/src/test/java/online/astradev/weapons/ComboTest.java new file mode 100644 index 0000000..44da3a7 --- /dev/null +++ b/src/test/java/online/astradev/weapons/ComboTest.java @@ -0,0 +1,19 @@ +package online.astradev.weapons; + +import org.junit.jupiter.api.Test; +import online.astradev.weapons.behavior.Combo; +import static org.junit.jupiter.api.Assertions.*; + +class ComboTest { + @Test void sevenHitsHaveRequestedDamageAndHandOrder() { + for (int i=0;i<5;i++) assertEquals(1,Combo.multiplier(i)); + assertEquals(1.4,Combo.multiplier(5));assertEquals(2,Combo.multiplier(6)); + assertTrue(Combo.left(0));assertFalse(Combo.left(1));assertTrue(Combo.left(2));assertFalse(Combo.left(3)); + assertTrue(Combo.left(4));assertEquals("uppercut",Combo.pose(5));assertEquals("lunge",Combo.pose(6)); + } + @Test void shortConeExcludesSideAndRearTargets() { + assertTrue(Combo.within(0,1,.2,2)); + assertFalse(Combo.within(0,1,2,.2));assertFalse(Combo.within(0,1,0,-2)); + assertTrue(Combo.within(-1,0,-2,.2));assertFalse(Combo.within(-1,0,2,0)); + } +} diff --git a/src/test/java/online/astradev/weapons/WeaponsResourcesTest.java b/src/test/java/online/astradev/weapons/WeaponsResourcesTest.java new file mode 100644 index 0000000..8e18445 --- /dev/null +++ b/src/test/java/online/astradev/weapons/WeaponsResourcesTest.java @@ -0,0 +1,33 @@ +package online.astradev.weapons; + +import java.nio.file.*; +import com.google.gson.JsonParser; +import online.astradev.weapons.resource.WeaponsResources; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.io.TempDir; +import static org.junit.jupiter.api.Assertions.*; + +class WeaponsResourcesTest { + @TempDir Path root; + @Test void installsOwnedAssetsAndKeepsUserEditsAcrossRestart() throws Exception { + WeaponsResources.install(root); + Path content=root.resolve("astraplus/contents"); + assertTrue(Files.exists(content.resolve("astraplus/items/netherite_twinblade.json"))); + assertTrue(Files.exists(content.resolve("astraplus/enchantments/reach.json"))); + Path gloves=content.resolve("astraweapons/items/gauntlets.json"); + String changed=Files.readString(gloves).replace("Боевые перчатки","Именные перчатки");Files.writeString(gloves,changed); + WeaponsResources.install(root);assertEquals(changed,Files.readString(gloves)); + Path assets=root.resolve("astraplus/resources/assets/astraweapons"); + var sounds=JsonParser.parseString(Files.readString(assets.resolve("sounds.json"))).getAsJsonObject(); + int samples=0; + for(var e:sounds.entrySet()) for(var sound:e.getValue().getAsJsonObject().getAsJsonArray("sounds")) { + Path file=assets.resolve("sounds/"+sound.getAsString().split(":",2)[1]+".ogg"); + assertArrayEquals(new byte[]{'O','g','g','S'},java.util.Arrays.copyOf(Files.readAllBytes(file),4));samples++; + } + assertEquals(23,samples); + assertTrue(Files.readString(assets.resolve("credits/THIRD_PARTY_NOTICES.md")).contains("joshieman")); + for(String pose:java.util.List.of("jab","hook","uppercut","lunge","twinblade")) for(int frame=0;frame<6;frame++) + assertTrue(Files.exists(assets.resolve("items/animation/"+pose+"_"+frame+".json"))); + assertFalse(Files.exists(root.resolve("astraplus/resources/assets/minecraft/items/iron_sword.json"))); + } +} diff --git a/src/test/java/online/astradev/weapons/content/TwinbladeContentTest.java b/src/test/java/online/astradev/weapons/content/TwinbladeContentTest.java new file mode 100644 index 0000000..2b50062 --- /dev/null +++ b/src/test/java/online/astradev/weapons/content/TwinbladeContentTest.java @@ -0,0 +1,57 @@ +package online.astradev.weapons.content; +import online.astradev.plus.content.PlusDefinitions; + +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.List; +import online.astradev.plus.resource.PlusResources; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.io.TempDir; +import static org.junit.jupiter.api.Assertions.*; + +class TwinbladeContentTest { + @TempDir Path root; + + @Test void installsInExistingServerAndBuildsModelWithoutReplacingSword() throws Exception { + Files.createDirectories(root.resolve("astraplus/contents")); + TwinbladeContent.install(root); + var definitions = PlusDefinitions.load(root.resolve("astraplus/contents")); + assertEquals("astraplus:netherite_twinblade", definitions.entries.getFirst().id); + var resources = PlusResources.collect(root, definitions, List.of()); + assertTrue(resources.containsKey("assets/astraplus/items/netherite_twinblade.json")); + assertTrue(resources.containsKey("assets/astraplus/models/item/netherite_twinblade.json")); + assertTrue(resources.containsKey("assets/astraplus/textures/item/netherite_twinblade.png")); + assertFalse(resources.containsKey("assets/minecraft/items/netherite_sword.json")); + var file = root.resolve("astraplus/contents/astraplus/items/netherite_twinblade.json"); + Files.writeString(file, "customized"); + TwinbladeContent.install(root); + assertEquals("customized", Files.readString(file)); + } + + @Test void upgradesOnlyLegacyGuiScaleAndPreservesHandTransforms() throws Exception { + TwinbladeContent.install(root); + var path = root.resolve("astraplus/resources/assets/astraplus/models/item/netherite_twinblade.json"); + var model = com.google.gson.JsonParser.parseString(Files.readString(path)).getAsJsonObject(); + var hand = model.getAsJsonObject("display").getAsJsonObject("firstperson_righthand").deepCopy(); + model.getAsJsonObject("display").getAsJsonObject("gui").add("scale", com.google.gson.JsonParser.parseString("[4,4,1]")); + model.getAsJsonObject("display").getAsJsonObject("gui").remove("translation"); + Files.writeString(path, model.toString()); + TwinbladeContent.install(root); + var updated = com.google.gson.JsonParser.parseString(Files.readString(path)).getAsJsonObject(); + assertEquals("[1.5,1.5,1]", updated.getAsJsonObject("display").getAsJsonObject("gui").get("scale").toString()); + assertEquals("[1.9,1.9,0]", updated.getAsJsonObject("display").getAsJsonObject("gui").get("translation").toString()); + assertEquals(hand, updated.getAsJsonObject("display").get("firstperson_righthand")); + try (var backups = Files.list(root.resolve("astraplus/backups"))) { assertEquals(1, backups.count()); } + } + + @Test void guiUsesOriginalTextureWithoutChargeOverlay() throws Exception { + var model = online.astradev.weapons.resource.TwinbladeResources.itemModel("astraplus:item/netherite_twinblade"); + assertEquals("minecraft:display_context", model.get("property").getAsString()); + assertEquals("gui", model.getAsJsonArray("cases").get(0).getAsJsonObject().get("when").getAsString()); + assertEquals("astraplus:item/netherite_twinblade", model.getAsJsonObject("fallback").get("model").getAsString()); + var resources = online.astradev.weapons.resource.TwinbladeResources.generate(); + assertFalse(model.toString().contains("custom_model_data")); + assertTrue(resources.keySet().stream().noneMatch(path -> path.contains("charge"))); + assertEquals("astraplus:internal/twinblade_gui", model.getAsJsonArray("cases").get(0).getAsJsonObject().getAsJsonObject("model").get("model").getAsString()); + } +} diff --git a/src/test/java/online/astradev/weapons/content/enchantment/EnchantmentDefaultsTest.java b/src/test/java/online/astradev/weapons/content/enchantment/EnchantmentDefaultsTest.java new file mode 100644 index 0000000..0124eea --- /dev/null +++ b/src/test/java/online/astradev/weapons/content/enchantment/EnchantmentDefaultsTest.java @@ -0,0 +1,20 @@ +package online.astradev.weapons.content.enchantment; +import online.astradev.plus.content.enchantment.EnchantmentDefinition; + +import java.util.List; +import org.junit.jupiter.api.Test; +import online.astradev.plus.config.PlusConfig; +import static org.junit.jupiter.api.Assertions.*; + +class EnchantmentDefaultsTest { + @Test void defaultsDescribeExactTwinbladeRules() throws Exception { + for (String name : List.of("reaping", "inertia", "hook")) try (var input = getClass().getResourceAsStream("/defaults/contents/astraplus/enchantments/" + name + ".json")) { + var d = PlusConfig.JSON.fromJson(new String(input.readAllBytes(), java.nio.charset.StandardCharsets.UTF_8), EnchantmentDefinition.class); + d.validate(); assertEquals(List.of("astraplus:netherite_twinblade"), d.items); + assertEquals(name.equals("reaping") ? 3 : 2, d.maxLevel); + var effect = d.effects.getFirst(); + if (name.equals("hook")) { assertEquals(List.of(0.15, 0.25), effect.values); assertEquals(10, effect.duration); } + else { assertEquals(2, effect.minTargets); assertTrue(effect.sweepOnly); assertEquals(0.1, effect.value(1)); } + } + } +} diff --git a/src/verification/java/online/astradev/weapons/verification/CaptureFixture.java b/src/verification/java/online/astradev/weapons/verification/CaptureFixture.java new file mode 100644 index 0000000..1fc37de --- /dev/null +++ b/src/verification/java/online/astradev/weapons/verification/CaptureFixture.java @@ -0,0 +1,56 @@ +package online.astradev.weapons.verification; + +import java.nio.file.*; +import net.minecraft.core.BlockPos; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.GameType; +import net.minecraft.world.level.block.Blocks; +import net.neoforged.neoforge.common.NeoForge; +import net.neoforged.neoforge.event.tick.ServerTickEvent; +import online.astradev.plus.AstraPlus; +import online.astradev.weapons.behavior.*; +import online.astradev.weapons.resource.*; + +final class CaptureFixture { + private int ticks,stage=-1,age; + private boolean ready; + CaptureFixture() { NeoForge.EVENT_BUS.addListener(this::tick); } + private void tick(ServerTickEvent.Post event) { + var server=event.getServer(); + try { + if(Files.exists(Path.of("capture-finished.txt")) || ++ticks>12000) { server.halt(false);return; } + if(ticks==1) server.overworld().setChunkForced(6,6,true); + if(!ready && ticks>=30) { + var level=server.overworld(); + for(int x=92;x<=108;x++) for(int z=92;z<=108;z++) level.setBlock(new BlockPos(x,64,z),Blocks.SMOOTH_STONE.defaultBlockState(),3); + server.getCommands().performPrefixedCommand(server.createCommandSourceStack(),"time set noon"); + PackVerification.verify();Files.writeString(Path.of("capture-ready.txt"),"ready");ready=true; + } + if(!ready || server.getPlayerList().getPlayers().isEmpty()) return; + ServerPlayer p=server.getPlayerList().getPlayers().getFirst(); + if(stage<0 || Files.exists(Path.of("capture-ack-"+stage+".txt"))) { + if(++stage>6) return; + age=0; + p.setGameMode(GameType.CREATIVE);p.setNoGravity(true);p.getInventory().clearContent(); + p.teleportTo(server.overworld(),100,65,100,java.util.Set.of(),0,15,true); + p.setItemInHand(InteractionHand.MAIN_HAND,AstraPlus.content().entry(stage==6?TwinbladeCombat.ID:GauntletCombat.ID).stack(1)); + p.setItemInHand(InteractionHand.OFF_HAND,ItemStack.EMPTY); + Files.writeString(Path.of("capture-stage-"+stage+".txt"),"ready"); + } + if(stage>6) return; + ++age; + if(age==20 && stage>0) { + String pose=stage==1||stage==2?"jab":stage==3?"hook":stage==4?"uppercut":stage==5?"lunge":"twinblade"; + WeaponPresentation.animate(p,pose,stage==1||stage==3,80); + } + // Repeated flashes overlap one tick so screenshot cadence cannot land in a spawn/metadata gap. + if(stage==6 && age>=40 && age<80 && age%3==0) SlashDisplay.spawn(p,3,false); + } catch(Throwable error) { + error.printStackTrace(); + try { Files.writeString(Path.of("capture-failure.txt"),error.toString()); } catch(Exception ignored) {} + server.halt(false); + } + } +} diff --git a/src/verification/java/online/astradev/weapons/verification/GauntletVerification.java b/src/verification/java/online/astradev/weapons/verification/GauntletVerification.java new file mode 100644 index 0000000..d770788 --- /dev/null +++ b/src/verification/java/online/astradev/weapons/verification/GauntletVerification.java @@ -0,0 +1,89 @@ +package online.astradev.weapons.verification; + +import static online.astradev.weapons.verification.WeaponsVerification.check; +import java.util.*; +import net.minecraft.core.component.DataComponents; +import net.minecraft.server.MinecraftServer; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.entity.EquipmentSlot; +import net.minecraft.world.entity.ai.attributes.Attributes; +import net.minecraft.world.entity.monster.zombie.Zombie; +import net.minecraft.world.item.*; +import net.minecraft.world.level.GameType; +import net.minecraft.network.protocol.game.*; +import net.neoforged.neoforge.common.util.FakePlayerFactory; +import online.astradev.plus.AstraPlus; +import online.astradev.weapons.behavior.*; +import online.astradev.weapons.resource.WeaponPresentation; + +final class GauntletVerification { + static void verify(MinecraftServer server) { + var level=server.overworld(); var p=FakePlayerFactory.getMinecraft(level); + var mobs=new ArrayList(); + try { + p.setGameMode(GameType.SURVIVAL);p.getInventory().clearContent();GauntletCombat.close(); + var glove=AstraPlus.content().entry(GauntletCombat.ID).stack(1); + p.setItemInHand(InteractionHand.MAIN_HAND,glove);ready(p,25); + check(p.getAttributeValue(Attributes.ATTACK_DAMAGE)==3,"Gauntlets: 3 base damage"); + check(p.getAttributeValue(Attributes.ATTACK_SPEED)==4,"Gauntlets: four attacks per second"); + var shield=new ItemStack(Items.SHIELD);shield.setDamageValue(17); + p.setItemInHand(InteractionHand.OFF_HAND,shield); + check(WeaponPresentation.reserveOffhand(p),"offhand reserves successfully"); + check(p.getOffhandItem().isEmpty(),"offhand is physically empty, no shield/totem bonuses"); + check(p.getInventory().getNonEquipmentItems().stream().anyMatch(s->s==shield && s.getDamageValue()==17),"original offhand item preserved exactly"); + var before=glove.copy(); + var packet=(ClientboundSetPlayerInventoryPacket)WeaponPresentation.project(p,new ClientboundSetPlayerInventoryPacket(40,ItemStack.EMPTY)); + check(WeaponPresentation.ghost(packet.contents()),"offhand projects glove model"); + check(p.getOffhandItem().isEmpty() && ItemStack.matches(before,glove),"packet projection cannot mutate inventory"); + Zombie front=target(p,mobs,100,101.8), side=target(p,mobs,102,100.2), rear=target(p,mobs,100,98), far=target(p,mobs,100,104); + double total=0; + for(int step=0;step<7;step++) { + if(step>0) ready(p,5); + total+=3*Combo.multiplier(step); + p.attack(front); + check(Math.abs(front.getHealth()-(100-total))<.002,"combo step "+step+" exact damage: "+front.getHealth()); + check(side.getHealth()==100 && rear.getHealth()==100 && far.getHealth()==100,"small hit area excludes side/rear/far"); + float hp=front.getHealth();p.attack(front);GauntletCombat.strike(p); + check(front.getHealth()==hp,"same tick click/swing cannot duplicate a hit"); + check(!WeaponPresentation.ghost(p.getMainHandItem()) && p.getOffhandItem().isEmpty(),"animated model only exists in packets"); + } + // No target ticks or invulnerability resets occurred: fast equal hits must still land. + check(front.invulnerableTime>10,"rapid combo works inside vanilla hurt immunity"); + ready(p,5);p.attack(front);check(Math.abs(front.getHealth()-(100-total-3))<.002,"combo wraps to first light hit"); + ready(p,30);p.attack(front);check(Math.abs(front.getHealth()-(100-total-6))<.002,"pause resets combo"); + mobs.forEach(Zombie::discard);mobs.clear(); + GauntletCombat.close();ready(p,25); + Zombie blocked=target(p,mobs,100,101.8); + blocked.setYRot(180);blocked.setYHeadRot(180);blocked.setItemSlot(EquipmentSlot.OFFHAND,new ItemStack(Items.SHIELD)); + blocked.startUsingItem(InteractionHand.OFF_HAND); + for(int i=0;i<6;i++) blocked.tick(); + blocked.setPos(100,200,101.8);blocked.setYRot(180);blocked.setYHeadRot(180); + p.attack(blocked);check(blocked.getHealth()==100,"shield blocks gauntlets without combo damage leak"); + // Inventory full: no disappearing/dropped offhand items and no stored ghost stack. + for(int i=0;i<36;i++) if(i!=p.getInventory().getSelectedSlot()) p.getInventory().setItem(i,new ItemStack(Items.STONE,64)); + p.setItemInHand(InteractionHand.OFF_HAND,shield); + check(!WeaponPresentation.reserveOffhand(p),"full inventory refuses glove equip"); + check(p.getMainHandItem()==shield && p.getOffhandItem()==glove,"full inventory retains both exact stacks"); + packet=(ClientboundSetPlayerInventoryPacket)WeaponPresentation.project(p,new ClientboundSetPlayerInventoryPacket(40,p.getOffhandItem())); + check(!WeaponPresentation.ghost(packet.contents()),"normal offhand restored after unequipping"); + var secondGlove=AstraPlus.content().entry(GauntletCombat.ID).stack(1); + p.setItemInHand(InteractionHand.MAIN_HAND,glove);p.setItemInHand(InteractionHand.OFF_HAND,secondGlove); + for(int i=0;i<3;i++) check(!WeaponPresentation.reserveOffhand(p),"full inventory with two gauntlets refuses activation"); + check(p.getMainHandItem()==glove && p.getOffhandItem()==secondGlove,"two gauntlets never oscillate between hands"); + packet=(ClientboundSetPlayerInventoryPacket)WeaponPresentation.project(p,new ClientboundSetPlayerInventoryPacket(40,secondGlove)); + check(!WeaponPresentation.ghost(packet.contents()),"refused activation does not hide occupied offhand"); + } finally { mobs.forEach(Zombie::discard);p.getInventory().clearContent();GauntletCombat.close(); } + } + private static void ready(ServerPlayer p,int ticks) { + for(int i=0;i mobs,double x,double z) { + var mob=new Zombie(p.level());mob.setNoAi(true);mob.setNoGravity(true);mob.setPos(x,200,z); + mob.setItemSlot(EquipmentSlot.HEAD,new ItemStack(Items.CARVED_PUMPKIN)); + mob.getAttribute(Attributes.MAX_HEALTH).setBaseValue(100);mob.setHealth(100);mob.getAttribute(Attributes.ARMOR).setBaseValue(0); + p.level().addFreshEntity(mob);mobs.add(mob);return mob; + } +} diff --git a/src/verification/java/online/astradev/weapons/verification/PackVerification.java b/src/verification/java/online/astradev/weapons/verification/PackVerification.java new file mode 100644 index 0000000..4aa023c --- /dev/null +++ b/src/verification/java/online/astradev/weapons/verification/PackVerification.java @@ -0,0 +1,28 @@ +package online.astradev.weapons.verification; + +import java.nio.file.*; +import java.util.zip.ZipFile; +import com.google.gson.JsonParser; +import online.astradev.plus.AstraPlus; +import online.astradev.plus.content.PlusDefinitions; +import online.astradev.plus.resource.PlusResources; +import static online.astradev.weapons.verification.WeaponsVerification.check; + +final class PackVerification { + static void verify() throws Exception { + var root=Path.of(".").toAbsolutePath().normalize(); + var defs=PlusDefinitions.load(root.resolve("astraplus/contents")); + var files=PlusResources.collect(root,defs,java.util.List.of()); + var pack=PlusResources.build(root,files); + try(var zip=new ZipFile(pack.toFile())) { + for(String path:java.util.List.of("assets/astraweapons/items/gauntlets.json","assets/astraplus/items/netherite_twinblade.json", + "assets/astraweapons/items/gauntlet_offhand.json","assets/astraweapons/textures/item/slash.png","assets/astraweapons/sounds.json")) + check(zip.getEntry(path)!=null,"pack contains "+path); + check(zip.getEntry("assets/minecraft/items/iron_sword.json")==null,"ordinary iron sword model unchanged"); + check(zip.getEntry("assets/minecraft/items/netherite_sword.json")==null,"ordinary netherite sword model unchanged"); + for(var entry:files.entrySet()) { + if(entry.getKey().endsWith(".json")) JsonParser.parseString(new String(entry.getValue(),java.nio.charset.StandardCharsets.UTF_8)); + } + } + } +} diff --git a/src/verification/java/online/astradev/weapons/verification/TwinbladeEnchantVerification.java b/src/verification/java/online/astradev/weapons/verification/TwinbladeEnchantVerification.java new file mode 100644 index 0000000..c98e0ef --- /dev/null +++ b/src/verification/java/online/astradev/weapons/verification/TwinbladeEnchantVerification.java @@ -0,0 +1,155 @@ +package online.astradev.weapons.verification; + +import java.util.ArrayList; +import java.util.List; +import net.minecraft.core.Holder; +import net.minecraft.core.registries.Registries; +import net.minecraft.resources.Identifier; +import net.minecraft.server.MinecraftServer; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.entity.EquipmentSlot; +import net.minecraft.world.entity.ai.attributes.Attributes; +import net.minecraft.world.entity.monster.zombie.Zombie; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; +import net.minecraft.world.item.enchantment.Enchantment; +import net.neoforged.neoforge.common.util.FakePlayerFactory; +import online.astradev.plus.AstraPlus; +import online.astradev.weapons.behavior.TwinbladeCombat; +import online.astradev.plus.behavior.CombatEffects; + +public final class TwinbladeEnchantVerification { + private TwinbladeEnchantVerification() {} + public static void verify(MinecraftServer server) { + var level = server.overworld(); + ServerPlayer player = FakePlayerFactory.getMinecraft(level); + List mobs = new ArrayList<>(); + try { + var reaping = enchant(server, "astraplus:reaping"); + var inertia = enchant(server, "astraplus:inertia"); + var hook = enchant(server, "astraplus:hook"); + var sword = AstraPlus.content().entry(TwinbladeCombat.ID).stack(1); + check(sword.supportsEnchantment(reaping) && sword.isPrimaryItemFor(reaping), "twinblade accepts exclusive table enchantments"); + check(!new ItemStack(Items.NETHERITE_SWORD).supportsEnchantment(reaping), "ordinary sword rejects exclusive enchantments"); + check(!sword.supportsEnchantment(enchant(server, "minecraft:sweeping_edge")), "sweeping edge rejected on twinblade"); + check(new ItemStack(Items.ENCHANTED_BOOK).supportsEnchantment(reaping), "books can carry exclusive enchantments"); + check(!Enchantment.areCompatible(reaping, inertia) && Enchantment.areCompatible(hook, reaping), "exclusive sets preserve hook compatibility"); + var reach = enchant(server, "astraplus:reach"); + check(reach.value().getMaxLevel() == 2 && !new ItemStack(Items.NETHERITE_SWORD).supportsEnchantment(reach), "reach has two twinblade-only levels"); + for (int rank = 1; rank <= 2; rank++) { + equip(player, reach, rank); + Zombie inside = target(player, mobs, 100, 103 + rank); + Zombie outside = target(player, mobs, 100, 103.7 + rank); + Zombie behind = target(player, mobs, 100, 97 - rank); + TwinbladeCombat.strike(player); WeaponsVerification.impact(level); + check(close(inside.getHealth(), 93) && close(outside.getHealth(), 100) && close(behind.getHealth(), 100), "reach " + rank + " extends only front arc by exact block count hp=" + inside.getHealth()+"/"+outside.getHealth()+" alive="+player.isAlive()+" removed="+player.isRemoved()+" charge="+player.getAttackStrengthScale(0)+" gameTime="+level.getGameTime()); + inside.invulnerableTime = 0; TwinbladeCombat.strike(player); WeaponsVerification.impact(level); + check(close(inside.getHealth(), 93), "reach cannot bypass charge requirement"); + clear(mobs); + } + for (int rank = 1; rank <= 3; rank++) { + equip(player, reaping, rank); + Zombie a = target(player, mobs, 98, 101), b = target(player, mobs, 102, 101), c = target(player, mobs, 100, 102); + player.attack(a); WeaponsVerification.impact(level); + float expected = 100 - 7 * (1 + 0.1f * rank); + check(close(a.getHealth(), expected) && close(b.getHealth(), expected) && close(c.getHealth(), expected), "reaping " + rank + " full equal bonus on three targets"); + clear(mobs); + equip(player, reaping, rank); + a = target(player, mobs, 100, 102); player.attack(a); WeaponsVerification.impact(level); + check(close(a.getHealth(), 93), "reaping has no solo bonus"); clear(mobs); + } + for (int rank = 1; rank <= 2; rank++) { + equip(player, inertia, rank); + Zombie a = target(player, mobs, 98, 101), b = target(player, mobs, 102, 101); + player.attack(a); WeaponsVerification.impact(level); + check(close(player.getCurrentItemAttackStrengthDelay(), 12.5f * (1 - rank * 0.1f)), "inertia " + rank + " shortens current recovery"); + clear(mobs); + for (int i = 0; i < 13; i++) { player.doTick(); } + pose(player); + a = target(player, mobs, 100, 102); player.attack(a); WeaponsVerification.impact(level); + check(close(player.getCurrentItemAttackStrengthDelay(), 12.5f), "solo hit clears inertia; no accumulation"); clear(mobs); + equip(player, hook, rank); + a = target(player, mobs, 98, 101); b = target(player, mobs, 102, 101); + double normal = a.getAttributeValue(Attributes.MOVEMENT_SPEED); + player.attack(a); WeaponsVerification.impact(level); + double expected = normal * (rank == 1 ? 0.85 : 0.75); + check(Math.abs(a.getAttributeValue(Attributes.MOVEMENT_SPEED) - expected) < 0.0001 + && Math.abs(b.getAttributeValue(Attributes.MOVEMENT_SPEED) - expected) < 0.0001, "hook affects both targets by exact percentage"); + CombatEffects.hook(a, rank); + check(Math.abs(a.getAttributeValue(Attributes.MOVEMENT_SPEED) - expected) < 0.0001, "hook cannot stack strength"); + ((net.minecraft.world.level.storage.ServerLevelData)level.getLevelData()).setGameTime(level.getGameTime() + 10); + new CombatEffects().tick(new net.neoforged.neoforge.event.tick.ServerTickEvent.Post(() -> true, server)); + check(Math.abs(a.getAttributeValue(Attributes.MOVEMENT_SPEED) - normal) < 0.0001, "hook expires after ten ticks"); clear(mobs); + } + equip(player, reaping, 3); + Zombie alone = target(player, mobs, 98, 101), shielded = target(player, mobs, 100, 102); + shielded.setYRot(180); shielded.setYHeadRot(180); + shielded.setItemSlot(EquipmentSlot.OFFHAND, new ItemStack(Items.SHIELD)); + shielded.startUsingItem(InteractionHand.OFF_HAND); + for (int i = 0; i < 6; i++) { shielded.tick(); } + shielded.setPos(100, 200, 102); shielded.setYRot(180); shielded.setYHeadRot(180); + player.attack(alone); WeaponsVerification.impact(level); + check(close(alone.getHealth(), 93) && close(shielded.getHealth(), 100), "blocked target does not unlock reaping or take damage"); clear(mobs); + equip(player, enchant(server, "minecraft:sharpness"), 5); + player.getMainHandItem().enchant(enchant(server, "minecraft:fire_aspect"), 2); + player.getMainHandItem().enchant(enchant(server, "minecraft:knockback"), 2); + Zombie a = target(player, mobs, 98, 101), b = target(player, mobs, 102, 101); + player.attack(a); WeaponsVerification.impact(level); + check(close(a.getHealth(), 90) && close(b.getHealth(), 90), "sharpness V adds full damage to all targets"); + check(a.isOnFire() && b.isOnFire(), "fire aspect affects all targets"); + check(a.getDeltaMovement().z > 0.4 && b.getDeltaMovement().z > 0.4 + && Math.abs(a.getDeltaMovement().x) < 0.01 && Math.abs(b.getDeltaMovement().x) < 0.01, "knockback enchantment moves both targets in swing direction"); + clear(mobs); + equip(player, enchant(server, "minecraft:smite"), 5); + a = target(player, mobs, 98, 101); b = target(player, mobs, 102, 101); player.attack(a); WeaponsVerification.impact(level); + check(close(a.getHealth(), 80.5f) && close(b.getHealth(), 80.5f), "smite V adds per-target undead bonus"); clear(mobs); + equip(player, null, 0); + var drop = new net.minecraft.world.entity.item.ItemEntity(level, 100, 200, 102, new ItemStack(Items.STONE)); + drop.setDeltaMovement(net.minecraft.world.phys.Vec3.ZERO); level.addFreshEntity(drop); + try { TwinbladeCombat.strike(player); WeaponsVerification.impact(level); check(drop.getDeltaMovement().z > 0, "nonliving item is pushed without being destroyed"); } + finally { drop.discard(); } + equip(player, reaping, 3); + var modeled = target(player, mobs, 100, 104); + online.astradev.plus.model.ModelCarrier.hide(modeled); + var boxes = new ArrayList(); + try { + for (double x : new double[]{99.8, 100.2}) { + var box = new net.minecraft.world.entity.Interaction(net.minecraft.world.entity.EntityTypes.INTERACTION, level); + box.setPos(x, 200.5, 102); box.getPersistentData().putString("astraplus:mob_hitbox", modeled.getUUID().toString()); level.addFreshEntity(box); boxes.add(box); + } + TwinbladeCombat.strike(player); WeaponsVerification.impact(level); + check(close(modeled.getHealth(), 93), "multiple model hitboxes resolve to one full hit without group bonus"); + check(modeled.getDeltaMovement().z > 0, "custom model owner is pushed in swing direction"); + } finally { boxes.forEach(net.minecraft.world.entity.Entity::discard); online.astradev.plus.model.ModelCarrier.restore(modeled); clear(mobs); } + } finally { clear(mobs); CombatEffects.close(); player.setItemInHand(InteractionHand.MAIN_HAND, ItemStack.EMPTY); } + } + + private static Holder enchant(MinecraftServer server, String id) { + return server.registryAccess().lookupOrThrow(Registries.ENCHANTMENT).get(Identifier.parse(id)).orElseThrow(); + } + private static void equip(ServerPlayer player, Holder enchantment, int rank) { + CombatEffects.clearRecovery(player); + var stack = AstraPlus.content().entry(TwinbladeCombat.ID).stack(1); + if (enchantment != null) { stack.enchant(enchantment, rank); } + player.setItemInHand(InteractionHand.MAIN_HAND, stack); + for (int i = 0; i < 25; i++) { player.doTick(); } + pose(player); + } + private static void pose(ServerPlayer player) { + player.setPos(100, 200, 100); player.setYRot(0); player.setXRot(0); player.setOnGround(true); player.setSprinting(false); + } + private static Zombie target(ServerPlayer player, List mobs, double x, double z) { + var mob = new Zombie(player.level()); mob.setNoAi(true); mob.setNoGravity(true); + mob.setItemSlot(EquipmentSlot.HEAD, new ItemStack(Items.CARVED_PUMPKIN)); + mob.setPos(x, 200, z); mob.getAttribute(Attributes.ARMOR).setBaseValue(0); + mob.getAttribute(Attributes.MAX_HEALTH).setBaseValue(100); mob.setHealth(100); + player.level().addFreshEntity(mob); mobs.add(mob); return mob; + } + private static void clear(List mobs) { mobs.forEach(Zombie::discard); mobs.clear(); } + private static boolean close(float a, float b) { return Math.abs(a - b) < 0.001; } + private static void check(boolean ok, String message) { + if (!ok) { throw new AssertionError("Twinblade enchants: " + message); } + AstraPlus.LOG.info("Twinblade enchants verified: {}", message); + } +} diff --git a/src/verification/java/online/astradev/weapons/verification/TwinbladeVerification.java b/src/verification/java/online/astradev/weapons/verification/TwinbladeVerification.java new file mode 100644 index 0000000..eee3030 --- /dev/null +++ b/src/verification/java/online/astradev/weapons/verification/TwinbladeVerification.java @@ -0,0 +1,113 @@ +package online.astradev.weapons.verification; + +import java.util.ArrayList; +import java.util.List; +import net.minecraft.server.MinecraftServer; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.entity.EquipmentSlot; +import net.minecraft.world.entity.ai.attributes.Attributes; +import net.minecraft.world.entity.monster.zombie.Zombie; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; +import net.minecraft.world.level.GameType; +import net.neoforged.neoforge.common.util.FakePlayerFactory; +import online.astradev.plus.AstraPlus; +import online.astradev.weapons.behavior.TwinbladeCombat; + +/** Real vanilla damage/shield/cooldown and mixin checks on the isolated verification server. */ +public final class TwinbladeVerification { + private TwinbladeVerification() {} + + public static void verify(MinecraftServer server) { + var level = server.overworld(); + level.getChunk(6, 6); + TwinbladeEnchantVerification.verify(server); + var player = FakePlayerFactory.getMinecraft(level); + var originalConnection = player.connection; + var packets = new net.minecraft.server.network.ServerGamePacketListenerImpl(server, + new net.minecraft.network.Connection(net.minecraft.network.protocol.PacketFlow.SERVERBOUND), player, + net.minecraft.server.network.CommonListenerCookie.createInitial(player.getGameProfile(), false)); + player.connection = originalConnection; + player.setGameMode(GameType.SURVIVAL); + player.setPos(100, 200, 100); + player.setYRot(0); + player.setXRot(0); + player.setOnGround(true); + player.setSprinting(false); + player.setItemInHand(InteractionHand.MAIN_HAND, AstraPlus.content().entry(TwinbladeCombat.ID).stack(1)); + // Equipment changes update the actual attack attributes during a living tick. + for (int i = 0; i < 25; i++) { player.doTick(); } + player.setPos(100, 200, 100); + player.setOnGround(true); + require(Math.abs(player.getAttributeValue(Attributes.ATTACK_DAMAGE) - 7) < 0.001, "7 attack damage"); + require(Math.abs(player.getAttributeValue(Attributes.ATTACK_SPEED) - 1.6) < 0.001, "sword attack speed"); + List mobs = new ArrayList<>(); + try { + Zombie front = target(level, mobs, 100, 102); + Zombie left = target(level, mobs, 98, 100.1); + Zombie right = target(level, mobs, 102, 100.1); + Zombie behind = target(level, mobs, 100, 98); + Zombie far = target(level, mobs, 100, 104); + player.attack(front); + require(front.getHealth()==20 && left.getHealth()==20,"windup does not damage before its impact tick"); + WeaponsVerification.impact(level); + require(front.getHealth() == 13 && left.getHealth() == 13 && right.getHealth() == 13, + "all three targets take exactly one full hit"); + require(behind.getHealth() == 20 && far.getHealth() == 20, "rear and distant targets excluded"); + require(player.getAttackStrengthScale(0) == 0, "one swing consumes charge"); + // Clear normal hurt immunity only in the test, to expose accidental repeated sweeps. + for (Zombie mob : mobs) { mob.invulnerableTime = 0; } + player.attack(front); WeaponsVerification.impact(level); + require(left.getHealth() == 13 && right.getHealth() == 13, "spam cannot sweep"); + for (Zombie mob : mobs) { mob.invulnerableTime = 0; } + packets.handleAnimate(new net.minecraft.network.protocol.game.ServerboundSwingPacket(InteractionHand.MAIN_HAND)); WeaponsVerification.impact(level); + require(left.getHealth() == 13 && right.getHealth() == 13, "hit plus swing packet cannot hit twice"); + for (Zombie mob : mobs) { mob.discard(); } + mobs.clear(); + for (int i = 0; i < 25; i++) { player.doTick(); } + player.setPos(100, 200, 100); + player.setOnGround(true); + Zombie blocked = target(level, mobs, 100, 102); + blocked.setYRot(180); + blocked.setItemSlot(EquipmentSlot.OFFHAND, new ItemStack(Items.SHIELD)); + blocked.startUsingItem(InteractionHand.OFF_HAND); + for (int i = 0; i < 6; i++) { blocked.tick(); } + blocked.setPos(100, 200, 102); + blocked.setYRot(180); + require(blocked.isBlocking(), "shield is raised"); + player.attack(blocked); WeaponsVerification.impact(level); + require(blocked.getHealth() == 20, "shield blocks twinblade"); + blocked.discard(); + mobs.clear(); + for (int i = 0; i < 25; i++) { player.doTick(); } + player.setPos(100, 200, 100); + player.setOnGround(true); + player.setYRot(90); + Zombie boundary = target(level, mobs, 100, 102); + Zombie back = target(level, mobs, 102, 100); + packets.handleAnimate(new net.minecraft.network.protocol.game.ServerboundSwingPacket(InteractionHand.MAIN_HAND)); WeaponsVerification.impact(level); + require(boundary.getHealth() == 13 && back.getHealth() == 20, "air swing respects rotated 90-degree boundary hp="+boundary.getHealth()+"/"+back.getHealth()+" charge="+player.getAttackStrengthScale(0)+" pick="+player.pick(player.blockInteractionRange(),1,false).getType()); + require(player.getAttackStrengthScale(0) == 0, "air swing consumes vanilla charge"); + } finally { + for (Zombie mob : mobs) { mob.discard(); } + player.setItemInHand(InteractionHand.MAIN_HAND, ItemStack.EMPTY); + } + } + + private static Zombie target(net.minecraft.server.level.ServerLevel level, List mobs, double x, double z) { + var target = new Zombie(level); + target.setNoAi(true); + target.setNoGravity(true); + target.setItemSlot(EquipmentSlot.HEAD, new ItemStack(Items.CARVED_PUMPKIN)); + target.setPos(x, 200, z); + target.getAttribute(Attributes.ARMOR).setBaseValue(0); + level.addFreshEntity(target); + mobs.add(target); + return target; + } + + private static void require(boolean ok, String message) { + if (!ok) { throw new AssertionError("Twinblade: " + message); } + AstraPlus.LOG.info("Twinblade verified: {}", message); + } +} diff --git a/src/verification/java/online/astradev/weapons/verification/WeaponsVerification.java b/src/verification/java/online/astradev/weapons/verification/WeaponsVerification.java new file mode 100644 index 0000000..eaa3652 --- /dev/null +++ b/src/verification/java/online/astradev/weapons/verification/WeaponsVerification.java @@ -0,0 +1,39 @@ +package online.astradev.weapons.verification; + +import java.nio.file.*; +import net.neoforged.fml.common.Mod; +import net.neoforged.api.distmarker.Dist; +import net.neoforged.neoforge.common.NeoForge; +import net.neoforged.neoforge.event.tick.ServerTickEvent; +import net.minecraft.server.level.ServerLevel; +import online.astradev.weapons.behavior.TwinbladeCombat; + +@Mod(value="astraweapons_verify",dist=Dist.DEDICATED_SERVER) +public final class WeaponsVerification { + private int ticks; + public WeaponsVerification() { + if(!Boolean.getBoolean("astraweapons.isolatedVerification")) throw new IllegalStateException("Verification JAR is isolated-server only"); + if(Boolean.getBoolean("astraweapons.capture")) new CaptureFixture(); + else NeoForge.EVENT_BUS.addListener(this::tick); + } + private void tick(ServerTickEvent.Post event) { + if(ticks==0) event.getServer().overworld().setChunkForced(6,6,true); + if(++ticks!=30) return; + String result; + try { + TwinbladeVerification.verify(event.getServer()); + GauntletVerification.verify(event.getServer()); + PackVerification.verify(); + result="PASS: twinblade arc/windup/shields/enchantments, seven-hit gauntlet combo/cooldown/area/offhand/pack"; + } catch(Throwable error) { + error.printStackTrace();result="FAIL: "+error; + } + try { Files.writeString(Path.of("weapons-result.txt"),result); } catch(Exception e) { throw new RuntimeException(e); } + event.getServer().halt(false); + } + public static void impact(ServerLevel level) { + ((net.minecraft.world.level.storage.ServerLevelData)level.getLevelData()).setGameTime(level.getGameTime()+2); + TwinbladeCombat.tick(); + } + public static void check(boolean ok,String message) { if(!ok) throw new AssertionError(message); } +} diff --git a/src/verification/resources/META-INF/neoforge.mods.toml b/src/verification/resources/META-INF/neoforge.mods.toml new file mode 100644 index 0000000..9df75c7 --- /dev/null +++ b/src/verification/resources/META-INF/neoforge.mods.toml @@ -0,0 +1,13 @@ +modLoader="javafml" +loaderVersion="[11,)" +license="All Rights Reserved" +[[mods]] +modId="astraweapons_verify" +version="1.0.0" +displayName="AstraWeapons isolated verification" +[[dependencies.astraweapons_verify]] +modId="astraweapons" +type="required" +versionRange="[0.1.0,)" +ordering="AFTER" +side="SERVER" diff --git a/tools/build_visuals.py b/tools/build_visuals.py new file mode 100644 index 0000000..2c5ef75 --- /dev/null +++ b/tools/build_visuals.py @@ -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 .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() diff --git a/tools/capture-client.ps1 b/tools/capture-client.ps1 new file mode 100644 index 0000000..0b30f1d --- /dev/null +++ b/tools/capture-client.ps1 @@ -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 } +} \ No newline at end of file diff --git a/tools/import_gauntlet_audio.py b/tools/import_gauntlet_audio.py new file mode 100644 index 0000000..ae6f919 --- /dev/null +++ b/tools/import_gauntlet_audio.py @@ -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() diff --git a/tools/install-mods.ps1 b/tools/install-mods.ps1 new file mode 100644 index 0000000..6246612 --- /dev/null +++ b/tools/install-mods.ps1 @@ -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 diff --git a/tools/verify-server.ps1 b/tools/verify-server.ps1 new file mode 100644 index 0000000..acad524 --- /dev/null +++ b/tools/verify-server.ps1 @@ -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"